Hi,
I'm wondering if anyone has come across this
problem. I use PDFlib-4.0.1 with PHP-4.0.6
on Linux to create piecharts, barcharts,
trend charts, etc. I can open these PDFs just
fine from the command line using xpdf,
acroread, gs, gimp, etc. I can convert the
PDFs to Postscript just fine with pdftops,
again, when executed from the command line.
However, if I try to use exec() or system()
from within a PHP script to do these exact
same things, I get the error message:
Error (0): PDF file is damaged - attempting to reconstruct xref table...
Error: Couldn't find trailer dictionary
Error: Couldn't read xref table
I used a number of different techniques
(including file(<pdf filename>) and
readfile(<pdf filename>)) to try to figure
out what is going on. It appears that any
attempt to access the file from within a
PHP script in this fashion causes the file
to be truncated before the xref table is
reached, hence the error. The xref table is
fine in the original file. I don't see any
reason for this to be happening, though. Is
it possible that the makers of PDF lib have
done something to the file to keep a user
from performing such operations from within
a PHP script?
Any help anyone can provide would be MUCH
appreciated. Thanks.
Michael Mann