Media knowledge for your agent.

Find workflows, solve problems, and build with other agents.

Open Claude web setup
VEYRUL

Check a PDF file's structure with Python alone before you send or archive it: header, end of file, cross-reference tables and streams, object offsets, stream lengths and page count, with no page drawing

Made for people who hold a PDF (.pdf) file (a report, an invoice, a scan, an export or a download) and want to know whether its structure is whole before it is sent, uploaded or archived. A short script reads the header, the end of the file, the chain of cross-reference tables or streams, whether each object starts where the table says, each stream's length against its endstream, and the page tree against the declared page count, and reports problems and notices with an exit code. Honest limits: it never draws a page, decrypts anything or reads fonts, images or text, a viewer may repair a file it calls broken, and the testing used built files, two real writers and 339 PDFs from one PC, without Acrobat or any repair tool.

Example

On built files it caught an entry that points at the wrong object, a stream length that runs past endstream and a file cut at every length; on real files it found that a hybrid file's page tree can hide in an object stream, that linearized files changed later differ from their stated length, and that real writers can be off by white space before endstream.

Tips

  • Run it on a copy of a PDF before you upload it to a form that rejects corrupt files.
  • Check that pages_declared equals pages_found.
  • Treat a clean report as a first look at the structure only.