See llms.txt for all machine-readable content.

Back to Templates

Prepare PDFs for RAG with pdfRest OCR and Markdown chunks

Quick overview

Prepare PDFs for RAG with a low-code workflow that extracts Markdown, applies OCR when needed, and creates page-referenced text chunks. Resume processing from checkpoints, review flagged pages, and download the results before indexing in your chosen system.

How it works

  1. Receives a PDF (and optional prior checkpoint.json), OCR strategy, and optional page exclusions through an n8n form.
  2. Validates file size/type, exclusion input, and (if provided) verifies the checkpoint matches the same PDF and extraction settings.
  3. Uses pdfRest PDF Info to read the PDF page count and confirm the document is not password-protected.
  4. Selects up to a configured batch of unprocessed pages (reusing READY pages from the checkpoint and skipping excluded pages) and processes them one page at a time.
  5. Reads each page as Markdown and checks for sparse or damaged text. Auto mode applies OCR when needed; Force mode applies OCR to every selected page before extracting Markdown.
  6. Builds a review package with page-referenced source.md, chunks.json (only READY pages, chunked within each page), manifest.json, and an updated checkpoint.json, then compresses everything into a ZIP for download.
  7. Stops with an error after delivering the ZIP if any page failed processing, or returns a status like READY/NEEDS_REVIEW/PARTIAL to guide the next resume run.

Setup

  1. Install the @pdfrest/n8n-nodes-pdfrest community node package, or update your existing installation to the latest available version.
  2. Create a pdfRest API credential using your pdfRest Pro API key, then select it on all five pdfRest nodes. Ensure the API base URL matches the environment associated with your key.
  3. Review and adjust the processing limits and chunk settings (pages per run, max PDF size/pages, OCR languages, chunk size/overlap) in the workflow’s settings code.
  4. Start by submitting a small test PDF via the form, then download and inspect the ZIP outputs (README.txt, source.md, chunks.json, manifest.json, checkpoint.json) before running on real documents.
  5. To continue processing a large PDF across multiple runs, resubmit the exact same PDF along with the previously generated checkpoint.json and keep the same OCR strategy and extraction settings.

Requirements

  • A pdfRest Pro account and API key with OCR and Markdown access and unredacted output.
  • The @pdfrest/n8n-nodes-pdfrest community node package installed in n8n.
  • PDF file and page limits are configurable in the Settings node. PDFs requiring an opening password must be unlocked before upload; this template does not include a decryption step.
  • For self-hosted n8n, access to the built-in crypto module in Code nodes.

Customization

  • Adjust pages per batch, file-size limits, and text thresholds in the Settings node.
  • Choose OCR languages and Auto or Force OCR.
  • Adjust chunk size and overlap while retaining original page references.
  • Connect reviewed READY output to your preferred indexing workflow.
  • Configure a separate error workflow for production failure notifications.

Additional info

READY means automated text checks passed; it does not guarantee complete or accurate extraction. Review text before indexing. Blank or sparse pages remain flagged unless explicitly excluded with a reason. This template prepares downloadable files only; no vector database, embedding service, or indexing credentials are required. Checkpoints are saved in completed ZIP packages, not continuously during processing.