Skip to main content

PDF to JSON

Extract the text of each page, the metadata, the page sizes and the bookmarks of a PDF into one JSON file.

About This Tool

PDF to JSON reads a PDF and writes what it finds into a JSON file: the text of each page, the document's metadata (title, author, dates and the like), the size and rotation of each page, and its bookmarks with the page each one opens.

The text of a page is given a line at a time in the order it is read, with a tab between the parts of a line that stand well apart, such as the cells of a table. A page set in columns is read one column after the other, and Arabic is given in reading order whichever way the file holds it. Fonts, positions, images, form fields and comments are not included. A scanned page has no text until it has been through OCR: its text is empty, and the page tells you which pages those are.

All extraction happens in your browser; the PDF is not uploaded.

How to Use

  1. Upload Your PDF

    Drag and drop your PDF file or click to select.

  2. Select Data to Extract

    Once the file is added, tick what you want under "Extraction Options": "Include Text", "Include Metadata", "Include Page Sizes" and "Include Bookmarks". "Indent the File" lays the file out so that it is easier to read. To limit the pages, type them in "Page Range", for example 1-3, 5, 7; a range that matches no page of the file is refused.

  3. Extract and Download

    Click "Extract to JSON". The first 5,000 characters appear under "JSON Preview"; click "Download" to save the whole file. Change an option and extract again whenever you like.

Use Cases

Data Extraction

Get the text of every page, line by line, ready to search or to feed to a script.

Document Analysis

Read the page count, page sizes, metadata and bookmarks of a PDF from a script.

Integration

Import PDF content into applications via JSON.

Frequently Asked Questions

What data is extracted?

The file name; the number of pages and the PDF version; the metadata fields title, author, subject, keywords, creator, producer and the two dates, written as ISO 8601; the bookmarks, each with its title and the page or web address it opens; and for each page its number, width and height in points, rotation and text. Fonts, text positions, images and form fields are not extracted.

Is the JSON format documented?

There is no separate documentation, but the layout is short and always the same: "filename", "info" (with "pageCount" and "pdfVersion"), "metadata", "outline" (a list in which each entry has "title", then "page" or "url", and "items" for the bookmarks under it) and "pages", a list in which each entry has "pageNumber", "width", "height", "rotation" and "text". A part you untick is left out, and a page that could not be read has "error" in place of "text".

Can I extract from scanned PDFs?

A scanned page holds a picture and no text, so its "text" is empty, and after the extraction the page names the pages like that. Run OCR PDF on the file first, then extract from the searchable PDF it gives you.