Skip to content

What a PDF holds besides its pages

JSON is the format programs read most easily. A PDF holds a good deal a program might want: who made it and when, how big each page is, where its bookmarks go, what was typed into its form, where its links point, and the words on every page. This export writes all of that into one file, so a script or a spreadsheet can use it without parsing a PDF.

Updated

Which tool you need

  • Collecting the answers from filled-in PDF forms

    PDF to JSON. Every field is listed with its name, type, page and value, ready for a script to read.

  • Checking what a PDF says about itself before you send it

    PDF to JSON shows the properties and the raw XMP metadata. To change or remove them, use Remove PDF Metadata.

    Remove PDF Metadata

  • The text, formatted for reading

    PDF to Markdown keeps headings and lists; PDF to Text writes plain text.

    PDF to Markdown

  • A list of every link in a document

    PDF to JSON lists each page's links with where they point: another page of the same PDF, or a web address.

What the file looks like

One object with the file's name and size, the document's version, page count and properties, then lists: bookmarks, form fields and pages. Each page has its number, label, size in points, rotation, its links and comments with their positions, and its text if you chose to include it.

Positions are in PDF points from the bottom-left corner of the page, the unit every PDF uses: 72 points to the inch.

What a script can rely on

The file opens with a format field, pdfcheetah.pdf-to-json/1, whose number goes up whenever a key changes meaning or is removed. A script can check it before reading anything else and stop rather than misread a newer shape.

Every list in the export has a ceiling, so an unusually large or deliberately hostile PDF cannot produce an endless file. When a ceiling was reached, the top-level truncated field is true; the XMP packet has its own xmpTruncated field for the same reason.

What it tells you before you share a PDF

The document section answers questions most viewers never show: whether the file is tagged for screen readers, which language it declares, whether it carries JavaScript, and whether it is linearized for fast viewing on the web. The properties include any custom entries a program added beyond the usual title, author and dates.

Each comment keeps its author's name and its text, and each form field says whether it is read-only. Bookmarks keep their nesting, and each names the page it opens or the address it points to, where it has one.

What to know before you start

  • Pictures, drawings, fonts and attached files are not exported.
  • Tables come out as text, not rows and columns.
  • A scanned page has no text to read.
  • A password-protected PDF has to go through Unlock PDF before it can be exported.

Read next