Go Premium for a chance to win a PS4. Enter to Win


PDF Viewer In Browser Without Acrobat Reader

Posted on 2004-09-03
Medium Priority
Last Modified: 2012-05-05
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)
Question by:micamedia
  • 4
  • 3

Accepted Solution

petoskey-001 earned 1000 total points
ID: 11974187
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/

Expert Comment

ID: 11974225
That of course is for the convert to JPG option.  I found several Java PDF Viewers, but not free ones.
LVL 27

Expert Comment

ID: 11974291
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 27

Expert Comment

ID: 11974313
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/

Expert Comment

ID: 11974368
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.

Author Comment

ID: 11974422
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.


Expert Comment

ID: 11974498
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.  
LVL 27

Expert Comment

ID: 11974626
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.

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
This article discusses how to implement server side field validation and display customized error messages to the client.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

927 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question