This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Servlets and the fly likes converting byte array to pdf Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "converting byte array to pdf" Watch "converting byte array to pdf" New topic
Author

converting byte array to pdf

Manish Agarwal
Ranch Hand

Joined: Jun 22, 2004
Posts: 34
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.


Thanks and Regards,<br />Manish Agarwal<br />SCJP 1.4 (100%)<br />SCWCD 1.4 (98%)<br />SCBCD 1.3 (Preparing)
pascal betz
Ranch Hand

Joined: Jun 19, 2001
Posts: 547
set the content type ("application/pdf") and content length headers and then just send the bytes.

pascal
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

More of a Servlets question. I'm moving this to that forum.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12675
    
    5
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: converting byte array to pdf
 
Similar Threads
help in converting pdf into byte array
PDF display in JSP
copying file into database
problem reading pdf with iText Library
Display PDF in IE from byte array using Servlet