views:

69

answers:

1

Hi,

I need to include pdf files in some webpages, and I'm gettin' in troubles. The app is a simple newspaper's archive, in which i can read right on page or download as pdf files, one file per page. What my customer can provide me is one pdf file for each page; what my customer wants from me is to navigate them in indexes (with page thumbnail) and have a read from a choosen one direcly in page; I'm using php/mysql.

I started trying out to use the <object> tag with type="application/pdf", but i found it's deprecate 'cause it's not crossplatform at all (there's no support on linux's browsers, but even my windows' firefox 3.5 couldn't show me anything).

I guessed I could transform that pdf in something different (html or simply images are good enough), but the only thing i found is ImageMagick, that I cannot use as I must install on server and I can't, as I'm not admin of that machine.

So, I'm finally looking for suggestions

Thanks

+1  A: 

Display the pdf inline using an IFRAME. The thumbnail you can generate with imageMagik. You should be able to use the command line version of ImageMagik to resize and convert to jpg.

edit

Your best bet is to talk to the server admin and have them install php support for ImageMagik then you can use it as a class.

If you can't get support to install on the server, you will have to use the command line version.

You might be able to Google around for a library that wraps the command line, but it would be trivial to write it yourself.

With this in place you can create a large readable black and white png for each page. It should click through to the pdf.

Byron Whitlock
...or PNG, which is better suited to black-and-white text. And ideally you should cache the thumbnails and run them through OptiPNG or Pngcrush automatically to reduce space and bandwidth. And if ImageMagick isn't available, Ghostscript might be, which is capable of the same (or make thumbnails on your own system and use these on the server).
Marcel Korpel
Reading the ImageMagick's docs I've understood I must install it in the server and run it (also from php, but the program has to be placed in machine). Is there a version I can run as a php class?
balanza
@Byron_Whitlock iframe is not a solution 'cause it silently creates a web page with an object (or embed) tag inside.
balanza
@balanza: what about pre-building the thumbnails on your own machine? That way, you can install ImageMagick locally and upload the generated (and optimized) thumbnails.
Marcel Korpel
@Marcel_Korpel maybe I wanna reach the impossible.....I want my customer to be free of the application-mechanism. He should only upload a page.pdf file, then the software should silently elaborate it and create images, thumbnail, etc etc....
balanza