This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Rust Web Development and have Bastian Gruber on-line!
See this thread for details.
Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

JSp Output to PDF

 
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ,

I am trying to open the output of a JSP in a PDF , but it does nt open ..
What i am trying is , get all jsp output in a string and then write the string to output stream


i have some thing below in my code , but it doesnot work .

response.setContentType("application/pdf");
response.setHeader("Content-disposition","attachment; filename=Sample.pdf");
o = response.getOutputStream();

....

o.println(concatedString);

I tried converting my string into byte array and then write , still it doesnt work .

It says that file is not pdf supported and when i view the file source it is in HTML (the format which i wrote it) . DO i have to do anything in addition to convert into PDF . Please clarify as it is very critical.

With the same above steps and contecnt type as "application/word" , i coudl open the word document.


thanks in advance.

Regards
SUnil.s
 
Sheriff
Posts: 67619
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you are telling the browser that you are sending PDF, then you have to send PDF format. You can't send HTML and expect the browser to magically convert it.
 
sunilkumar ssuparasmul
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Bear Bibeault


I infact realsied that and i used ITEXT API to send my text to the API but whne i use Itext api , i am not able to oprn the file at runtime as it says Permission Denied , when i tried to open the file

has any one implemented a better solution to convert from HTML to RTF and PDF , if not atleast with simple text (no htm) to create a RTF and PDF thru java

Thanks is Advance.


Regards
Sunil.s
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic