Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Reading PDF Files with PHP
December 20, 2004, 11:47 pm
rate this thread
should have know that since I've found most of the other PHP/PDF
information contained in this group.
Here's my issue...I will from time to time receive 4 - 5 PDF files into
a directory; I want to be able to schedule a task which will pick up
these 4 - 5 PDFs, read through them and then generate 1 pdf. Creating
PDFs in PHP is obviously fairly easy, however I haven't found anything
yet that will actually read the PDFs so that I can then place that
content into this new single file. Can this be done with PHP. Any
suggestions/help would be greatly appreciated.
Thank you in advance.
Re: Reading PDF Files with PHP
Reading from PDF files is almost impossible. You can extract bits and piece
from one and make small changes here and there. There's no way for a
computer to read the document in its entirety because the logical structure
of the text isn't there. What a PDF file contains is essentially
instructions to the printer--that is, the visual representation of the
document. A paragraph in a PDF, for instance, is just a series of moveTo(72,
72), printLine(text), moveto(72, 144), printLine(text) commands. To get back
the original paragraph of text you would need OCR-like artificial
What IS possible is stitching a number of PDF files into one. It would just
be a matter of reading in the PDF objects (without actually decoding the
content sterams), writing them to a new file, then update appropriate
reference tables. If you have the inclination, go the Adobe's web site and
download the reference manual.