How to use PDF to JSON
- Drop a PDF onto the box or press Choose a file.
- In Pages, leave
allor type pages such as1or2-4. - Keep Include position and font size ticked for coordinates, or untick it for text only.
- Press Convert to JSON, then copy the result or download it as a
.jsonfile named after your PDF.
What it does and when to use it
JSON is the easiest format to feed into a script, a spreadsheet import, a database or a no-code automation. This tool is meant for people who want to process PDF text with their own rules: pulling the invoice number that always sits at the top right, finding the total on the last line of a receipt, checking that every page of a report has a footer, or detecting headings by font size. The coordinates let you filter by region, for example “lines with y under 100 on page 1”.
For reading or copying text, the PDF text extractor is simpler. For a document with headings and lists, PDF to Markdown keeps the structure in a human-friendly way.
How it works
pdf.js (pdfjs-dist) reads each chosen page’s text layer in your browser. Every piece of text comes with a transform that gives its position and size. The tool converts those to page coordinates with the origin at the top left, groups pieces into lines, sorts lines from top to bottom, and rounds the numbers to one decimal place. The output has this shape:
| Key | Meaning |
|---|---|
page |
Page number |
width, height |
Page size in points (A4 is 595.28 × 841.89) |
lines[].text |
The line’s text |
lines[].x, y |
Left edge and baseline, from the top-left corner |
lines[].width |
Horizontal extent of the line |
lines[].fontSize |
Largest font size on the line, in points |
lines[].bold |
Whether every piece on the line uses a bold font (from the font’s real name or bold flag) |
Nothing is uploaded. If the PDF uses standard fonts or character maps it does not contain, pdf.js may download that data from cdn.jsdelivr.net.
Worked examples
Page 1 of an invoice, with coordinates. The output begins:
{
"pages": [
{
"page": 1,
"width": 595.28,
"height": 841.89,
"lines": [
{ "text": "Invoice 2041", "x": 72, "y": 61.9, "width": 119, "fontSize": 20, "bold": true },
{ "text": "Billing summary", "x": 72, "y": 97.9, "width": 108.9, "fontSize": 14, "bold": true },
The real output puts each key on its own line. The title and the section heading are set in Helvetica Bold, so bold is true for both, even though pdf.js lists the font under a coded name.
Text only. With the option unticked, each line is just { "text": "Invoice 2041" }, which is handy when you only need reading order.
Limits and tips
- Scanned PDFs have no text layer; run OCR PDF first.
- Rotated text, text along a curve and text inside images are not handled specially.
- Large documents give large JSON files; convert a page range when you only need part of it.
Frequently asked questions
Which way do the coordinates run?
How is bold detected?
What is a line here?
Can I get each word or character with its own position?
How do we know nothing is uploaded? Test it yourself on the privacy proof page.