This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one 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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript 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: 12769
    
    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