• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 833
  • Last Modified:

PDF Viewer In Browser Without Acrobat Reader

My application needs to let people view pdf's right in the browser, without the need to install Acrobat Reader.

What are my options?

A few of my thoughts (which might be all wrong.. nor do i even know how to go out any of them) are:

1. convert pdf pages to images on the fly, and use php to display these images

2. find a java pdf viewer, and simply pass the pdf to the viewer page.

Any thought on how I might accomplish this?

I also want to make sure the user cannot print out the result. They must buy the source pdf if they really want a quality print out. (i know i can never stop them from taking screen shots.. so that's not a problem)
  • 4
  • 3
1 Solution
I would recommend using ImageMagick.

The program you want is called convert.  It's usually found at /usr/local/bin/convert, but it depends out your Linux distribution.  I'm not sure where you would find it in windows right now.

$CONVERT = '/path/to/convert';
$YourPDF = '/path/to/filename.pdf';
$YourJPG = '/path/to/desired/outputfile.jpg';

exec("$CONVERT -resize 640x480 $YourPDF $YourJPG");

ImageMagick could already be on your hosting server.  Try "which convert" at the shell prompt to find out, then "convert --help | more" to see if it says it's ImageMagick.  If you need to download it go to http://www.imagemagick.org/
That of course is for the convert to JPG option.  I found several Java PDF Viewers, but not free ones.
There is pdfgo - which is a trail - http://www.pdfgo.com/
You will probably need thee Java Virtual Machine installed on your server for that

Theres an online demo of it working here - http://www.icesoft.com/demoA.html

As said by petoskey-001 there are various Java PDF viewers about but they are generally trialware or shareware, rarely freeware
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

hmm, that said i have just stumbled across this, which can be used in conjunction with Java... im not sure how well geared it is towards what you want but it certainly look to be worth while checking out

homepage: http://www.lowagie.com/iText/
d/l link: http://sourceforge.net/projects/itext/
A Java viewer should probably be avoided because if your Java Client can download the PDF, your customers can probably view source or watch the request headers sent to the server and get the PDF as well.  You would have to password protect your server and setup the Java Viewer to use some sort of password as well.  Maybe SSL...

Just a thought.
micamediaAuthor Commented:
well, i don't need to worry about my clients figuring out how to intercept the pdf going to the java viewer. They are not that smart.

And i never said the view has to be free. In fact i don't expect it to be.

Now.. if i use imagemagik, will it allow me to cover all the pages of the pdf to an image? And then once i get that far, how do i make a viewer for the image that isn't just a simple click here to view the image. I don't want that as they would just click here, and print it out. That's no good.

I would go with one of the Java viewers then.  Any JPG you give create really be protected.  I was thinking of it more as a thumbnail generator.  I suppose a JPG could be protected, but only by using something like a java or flash viewer anyway so you might as well go with the PDF viewer.  

I know little about them, but the icesoft one listed above shows up first in a google search.  
Its like the old saying, if you want your work protected don't put it on the web.

Pretty much anything can be obtained one way or another, direct download, hooking the file out of the temp internet files, screen dumps, the list goes on.

Something like a Java viewer will help the cause as the user will only be able to view the document, there is still print screen as i think has been said before but its more secure then the alternatives.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now