Skip to main content

Generate branded PDF reports from incoming emails using Autype and OpenRouter

Workflow preview

Workflow preview
100%
Generate branded PDF reports from incoming emails using Autype and OpenRouter preview
Open on n8n.io

1. Workflow Overview

️ Important: This workflow uses the Autype community node and requires a self hosted n8n instance. Send an...

Best for

  • Document Extraction automation workflows
  • Multimodal AI automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.stickynote, n8n-nodes-base.set, n8n-nodes-base.emailreadimap, n8n-nodes-base.code, n8n-nodes-base.if, n8n-nodes-base.splitinbatches, n8n-nodes-autype.autype, n8n-nodes-base.wait

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by 8Automator.

Original n8n.io source

1.1 Workflow description

Title
Generate branded PDF reports from incoming emails using Autype and OpenRouter
Workflow name
Generate branded PDF reports from incoming emails using Autype and OpenRouter

⚠️ Important: This workflow uses the Autype community node and requires a self-hosted n8n instance.

Send an email with a document request and optional PDF attachments. The AI assistant can summarize documents, compare multiple PDFs, draft new content, or create documents from scratch with internet research — all output as professionally branded PDFs using Autype. The finished document is delivered back to the sender via email.

Who is this for?

Consultants, analysts, project managers, and teams who need on-demand document generation. Send an email and get a branded PDF back — whether it's a summary, comparison, draft, or a freshly researched document.

Concrete example: Attach 3 PDF proposals and write "Compare these proposals and recommend the best option" — each PDF is OCR'd via Autype Lens, the AI assistant produces a structured comparison with tables, and you receive a branded PDF within minutes.

This also works as an additional skill for an AI agent. Instead of an email trigger, connect the workflow to a webhook or chat trigger so an agent can call it when a user asks "create a summary of these documents."

What this workflow does

On each incoming email, the workflow:

  1. Extracts the email subject + body as the document request, and detects PDF attachments
  2. Processes each attached PDF sequentially: uploads to Autype, extracts text via Lens OCR
  3. Combines all OCR results into a single context
  4. Downloads the Autype Extended Markdown syntax reference so the AI knows the output format
  5. Passes the request text + all PDF content to an AI Document Assistant with Firecrawl and SerpAPI as research tools
  6. The assistant determines the task type (summarize, compare, draft, or create from scratch) and produces the document in Autype Extended Markdown
  7. Autype renders the markdown to a branded PDF with company styling (fonts, colors, heading styles, tables, header with logo, footer with page numbers)
  8. The PDF is delivered back to the original sender via email

Output structure

How it works

  1. New Email Received — An IMAP Email Trigger monitors your inbox for incoming document requests. The email subject and body become the request text; PDF attachments are automatically detected.
  2. Set Company Config — A Set node defines your company name, logo URL, and brand color. Edit these values once.
  3. Extract & Split PDFs — A Code node extracts the sender email, combines subject + body as request text, and detects PDF attachments. Each PDF is split into a separate item for loop processing. If no PDFs are attached, a single item with just the text is output.
  4. Has PDFs? — An IF node routes the flow: emails with PDF attachments enter the processing loop, text-only emails skip directly to the AI Assistant.
  5. Loop Over PDFs — A Split In Batches node processes each PDF sequentially (one at a time to avoid API rate limits).
  6. Upload PDF to Autype — Each PDF is uploaded to Autype via the community node (resource: file).
  7. Autype Lens OCR — An HTTP Request node triggers Autype Lens OCR on the uploaded file with outputFormat: "md". This uses Generic Auth Type → Header Auth with X-API-Key set to your Autype API key. Cost: 4 credits per page. A dedicated community node for Lens is planned.
  8. Wait for OCR → Poll OCR Status — Waits 8 seconds, then polls the job status via HTTP Request (same Header Auth credential). The loop continues to the next PDF after each OCR completes.
  9. Extract OCR Text — Extracts the markdown text from each OCR result and stores it with the original filename.
  10. Combine All OCR Results — After the loop completes, collects all OCR texts and combines them into a single context string with labeled sections per PDF.
  11. Prepare Text Only — For emails without PDFs, passes just the request text forward.
  12. Download Markdown Syntax — Fetches the Autype Extended Markdown syntax reference so the AI knows the output format.
  13. Merge Context — Combines the request text, all OCR content, and the markdown syntax reference into a single item for the AI Agent.
  14. AI Document Assistant — An n8n AI Agent (OpenRouter) with two tools:
  • Firecrawl Scrape — Scrapes specific URLs to extract page content as markdown.
  • SerpAPI — Web search for current information, statistics, and facts.
  • The assistant determines the task type (summarize, compare, draft, or create from scratch). The system prompt limits tool usage to max 5 calls and prioritizes attached PDF content.
  1. Prepare Render Payload — Cleans the AI output (strips code fences), generates a filename, and prepares branding variables.
  2. Render Branded PDF — Autype Render from Markdown generates the PDF with a full defaults JSON for company styling: Roboto font, heading colors from brand color, styled tables with colored headers, header with company logo, and footer with page numbers. See the defaults schema for all options.
  3. Send Report via Email — SMTP sends the PDF as an attachment back to the original email sender.

Setup

  1. Install the Autype community node (n8n-nodes-autype) via Settings > Community Nodes.
  2. Create an Autype API credential with your API key from app.autype.com. See API Keys in Settings.
  3. Create a Header Auth credential for the Lens OCR HTTP Request nodes:
  • Go to Credentials > New > Header Auth
  • Name: X-API-Key
  • Value: your Autype API key (same key as step 2)
  • Assign this credential to the "Autype Lens OCR" and "Poll OCR Status" nodes.
  1. Create an OpenRouter API credential (or replace the chat model with OpenAI/Anthropic).
  2. Create an IMAP credential for the email inbox to monitor.
  3. Create an SMTP credential for sending emails.
  4. Get a Firecrawl API key from firecrawl.dev and create a Firecrawl credential.
  5. Get a SerpAPI key from serpapi.com and create a SerpAPI credential.
  6. Import this workflow and assign your credentials to each node.
  7. Edit the Set Company Config node:
  • companyName — Your company name (appears in header/footer)
  • companyLogoUrl — URL to your company logo (PNG/JPEG, publicly accessible)
  • brandColor — Hex color for headings and table headers (e.g. #1a5276)
  1. Update the Send Report via Email node with your sender email address.
  2. Activate the workflow — any new email to the monitored inbox triggers document generation.

> Note: This is a community node. It is not maintained by the n8n team. You need a self-hosted n8n instance to use community nodes.

Requirements

  • Self-hosted n8n instance (community nodes are not available on n8n Cloud)
  • Autype account with API key (Lens OCR costs 4 credits/page, Render from Markdown costs 1 credit)
  • n8n-nodes-autype community node installed
  • OpenRouter API key (or OpenAI/Anthropic — configurable chat model)
  • IMAP credentials for the monitored inbox
  • SMTP credentials for sending emails
  • Firecrawl API key (free tier: 500 pages/month)
  • SerpAPI key (serpapi.com)

How to customize

  • Change AI model: Replace the OpenRouter Chat Model sub-node with OpenAI, Anthropic Claude, Google Gemini, or any LangChain-compatible chat model.
  • Add more research tools: Add additional tool nodes for specialized APIs — Google Scholar, SEC filings, PubMed, or internal knowledge bases.
  • Customize styling: Edit the defaults JSON in the Render Branded PDF node to change fonts, colors, heading styles, table designs, header/footer content, and spacing. See the defaults schema for all available options.
  • Replace email trigger: Swap the IMAP Email Trigger with a Form Trigger, Webhook, or Chat Trigger to accept input from different sources.
  • Add watermark: Insert an Autype Watermark step after rendering to stamp "DRAFT" or "CONFIDENTIAL" on every page.
  • Save to cloud storage: Add a Google Drive, S3, or SharePoint upload step after rendering (before or instead of SMTP).
  • Adjust OCR wait time: For large PDFs (10+ pages), increase the Wait node from 8 to 15-20 seconds, or add a retry loop that polls until status is COMPLETED.
  • Use Autype community node for Lens: Once the Autype community node adds Lens OCR support, replace the HTTP Request OCR/poll chain with a single Autype node.
  • Change output format: Switch from Render from Markdown to Render from JSON for a better manipulation experience

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 2 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 3 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 4 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 5 - Sticky Note4

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 6 - Set Company Config

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 7 - New Email Received

Type / Role
n8n-nodes-base.emailReadImap - emailReadImap
Config choices
Version 2

Block 8 - Extract & Split PDFs

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 9 - Has PDFs?

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 10 - Loop Over PDFs

Type / Role
n8n-nodes-base.splitInBatches - splitInBatches
Config choices
Version 3

Block 11 - Upload PDF to Autype

Type / Role
n8n-nodes-autype.autype - autype
Config choices
Version 1

Block 12 - Wait for OCR

Type / Role
n8n-nodes-base.wait - wait
Config choices
Version 1.1

Block 13 - Poll OCR Status

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 14 - Extract OCR Text

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 15 - Combine All OCR Results

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 16 - Prepare Text Only

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 17 - Download Markdown Syntax

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 18 - Merge Context

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 19 - AI Document Assistant

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 2

Block 20 - Prepare Render Payload

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 21 - Render Branded PDF

Type / Role
n8n-nodes-autype.autype - autype
Config choices
Version 1

Block 22 - Send Report via Email

Type / Role
n8n-nodes-base.emailSend - emailSend
Config choices
Version 2.1

Block 23 - /scrape in Firecrawl

Type / Role
@mendable/n8n-nodes-firecrawl.firecrawlTool - firecrawlTool
Config choices
Version 1

Block 24 - OpenRouter Chat Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenRouter - lmChatOpenRouter
Config choices
Version 1

Showing the first 24 of 26 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow Generate branded PDF reports from incoming emails using Autype and OpenRouter
Complexity advanced
Nodes 26
Categories Document Extraction, Multimodal AI
Author 8Automator
Published 19 Mar 2026

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/14184/14184.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Generate branded PDF reports from incoming emails using Autype and OpenRouter do?

️ Important: This workflow uses the Autype community node and requires a self hosted n8n instance. Send an...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Document Extraction, Multimodal AI use case.