Automate robust PDF segmentation using Chunkr.ai and Google Gemini within this powerful n8n workflow. Generate structured JSON, HTML, and Markdown outputs, ideal for RAG and knowledge base pipelines. Download this n8n templates solution today.
Download this n8n workflow template and start using it instantly.
Processing highly unstructured PDF documents is challenging, especially when attempting to accurately map content to its hierarchical structure (like sections and subsections). This sophisticated n8n workflow solves this by combining the powerful document parsing capabilities of Chunkr.ai with the advanced reasoning of the Google Gemini AI model. The result is a precise 'Golden Table of Contents' which is then used by a custom n8n node (Code) to slice the document's content into clean, contextually accurate segments. This robust n8n workflow provides outputs ready for downstream use, such as embedding into vector databases or publishing as structured HTML/Markdown, making it one of the most useful n8n templates for document automation.
This comprehensive n8n workflow starts with a dual-path n8n trigger system. Users can either manually execute the workflow (using the manual n8n trigger to download a sample file) or trigger it via an external source using the 'When Executed by Another Workflow' n8n trigger with a PDF URL input.
To use this powerful n8n workflow, follow these steps:
CHUNKRAPI_KEY> in the Authorization header parameter with your actual key. ManualTrigger / ExecuteWorkflowTrigger (n8n trigger): Defines the entry point for the n8n workflow, supporting both manual testing and API-driven execution.
Convert the PDF to base64 (n8n node): Essential step for communicating binary file content to external APIs like Chunkr.ai via JSON payloads.
HTTP Request (POST Chunkr Task / GET Chunkr Task): Handles communication with the Chunkr.ai API. This n8n node initiates the parsing task and subsequently polls for the completion status.
Wait (n8n node): Introduces a necessary delay (10 seconds) before polling the Chunkr service, preventing immediate failure due to processing time.
Code (Take beginning of Document / Extract Sections headers): Custom JavaScript logic within this versatile n8n node prepares and structures the input data for the LLM agent, including text extraction and listing fallback headers.
AI Agent (Table of Content Agent): This specialized n8n node utilizes the connected Gemini LLM for complex reasoning, converting raw document cues into a strict, nested JSON structure (the desired Table of Contents).
Code (Return each section individually / Return the whole document): Contains the core segmentation logic. This robust Code n8n node performs two-pass mapping to anchor the AI-generated headings to the correct segments in the Chunkr output, extracting full section content (text, HTML, Markdown) based on these boundaries. This is the heart of this particular n8n workflow.
Code / HTML / Move Binary Data (n8n node set): Final n8n nodes used to compile the segmented document content back into a complete, downloadable HTML file.
Use this powerful n8n workflow to automate security reconnaissance. It leverages Google Dorks, scrapes sensitive links via AI Scraper (Parsera), and sends automated reports using an n8n Gmail node.

Use this robust n8n workflow to authenticate with Google Service Accounts and securely call private Cloud Run endpoints. Features JWT signing and Bearer token exchange.

Automate secure calls to Google Cloud Run services within your n8n workflow. This template uses service account tokens for authentication and manages complex iteration logic.

Automate sophisticated RFM (Recency, Frequency, Monetary) analysis for your WooCommerce customers using this advanced n8n workflow. Segment users (Champions, At Risk) for targeted marketing campaigns with this ready-to-use n8n template.

Automate Forex Factory economic calendar imports into Google Calendar using this n8n workflow. Filter for high and medium impact events and perform automatic cleanup.


Automation Expert with a focus on structured data extraction from messy inputs.







































