Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

converting byte array to pdf

 
Manish Agarwal
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a byte array of a pdf file. I want to show the pdf in web browser using this byte array.Is there any way to do it.

Any suggestions are welcome.
 
pascal betz
Ranch Hand
Posts: 547
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
set the content type ("application/pdf") and content length headers and then just send the bytes.

pascal
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
More of a Servlets question. I'm moving this to that forum.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13061
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Note that because a PDF should be considered binary data, you must send the bytes to an output stream from getOutputStream(), not a writer from getWriter().
Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic