1
votes

My PDF file cannot be opened with Adobe Reader. What's weird is that the PDF used to work in Adobe Reader just a few days ago and now it does not work, and of course I didn't modify the code otherwise it would be easy to fix.

I validated my PDF and learned it was a PDF/A-3, could be that it is not a PDF/A-1? If so why did it work for a time and suddenly stopped working?

EDIT

The problem was that somehow, some HTML code was output inside the PDF file, thus making the PDF file invalid for Adobe Reader, but not for Firefox, making all this much more confusing than it should be.

So a tip to anyway having trouble with PDF, open it with a text editor such as Notepad++ for Windows or GEdit for Linux, and compare with another PDF file which works fine. You should find the problem pretty quickly.

1
You have a PDF file that working in Acrobat reader a few days ago and now it doesn't? If the PDF file hasn't changed, then the culprit might be Acrobat. Has Adobe pushed an update in the last couple of days?Kryten
It is not the same PDF file, its a new PDF file generated from the same code. The old PDF files still works.Unusual
Is it the same data? The key here is to make sure you're comparing apples to apples: generate a new PDF from the exact same data as the old PDF. If the new PDF doesn't work and it contains the same data as the old PDF, then you can start to examine the differences between the two files. If they're not the same data, then you have no way of knowing if the problem is due to something in the file format or if FPDF generated a malformed PDF file due to something in the data.Kryten
Thats exactly what I did, it did have the same data, however it also had some HTML code, which should be there. I removed manualy the HTML code to very if it was the source of the problem (even though it is a problem, it could not be the source of my problem) and it fixed it. So I just have some echo'ed HTML somewhere when it shouldn't.Unusual
Interesting... sounds like it might be a bug in FPDF.Kryten

1 Answers

1
votes

I read a lot of questions about this and I understood that the problem is happening with:

ob_start();

Without this line, my FPDF was not working with the message explained that there was another buffer first. With this line, the PDF was readable only with Browser.

I changed this line to:

ob_clean();

and now I can open PDF with any reader.