Monday, November 26, 2007

How to create PDF document portal in webpage?

PDF document portal in webpage, would allow you to display the PDF document based on its sections. It would greatly enhance the viewer's ability to select the best content based on their preference.
1. Download pdftk
2. Download pdfportal
3. Download pdftotext
3. Unzip pdfportal, copy the contents to your web server which support PHP
4. Edit pdfportal.config.php to refer the location of pdftk and pdftotext in your webserver
5. If you can't install pdftk or pdftotext on your web server, use pdftk and pdftotext on your local machine to create the necessary data files and then upload these data files to your web server. Read
pdfportal.config.php for details.
6. Let's assume the pdfportal files is copied in
http://localhost/pdfportal/ and the location of the PDF document is http://localhost/pdfportal/sample.pdf, use this path to view PDF using the portal by passing it to pdffile.php
http://localhost/pdfportal/pdffile.php?pdf=/collection/sample.pdf

pdffile.php tells pdftk to create http://localhost/collection/sample.pdf.info, if it isn't exist. pdffile.php then uses the converted plain-text info file to create an HTML page. An info file is simply the output from pdftk's dump_data operation

Open your PDF's document portal. If pdffile.php can find pdftotext on your computer (see pdfportal.config.php), it does two things. It uses pdftotext to convert your PDF into a plain-text file, and it activates its search interface. It stores the plain-text file in the same directory as the PDF file.

When you submit a search, pdffile.php scans this text file to discover which PDF pages contain your search terms. It reports search hits in reading order. If the PDF has bookmarks, these are used to organize the results. Click a link and the PDF opens to that page.

2 comments:

DRM Protection said...

It is possible to create a high-quality PDF document without the use of Adobe Acrobat. It is very simple and in no time at all, you will be generating your PDF documents. Thanks a lot...

PDF signature said...

I am a newbie in web development and assigned this assignment by team leader this weekend .I wanted to thank you for the post as it helped me a lot