Question

I have been tasked with recreating the Acrobat Reader with JavaScript. However, my "reader" will not present PDFs. Instead, my reader will present images that have been rasterized from PDFs. When I say recreate Acrobat, I need something that has these features:

  1. Display a series of images vertically
  2. Zoom and Pan on the images
  3. Paging up and down to navigate images as pages

I have looked everywhere for a jQuery plugin. I was wondering if anybody has any suggestions that might help me. Please let me know.

Was it helpful?

Solution

This is a much deeper subject than even I realized just a short time ago. I will give you the short version and it meets all of your needs specified as long as your pdf's are publicly accessible via http. This did not meet all of our needs but I hope it helps you.

Partial Solution

Not all browsers support this but some browsers support pdf as the source of embed, object and iframe tags and even allows you to view them without added javascript.

<embed src="file1.pdf" width="500" height="650"></embed>
<object type="application/pdf" data="file1.pdf" width="500" height="650" ></object>
<iframe src="PDFDirectory/Test.pdf"></iframe>

Answer

To get them to work in all browsers, rasterization and either JS or Flash is the answer. Surprisingly even google presents their pdf's in their viewer as a series of rasterized images. The good news is that you don't have to manually convert them and keep up with them if you take advantage of Google's publicly available viewer. Let google do all the hard work for you and save yourself from the frustration of GhostScript and ImageMagick (which is what we ended up having to use)! All you have to do is paste the url to your pdf and get the embed code! Not to mention that it was easy to programmatically generate the respected code.

https://docs.google.com/viewer

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top