Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Browser and PDF(Using Browser to view PDF)
Browser and PDF [message #785369] Sat, 28 January 2012 23:02 Go to next message
Glen Zoerner is currently offline Glen Zoerner
Messages: 3
Registered: March 2011
Junior Member
Hi,

I'm using the Browser to view PDF documents in the Win7 environment. With the 32-bit library it works beautifully. With the swt-3.6.2_64 library and JRE 1.7.0_02-b13, the Browser window opens, a smaller window flashes (too quick to read) then the document opens in a separate Adobe Reader window. The Browser window remains empty.

Any hints?

Glen
Re: Browser and PDF [message #786584 is a reply to message #785369] Mon, 30 January 2012 15:53 Go to previous messageGo to next message
Grant Gayed is currently offline Grant Gayed
Messages: 2151
Registered: July 2009
Senior Member
Hi Glen,

The likely cause is that you have the 32-bit PDF viewer plug-in
installed, which is not being successfully loaded by the 64-bit embedded
IE control. As a result the IE control is just launching the PDF viewer
stand-alone in a separate process.

To see this, launch stand-alone 64-bit IE [will appear in your Windows
programs list as "Internet Explorer (64-bit)"], navigate it to a .pdf
file, and I suspect you'll see the same behaviour.

Grant


On 1/28/2012 6:02 PM, Glen Zoerner wrote:
> Hi,
>
> I'm using the Browser to view PDF documents in the Win7 environment.
> With the 32-bit library it works beautifully. With the swt-3.6.2_64
> library and JRE 1.7.0_02-b13, the Browser window opens, a smaller window
> flashes (too quick to read) then the document opens in a separate Adobe
> Reader window. The Browser window remains empty.
>
> Any hints?
>
> Glen
Re: Browser and PDF [message #786830 is a reply to message #786584] Mon, 30 January 2012 21:25 Go to previous messageGo to next message
Glen Zoerner is currently offline Glen Zoerner
Messages: 3
Registered: March 2011
Junior Member
Grant,

Many thanks for the quick response. Your explanation makes sense. The problem going forward is how to account for the 32-bit PDF viewer that my customers will probably have installed. I found another solution that involves using the rundll32 program that ships with Windows. It calls Adobe Reader or Acrobat directly. If there is a problem finding the Adobe executable, it fails silently.

// fileName has a .pdf suffix
public class Viewer {
public Viewer(String fileName) {
try {
Runtime.getRuntime().exec("rundll32 url.dll, FileProtocolHandler " + fileName);
} catch (Exception e) {
System.out.println("Error" + e ); //print the error
}
}
}

The SWT library is fantastic. The performance is terrific. But the 32-bit vs 64-bit issue causes me to have two separate executables. Not a big deal but a logistics issue. Customers tend to not be too interested in these sorts of issues.

Again thanks for your assistance.

Glen
Re: Browser and PDF [message #787433 is a reply to message #786830] Tue, 31 January 2012 15:17 Go to previous messageGo to next message
Grant Gayed is currently offline Grant Gayed
Messages: 2151
Registered: July 2009
Senior Member
One other possibility is to only ship your app based on 32-bit eclipse.
It'll work fine on 64-bit Windows as long as a 32-bit JRE is available
to run it. You likely don't need the extra addressable space that
64-bit gives (there are a few apps out there that really do need to be
able to address this much memory, but they're the exception, usually
dealing with huge complex models of things, etc.).

Also (I think relevant to your last response), if you're looking to
launch an external app then have a look at swt's Program class. It can
find you the OS-registered app for a given filename suffix, among other
things.

Grant


On 1/30/2012 4:25 PM, Glen Zoerner wrote:
> Grant,
>
> Many thanks for the quick response. Your explanation makes sense. The
> problem going forward is how to account for the 32-bit PDF viewer that
> my customers will probably have installed. I found another solution that
> involves using the rundll32 program that ships with Windows. It calls
> Adobe Reader or Acrobat directly. If there is a problem finding the
> Adobe executable, it fails silently.
>
> // fileName has a .pdf suffix
> public class Viewer {
> public Viewer(String fileName) {
> try {
> Runtime.getRuntime().exec("rundll32 url.dll, FileProtocolHandler " +
> fileName);
> } catch (Exception e) {
> System.out.println("Error" + e ); //print the error
> }
> }
> }
>
> The SWT library is fantastic. The performance is terrific. But the
> 32-bit vs 64-bit issue causes me to have two separate executables. Not a
> big deal but a logistics issue. Customers tend to not be too interested
> in these sorts of issues.
>
> Again thanks for your assistance.
>
> Glen
Re: Browser and PDF [message #787484 is a reply to message #787433] Tue, 31 January 2012 16:30 Go to previous message
Glen Zoerner is currently offline Glen Zoerner
Messages: 3
Registered: March 2011
Junior Member
Grant,
Thanks for the followup. My initial release was just like you described. Several customers didn't have the 32-bit JRE installed so the program just died at launch on 64-bit systems. That doesn't look good for a trial-version of the program. My new distribution package has both 32-bit and 64-bit executables for the installer and the actual program. An installer-for-the-installer (a baby Java program with no GUI) determines the OS.Arch and selects the appropriate installer. It actually works pretty well. I know it's clunky by my customers never see the clunkiness.

Relating to the rundll32. I'm aware that it isn't the best. Thanks for pointing to the Program class. I'll use that technique for the next software release.

Again, thanks for your help. The Eclipse team has been terrific.

Glen
Previous Topic:Japanese Imperial Calendar support
Next Topic:Setting PrinterData.orientation is useless to PrintDialog
Goto Forum:
  


Current Time: Wed Oct 22 06:33:16 GMT 2014

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

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