Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » PDF Problem with SWT Browser on Linux/GTK SWT 3.1.1 w/ Mozilla
PDF Problem with SWT Browser on Linux/GTK SWT 3.1.1 w/ Mozilla [message #466157] Wed, 04 January 2006 01:29 Go to next message
Joe Mihalich is currently offline Joe MihalichFriend
Messages: 25
Registered: July 2009
Junior Member
Hi,

We're having a problem displaying pdf files from and SWT Browser
class in Mozilla on Suse Linux with SWT 3.1.1.

When I launch Mozilla standalone, and navigate to the page that
embeds the pdf, it works fine. A dialog popups asking me if I want
to open it with acrobat, or save the file.

When I navigate to the page inside an swt browser class,
I immediately get the file save-as dialog...it doesn't give me the
option of opening it in acrobat. If I save the file, it winds up
saving a valid pdf file which I can open in acrobat.

Am I doing something wrong, or could this be a bug
in SWT? In our case, the url I set is actually to a normal html page.
then if you
click on a button on the page, it hits our server, which
returns a pdf response

Here is basically what I'm doing....

final Shell shell = new Shell();
shell.setText(windowTitle);
shell.setLayout(new FillLayout());
shell.setMaximized(true);

Composite comp = new Composite(shell, SWT.NONE);
comp.setLayout(new FillLayout());

Browser browser = new Browser(comp, SWT.NONE);

browser.addOpenWindowListener(new OpenWindowListener()
{
public void open(WindowEvent event)
{
Shell shell = new Shell(getMainShell().getDisplay());
shell.setText("");
shell.setLayout(new FillLayout());
Browser browserNew = new Browser(shell, SWT.NONE);
//add window open/close listeners here (removed for brevity
sake)
event.browser = browserNew;
}
});

browser.addCloseWindowListener(new CloseWindowListener()
{
public void close(WindowEvent event)
{
Browser browserNew = (Browser)event.widget;
Shell shell = browserNew.getShell();
shell.close();
}
});

browser.setUrl(url);
shell.open();

Thanks,
Joe
Re: PDF Problem with SWT Browser on Linux/GTK SWT 3.1.1 w/ Mozilla [message #466158 is a reply to message #466157] Wed, 04 January 2006 01:32 Go to previous messageGo to next message
Joe Mihalich is currently offline Joe MihalichFriend
Messages: 25
Registered: July 2009
Junior Member
Btw, I should also mention that this same flow works
fine on windows with IE.

Thanks,
Joe
Re: PDF Problem with SWT Browser on Linux/GTK SWT 3.1.1 w/ Mozilla [message #466159 is a reply to message #466157] Wed, 04 January 2006 02:39 Go to previous messageGo to next message
Haris Peco is currently offline Haris PecoFriend
Messages: 1072
Registered: July 2009
Senior Member
Joe,
I think that you have two versions mozilla
pdf view work fine when you have pdf plugin for mozilla
- you have plugin when launch mozilla standalone, but no when call swt
browser
it is possible that you have user-based plugin for mozilla
(in .mozilla/plugins) and it isn't used when you call from swt

workaround : check pdf plugin for mozilla in MOZILLA_FIVE_HOME/plugins

peco
Joe Mihalich wrote:

>
> Hi,
>
> We're having a problem displaying pdf files from and SWT Browser
> class in Mozilla on Suse Linux with SWT 3.1.1.
>
> When I launch Mozilla standalone, and navigate to the page that
> embeds the pdf, it works fine. A dialog popups asking me if I want
> to open it with acrobat, or save the file.
>
> When I navigate to the page inside an swt browser class,
> I immediately get the file save-as dialog...it doesn't give me the
> option of opening it in acrobat. If I save the file, it winds up
> saving a valid pdf file which I can open in acrobat.
>
> Am I doing something wrong, or could this be a bug
> in SWT? In our case, the url I set is actually to a normal html page.
> then if you
> click on a button on the page, it hits our server, which
> returns a pdf response
>
> Here is basically what I'm doing....
>
> final Shell shell = new Shell();
> shell.setText(windowTitle);
> shell.setLayout(new FillLayout());
> shell.setMaximized(true);
>
> Composite comp = new Composite(shell, SWT.NONE);
> comp.setLayout(new FillLayout());
>
> Browser browser = new Browser(comp, SWT.NONE);
>
> browser.addOpenWindowListener(new OpenWindowListener()
> {
> public void open(WindowEvent event)
> {
> Shell shell = new Shell(getMainShell().getDisplay());
> shell.setText("");
> shell.setLayout(new FillLayout());
> Browser browserNew = new Browser(shell, SWT.NONE);
> //add window open/close listeners here (removed for brevity
> sake)
> event.browser = browserNew;
> }
> });
>
> browser.addCloseWindowListener(new CloseWindowListener()
> {
> public void close(WindowEvent event)
> {
> Browser browserNew = (Browser)event.widget;
> Shell shell = browserNew.getShell();
> shell.close();
> }
> });
>
> browser.setUrl(url);
> shell.open();
>
> Thanks,
> Joe
Re: PDF Problem with SWT Browser on Linux/GTK SWT 3.1.1 w/ Mozilla [message #466160 is a reply to message #466159] Wed, 04 January 2006 01:56 Go to previous messageGo to next message
Joe Mihalich is currently offline Joe MihalichFriend
Messages: 25
Registered: July 2009
Junior Member
Hi thanks for the info. I was a little confused by that.

I am running mozilla from the same place /opt/mozilla
when I run standalone, and MOZILLA_FIVE_HOME is
also pointing to /opt/mozilla.

That being said, I looked in the plugins directory in
/opt/mozilla and I do not see a pdf plugin in there, which
could possibly be the problem.

Could you explain again how pdf's would work from
mozilla then when I run i standalone?

Thanks,
Joe
Re: PDF Problem with SWT Browser on Linux/GTK SWT 3.1.1 w/ Mozilla [message #466161 is a reply to message #466160] Wed, 04 January 2006 02:46 Go to previous messageGo to next message
Joe Mihalich is currently offline Joe MihalichFriend
Messages: 25
Registered: July 2009
Junior Member
Ok, so I was still unable to get it to work.

Here is what I did:

As per Adobe's Instructions:

1) Ran the acrobat-plugin-installer script in the acrobat/browser
directory
2) verified that the pdf plugin was now in /opt/mozilla/plugins
3) Added the acrobat/bin directory to the system path so the acrobat
startup
script is in the path.

After restarting the system (cold boot), after these changes were made,
I still
see the same results.

Mozilla is only installed in one place on this box, and
MOZILLA_FIVE_HOME
is definitely pointing to the right place.

Any ideas why this is still happening?

Thanks,
Joe
Re: PDF Problem with SWT Browser on Linux/GTK SWT 3.1.1 w/ Mozilla [message #466164 is a reply to message #466161] Wed, 04 January 2006 04:33 Go to previous messageGo to next message
Joe Mihalich is currently offline Joe MihalichFriend
Messages: 25
Registered: July 2009
Junior Member
Also, in answer to my other question, I read on the adobe site that
the reason the standalone version was able to open the pdf without
the plugin was because of Mozilla's plugin scanning functionality.

Still not able to figure this one out from in the SWT Browser. It feels
like a configuration issue, but I've exhausted all options that I
could find or think of.

Joe
Re: PDF Problem with SWT Browser on Linux/GTK SWT 3.1.1 w/ Mozilla [message #466170 is a reply to message #466164] Wed, 04 January 2006 13:44 Go to previous messageGo to next message
Haris Peco is currently offline Haris PecoFriend
Messages: 1072
Registered: July 2009
Senior Member
Joe,
you install plugin on user base , probably
When you intsall plugin you have this menu
1. Perform global installation
2. Perform user-specific installation (Mozilla/Firefox/Netscape)

choose 1 and you will install plugin in main mozilla plugins home
set browser install directory to MOZILLA_FIVE_HOME or
set /etc/gre.conf like this :
[1.7]
GRE_PATH=/usr/local/mozilla
and set install dir to /usr/local/mozilla

check MOZILLA_FIVE_HOME/plugins for file nppdf.so

you can copy nppdf.so to MOZILLA_FIVE_HOME/plugins - it work too

check that pdf work for another users (except user which install plugin)

Joe Mihalich wrote:

> Also, in answer to my other question, I read on the adobe site that
> the reason the standalone version was able to open the pdf without
> the plugin was because of Mozilla's plugin scanning functionality.
>
> Still not able to figure this one out from in the SWT Browser. It feels
> like a configuration issue, but I've exhausted all options that I
> could find or think of.
>
> Joe
Re: PDF Problem with SWT Browser on Linux/GTK SWT 3.1.1 w/ Mozilla [message #466197 is a reply to message #466170] Wed, 04 January 2006 19:23 Go to previous messageGo to next message
Joe Mihalich is currently offline Joe MihalichFriend
Messages: 25
Registered: July 2009
Junior Member
I have done everything you mentioned.

When we installed the plugin, we installed it in
global mode. The plugin does exist in mozilla/plugins
and MOZILLA_FIVE_HOME in my app startup
script is set to /opt/mozilla. (If the latter weren't set
I wouldn't be able to launch the browser at all).

FYI, we're using acrobate 7.0.1, which I believe
is the latest.

Joe
Re: PDF Problem with SWT Browser on Linux/GTK SWT 3.1.1 w/ Mozilla [message #466201 is a reply to message #466197] Wed, 04 January 2006 20:38 Go to previous messageGo to next message
Haris Peco is currently offline Haris PecoFriend
Messages: 1072
Registered: July 2009
Senior Member
and it doesn't work, yet ?

remove nppdf.so from .mozilla/plugins and
try standalone pdf in mozilla

you have more mozilla installations, maybe

i use 7.0.1, too
Joe Mihalich wrote:

>
> I have done everything you mentioned.
>
> When we installed the plugin, we installed it in
> global mode. The plugin does exist in mozilla/plugins
> and MOZILLA_FIVE_HOME in my app startup
> script is set to /opt/mozilla. (If the latter weren't set
> I wouldn't be able to launch the browser at all).
>
> FYI, we're using acrobate 7.0.1, which I believe
> is the latest.
>
> Joe
Re: PDF Problem with SWT Browser on Linux/GTK SWT 3.1.1 w/ Mozilla [message #466271 is a reply to message #466201] Thu, 05 January 2006 17:47 Go to previous messageGo to next message
Joe Mihalich is currently offline Joe MihalichFriend
Messages: 25
Registered: July 2009
Junior Member
Hi,

When I remove the plugin from the mozilla directory,
standalone still works due to the mozilla plugin scanning
feature. See here:

http://plugindoc.mozdev.org/faqs/acroread.html#install-linux

There is only 1 mozilla installed on this box. We also
have firefox installed but that's in a different directory, and nothing
points there.

Any other ideas?

Joe
Re: PDF Problem with SWT Browser on Linux/GTK SWT 3.1.1 w/ Mozilla [message #466277 is a reply to message #466271] Thu, 05 January 2006 21:01 Go to previous messageGo to next message
Haris Peco is currently offline Haris PecoFriend
Messages: 1072
Registered: July 2009
Senior Member
Joe,
it is simple - you have to find mozilla install which eclipse use
and plugin have to exists in MOZILLA_FIVE_HOME/plugins
if you have mozilla nad firefox it is two mozilla install
(firefox is mozilla without mail, irc,news,composer etc - it is same
libraries) - you eclipse use firefox , maybe
add nppdf.so to FIREFOX_HOME/plugins, too

try make new user and start standalone mozilla and check pdf plugin
(without install plugin for this user)

you can see plugins with link about:plugins (in swt browser , too)
- check this link standalone and in swt browser and you will see different
swt browser is complete same like standalone mozilla
Joe Mihalich wrote:

>
> Hi,
>
> When I remove the plugin from the mozilla directory,
> standalone still works due to the mozilla plugin scanning
> feature. See here:
>
> http://plugindoc.mozdev.org/faqs/acroread.html#install-linux
>
> There is only 1 mozilla installed on this box. We also
> have firefox installed but that's in a different directory, and
> nothing points there.
>
> Any other ideas?
>
> Joe
Re: PDF Problem with SWT Browser on Linux/GTK SWT 3.1.1 w/ Mozilla [message #466460 is a reply to message #466277] Tue, 10 January 2006 17:36 Go to previous message
Joe Mihalich is currently offline Joe MihalichFriend
Messages: 25
Registered: July 2009
Junior Member
OK, so FYI, we figured out the problem.

When we were trying to resolve the path to
the pdf file, we were using File.getAbsolutePath(),and
on linux it was returning "/." instead of the of a full path
like on windows.

So, we fixed the code to get the path of the pdf correctly,
and it works fine now.

Thanks for the help.
Joe
Previous Topic:file name tab does not show the entire name!
Next Topic:No labels
Goto Forum:
  


Current Time: Wed Dec 04 14:40:36 GMT 2024

Powered by FUDForum. Page generated in 0.03926 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top