Home / Use cases / Extract the Text of a PDF Form Page by Page as JSON

Updated

Extract the Text of a PDF Form Page by Page as JSON

To extract fields from forms, invoices or reports with code or an LLM, you need each page's text separately (so you know where a value is), plus tables as rows.

Try it now on Apify Document to Markdown & JSON (PDF, DOCX, PPTX, HTML, OCR) · $0.004 per one document converted, first 50 pages included · failed items are free

How to do it, step by step

  1. Send the PDF URL with Include pages on.
  2. Each page comes back with its markdown and tables (header + rows as JSON).
  3. Give one page at a time to your extractor or LLM prompt: fewer tokens, fewer mistakes.
  4. Keep the page number with each extracted value for review.

The exact input used for the example below:

{
  "urls": [
    "https://www.irs.gov/pub/irs-pdf/fw9.pdf"
  ],
  "includePages": true
}

Real result

Run ztCUJYtKax0hI4w7C on 2026-12-05: status SUCCEEDED, 1 item(s), 5.4 s of run time. Output shortened for reading (long text cut with “…”).

“Form W-9 (Rev. March 2024)”: 6 pages, 6,311 words, one pages entry per page.

[
  {
    "url": "https://www.irs.gov/pub/irs-pdf/fw9.pdf",
    "title": "Form W-9 (Rev. March 2024)",
    "pageCount": 6,
    "wordCount": 6311,
    "pages": [
      {
        "page": 1,
        "markdown": "# W-9\n\n# Request for Taxpayer\n\nForm Give form to the\n\n## (Rev. March 2024) Identification Number and Certification requester. Do not\n\nDepartment of the Treasury send to the IRS.\nGo to www.irs.gov/FormW9 for instructions and the latest information.\nInternal Revenue Service\nBefore you begin. For guidance related to the purpose of Form W-9, see Purpos…",
        "tables": [],
        "ocr": null
      },
      "… 5 more"
    ]
  }
]

Try it now with your own input

FAQ

Does it read filled-in form values?

It reads the text drawn on the page. Values typed into interactive form fields may not be part of the page text; check a filled sample first.

Scanned forms?

Yes, with OCR; check the per-page confidence before trusting numbers.

Is my document stored?

Files are processed in the run and the result stays in your own Apify storage.

Related