1

Possible Duplicates:
Read pdf files with php
Is there a PDF parser for PHP?

Hello

I have two issues:

  1. I have a pdf file(it contains around 40 pages) and i just want to read it and and display the contents in the browser.

  2. Read and display the content of a specific page(e.g. Page no 32) or a

range of specific pages(e.g. page 23-25).

I am using PHP 5 so just tell me how can i do this?

I am very thankful to you all if you will explain it with example(a little bit of code).

-Thanks

Community
  • 1
  • 1
Peeyush
  • 4,728
  • 16
  • 64
  • 92

2 Answers2

1

You can install the Xpdf package, http://www.foolabs.com/xpdf/download.html, then exec from PHP and call pdftotext to translate the pdf to text. After that simply read in the contents of the text file and display accordingly on the screen.

If you have access to the server and the PDF, do the translation manually and upload the translation at text or HTML and display that to the user.

If you absolutely require the ability to display the contents of the PDF to the user through the browser, most users have browsers that are readily equipped with the plugins necessary to view the PDF, so you can typically rely on that.

0

Well, I have never deal with PDF docs in PHP but you can try this link...

http://davidwalsh.name/read-pdf-doc-file-php

There you probably can find what you need with some pieces of code. Read comments bellow first (there are some links for pure PHP conversion PDF-to-TXT). Maybe this is not what you're looking for, but still take a look. I don't know is it even possible with PHP?

Wh1T3h4Ck5
  • 8,399
  • 9
  • 59
  • 79