File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » Servlets
Bookmark "converting byte array to pdf" Watch "converting byte array to pdf" New topic

converting byte array to pdf

Manish Agarwal
Ranch Hand

Joined: Jun 22, 2004
Posts: 34

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.

Paul Sturrock

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

Joined: Mar 22, 2000
Posts: 13037
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().
I agree. Here's the link:
subject: converting byte array to pdf
It's not a secret anymore!