1

I'm looking for a tool that I can use to identify and diagnose errors in a PDF.

I'm generating PDFs (like this for example) using LaTeX, and suddenly code that has worked for years is generating PDFs that either fail to display or crash normal PDF readers (even PDF Expert).

1

I am not aware of any general tools that can identify all issues in a PDF and provide a report. This is mainly because there are so many parts to a PDF. Ignoring all the metadata (tagged content, outline, annotations, document info), you are still left with Fonts (which PDF supports a variety of formats), Images (again many formats supported), and other resources.

In the end the only way to detect an error, is to exercise the PDF, usually by rendering it, as that uses the most parts of a PDF, but even then, not every part of PDF is needed/read to render. You would still want to trigger text extraction for example.

The closest thing to a tool that identifies errors in a PDF is usually a PDF to PDF/A converter, but even then, they would not normally evaluate fonts and images, just the actual PDF parts, and you would get a lot of false positives, since PDF/A can be much stricter than a normal PDF, and errors are no indication that rendering would be an issue.

You are much better off fixing the root of the issue, rather than trying to automate post-process fixing.

The issue I see with the PDF you posted, is that in the Page resources dictionary. Instead of simply omitting unused resources, like ColorSpace and ExtGState, these are instead pointing to Free (undefined objects).

You can check this using a PDF inspector such as COSEdit. You can see under trailer/Root/Pages/Kids/0/Resources that there are bad object references.

Again, reviewing the creation process is really the best step.

  • The creation process is unfortunately sprawling and hacked together. Is there a likely LaTeX culprit that could be generating those bad object references — e.g., a specific command that might be involved — that would help guide my search for a cause in the code? – orome Oct 18 '17 at 21:47
  • There is a whole StackExchange regarding LaTex. I would post the PDF there, mention the free objects referenced in the resources dictionary for the pages, and see if anyone there has an idea. tex.stackexchange.com – Ryan Oct 19 '17 at 17:29
  • Will do. Meanwhile I'd be grateful if you can confirm that the same or similar bad reference error is not present in this file. That would greatly help narrow the scope of the search (and question). – orome Oct 19 '17 at 17:40
  • Follow up. – orome Oct 21 '17 at 16:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.