• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

regarding pdf

 
santhosh kumar vk
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64620
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Read ⇒ ItDoesntWorkIsUseless, and provide more information.
 
santhosh kumar vk
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64620
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What did you expect it to do? What do you have your browser configured to do?
 
santhosh kumar vk
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64620
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20735
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64620
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmmm, good point Paul.
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, JSPs are not suitable for handling binary content (like PDFs) - you need to use a servlet instead.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:It doesn't work that way.

It does here:

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic