File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Other Open Source Projects and the fly likes Display pdf in browser Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Display pdf in browser" Watch "Display pdf in browser" New topic

Display pdf in browser

amarshi mohanty
Ranch Hand

Joined: Jul 01, 2008
Posts: 110
Hi ,
Anyone has sample code to display a pdf text file on browser.I am able to display pdf having an image in browser.


SCJP (97%), SCWCD (95%))
Shobhit Khandelwal

Joined: Feb 19, 2009
Posts: 24
iText library(api for pdf generation) may be useful for your problem.
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
A PDF is a PDF, no matter whether it contains text of images. Why do you think that makes a difference?
Kuldip Shetty
Ranch Hand

Joined: Jan 07, 2010
Posts: 42

To display the PDF contents on the browser you can set the HttpServletResponse ContentType as "application/pdf" and then put the file contents in the OutputStream otptStream = response.getOutputStream();

Marco Bartolini

Joined: Dec 14, 2009
Posts: 9

System.out.print("Hello World! SCJP 5 79% - SCWCD 5 86%");
I agree. Here's the link:
subject: Display pdf in browser
jQuery in Action, 3rd edition