wood burning stoves
The moose likes HTML, CSS and JavaScript and the fly likes regarding pdf Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "regarding pdf" Watch "regarding pdf" New topic
Author

regarding pdf

santhosh kumar vk
Ranch Hand

Joined: Aug 25, 2009
Posts: 148
hi

I am using doing one project in that i want to show report as pdf, I was using content type as application/pdf in page directive but it did not work please tell me how to display jsp as pdf.


Thanking You.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 63195
    
  69

Read ⇒ ItDoesntWorkIsUseless, and provide more information.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
santhosh kumar vk
Ranch Hand

Joined: Aug 25, 2009
Posts: 148
hi

I was using <% page contentType="application/pdf" %> but it is opening in browser, I was using struts iterator tag and bean:write tag.


Thanking you.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 63195
    
  69

What did you expect it to do? What do you have your browser configured to do?
santhosh kumar vk
Ranch Hand

Joined: Aug 25, 2009
Posts: 148
hi

I am using code like struts <logic:iterator> and <bean:write> in jsp it will show some collection it is opening in browser but it should open in pdf how to open
please tell me.

Thanking You.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 63195
    
  69

What you are using (Struts, and so on) is irrelevant. The browser will handle the PDF in that manner in which it was configured to do so.

The only other control you have over the situation is setting the content-disposition header. Search for information on that header and see if you can get the behavior you want. If not, then it's a matter of browser configuration.
Paul Clapham
Sheriff

Joined: Oct 14, 2005
Posts: 19718
    
  10

You'll also want to actually output PDF. I get the feeling that you are outputting HTML and expecting something at the client side to display that in PDF format. It doesn't work that way.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 63195
    
  69

Hmmm, good point Paul.
Ulf Dittmer
Rancher

Joined: Mar 22, 2005
Posts: 42958
    
  73
Also, JSPs are not suitable for handling binary content (like PDFs) - you need to use a servlet instead.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Paul Clapham wrote:It doesn't work that way.

It does here:

 
Have you checked out Aspose?
 
subject: regarding pdf
 
jQuery in Action, 3rd edition