wood burning stoves 2.0*
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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: 144
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: 60752
    
  65

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: 144
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: 60752
    
  65

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: 144
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: 60752
    
  65

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
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

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: 60752
    
  65

Hmmm, good point Paul.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41052
    
  43
Also, JSPs are not suitable for handling binary content (like PDFs) - you need to use a servlet instead.


Ping & DNS - my free Android networking tools app
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

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

It does here:

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: regarding pdf
 
Similar Threads
Div inner Html to PDF
Can I read already pdf file
Creating a file from Various chunks of different files in java
Generate pdf file using Servlets
How can I print my pdf file to printer using swt and save the pdf file