PHP - upload a pdf file and display thumnails of all pages

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
cjkeane
Forum Contributor
Posts: 217
Joined: Fri Jun 11, 2010 1:17 pm

PHP - upload a pdf file and display thumnails of all pages

Post by cjkeane »

Hi.
I'm wondering if anyone knows of any way to upload a pdf file and display thumbnails of all of its pages ? Either that or upload a pdf and extract all pages as images.
i've been researching it and not sure how it can be done. thanks.
thinsoldier
Forum Contributor
Posts: 367
Joined: Fri Jul 20, 2007 11:29 am
Contact:

Re: PHP - upload a pdf file and display thumnails of all pag

Post by thinsoldier »

Wild guess here:

Upload a pdf file like you would any other file.

Have something like https://pdfbox.apache.org/ installed on your server.

Somehow from php trigger pdfbox to read your uploaded pdf files and outpout image files to a folder in your site folder.
https://pdfbox.apache.org/2.0/commandli ... pdftoimage
Warning: I have no idea what I'm talking about.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: PHP - upload a pdf file and display thumnails of all pag

Post by Christopher »

Well, the upload is the same as any other file -- so that's the easier part. There are several ways to either display a PDF (search for "javascript PDF viewers") or to generate image from it like PDF Box mentioned above. Depending on the server type, you may be able to print the PDF to images as well.
(#10850)
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: PHP - upload a pdf file and display thumnails of all pag

Post by Celauran »

Might also be worth looking at poppler utils.
Post Reply