aspose file tools
The moose likes JSF and the fly likes PDF in new Browser window Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » JSF
Reply Bookmark "PDF in new Browser window" Watch "PDF in new Browser window" New topic
Author

PDF in new Browser window

James Frankman
Greenhorn

Joined: Jun 01, 2006
Posts: 12
I am trying to stream a PDF to a new browser window. I can get this to work, but the strange thing that happens is that a new browser window gets opened, but instead of the PDF geting displayed inside the browser window, it is opened separately by Adobe Acrobat. So, the user is forced to close two windows, the Adobe Acrobat window and the blank Browser window. I have gone over my code but have never seen any behavior quite like this. Does anyone know what will cause a new browser window to open up, but still open Adobe Acrobat outside of the browser? Any thoughts on why this is happening?

My code is as follows:

JBoss Seam Link:


here is the heart of the Print Report Bean's method:



Here is the entire method incase you need to see the context of the snippet above.

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 14475
    
    7

This depends somewhat on what browser brand and version the user has. Originally, I believe there was an option you could set that indicated whether the PDF (or a Word document, etc.) would open in a browser window or open in a standalone app window. However Eolas won a $500 million lawsuit against Microsoft while required Microsoft to switch off some of that functionality in IE.

In short, I'm not sure it's possible for you to always get the document to come up in a browser window. It never was, but when the patent lawyers got involved that made the issue even murkier.

If my memory is accurate, the control of in-browser ("inline") versus independent window output is part of the output headers, but, as I said, the browser may not always honor it.

Update: I think that it's the Content-Disposition header that you want to look at, now that I think of it.
[ August 03, 2007: Message edited by: Tim Holloway ]

Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: PDF in new Browser window
 
Similar Threads
When i try to open pdf, it shows 'There was an error opening this document.' message
Exception while writing to output stream
Open crystal report in JSP
Save POI Excel file in JSF
JasperReports in webapp (JSF2)