I have a PHP app running the PDFlib program to generate PDFs. Version 6 has been running fine for a long time. We are about to change servers and decided to upgrade to the latest version of all of the software.
Well, the parts of the program that use PDFlib to create PDFs now makes PDFs that Acrobat thinks are "Corrupt and can not be repaired." Strangely, Firefox opens the file using the Adobe plugin just fine. So does the generic Ubuntu PDF viewer. But when I download the PDF and try to open it in Acrobat Reader or the full blown Acrobat it says that the file is corrupt and cannot be repaired.
Has anyone seen this before, or do you know where I should start looking? The fact that Firefox and Ubuntu can read it tells me that it can't be THAT corrupt. In fact it looks perfectly fine to those readers with all of the graphics and different colored text and fonts and everything. It has to be something stupid.
EDIT:
Ok, I stripped down the PHP file generating the bad PDF to nothing but "Begin Document", "Begin Page", "End Page", "End Document" and got no errors. Then I added in one of the background image loads and found the first problem.
$bgImageUrl = $_SERVER['DOCUMENT_ROOT'] ."path/to/fadedBG2.png";
$bgImageData = file_get_contents($bgImageUrl);
$p->create_pvf("/pvf/bgImageData", $bgImageData, "");
$bgImage = $p->load_image("auto", "/pvf/bgImageData" , "");
That last line is causing corruption in the file. I pretty much copied this code directly from the pdfLib web site so I'm not sure what's going on here.