惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
The Exploit Database - CXSecurity.com
J
Java Code Geeks
H
Help Net Security
B
Blog RSS Feed
G
Google Developers Blog
博客园 - 司徒正美
MongoDB | Blog
MongoDB | Blog
量子位
博客园 - 三生石上(FineUI控件)
The Cloudflare Blog
P
Proofpoint News Feed
小众软件
小众软件
人人都是产品经理
人人都是产品经理
云风的 BLOG
云风的 BLOG
V
V2EX
月光博客
月光博客
C
Check Point Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
A
Arctic Wolf
Help Net Security
Help Net Security
Schneier on Security
Schneier on Security
D
DataBreaches.Net
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园_首页
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
P
Palo Alto Networks Blog
T
Tenable Blog
L
LangChain Blog
Attack and Defense Labs
Attack and Defense Labs
Google DeepMind News
Google DeepMind News
N
News and Events Feed by Topic
Forbes - Security
Forbes - Security
F
Fortinet All Blogs
Recent Announcements
Recent Announcements
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
大猫的无限游戏
大猫的无限游戏
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Y
Y Combinator Blog
WordPress大学
WordPress大学
Stack Overflow Blog
Stack Overflow Blog
V
Visual Studio Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Engineering at Meta
Engineering at Meta
NISL@THU
NISL@THU
GbyAI
GbyAI
博客园 - Franky
S
Secure Thoughts
有赞技术团队
有赞技术团队
PCI Perspectives
PCI Perspectives
U
Unit 42

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
Convert Markdown to Styled PDF in n8n
Iteration La · 2026-04-30 · via DEV Community

The n8n Forum's Most Repeated Question

Search the n8n community forum for "Markdown to PDF" and you will find the same question asked repeatedly, with no satisfying answer. The replies fall into three categories.

"Use a Function node with Puppeteer." This requires a Chromium binary in your n8n environment, headless browser rendering, and a pile of JavaScript to set up page sizes, margins, and print styles. Self-hosted n8n can make this work with enough effort. n8n Cloud cannot — there is no browser binary available.

"Use the HTML-to-PDF community node." These nodes convert raw HTML, not Markdown. You need to convert Markdown to HTML first (another Function node), then style it with inline CSS (another Function node), then pass it to the PDF node. Three nodes of glue code, and the output still looks like a web page printed to PDF — no proper headers, footers, or page numbers.

"Export from Google Docs." Create a Google Doc, write content via the API, export as PDF. This technically works but is not automatable for dynamic content. The Google Docs API for formatting is verbose and fragile, and you are creating throwaway documents just to get a PDF.

None of these produce a professional document with consistent typography, a header on every page, a footer with page numbers, and controlled margins.

Markdown In, Styled PDF Out

Iteration Layer Document Generation accepts Markdown content in paragraph blocks — via the markdown field — and renders it into a fully styled PDF. You control the fonts, page size, margins, header, footer, page numbers, heading styles, link colors, and table styling through a JSON document definition.

The Markdown content goes into "type": "paragraph" blocks with a "markdown" field instead of a "text" field. The rendering engine parses the Markdown and applies your style definitions — headings get your heading font and size, links get your link color, code blocks get your code font, tables get your table styling. The output is a PDF that looks like it came from a design tool, not a browser print dialog.

One API call. Fixed credit cost per document. No browser binary, no HTML intermediate step, no throwaway Google Docs.

The Workflow: Webhook to Styled PDF

Here is what we are building in n8n: a webhook that receives Markdown content, converts it into a styled PDF with headers, footers, and page numbers, and stores the result. Three nodes. No Function nodes. No Puppeteer.

Step 1: Webhook Trigger

Open the n8n canvas and add a new node. Search for "Webhook" and add it.

In the node settings, set the HTTP Method to POST. Set Response Mode to "Last Node" so the workflow returns the generated PDF to the caller. The webhook will accept a JSON body with the Markdown content.

A typical request body:

{
  "title": "Project Status Report",
  "author": "Engineering Team",
  "markdown": "## Executive Summary\n\nThe migration to the new platform is **on track** for the Q2 deadline...\n\n## Milestones\n\n| Milestone | Status | Date |\n|-----------|--------|------|\n| Database migration | Complete | March 15 |\n| API v2 rollout | In progress | April 1 |\n| Legacy deprecation | Planned | May 15 |"
}

Enter fullscreen mode Exit fullscreen mode

The Markdown content comes from wherever your process starts — a CMS, a form submission, a GitHub webhook, a previous workflow step, or a manual API call.

Step 2: Iteration Layer (Document Generation)

Add an Iteration Layer node after the webhook trigger. In the Resource dropdown, select Document Generation. Set the Format to pdf.

In the Document JSON field, define the full document structure. Here is a concrete example that converts the incoming Markdown into a styled PDF with a header, footer, and page numbers:

{
  "metadata": {
    "title": "{{ $json.body.title }}",
    "author": "{{ $json.body.author }}"
  },
  "page": {
    "size": "A4",
    "margin": {
      "top": 80,
      "bottom": 60,
      "left": 50,
      "right": 50
    }
  },
  "styles": {
    "font": {
      "family": "Inter",
      "size": 11,
      "color": "#1a1a2e"
    },
    "headings": {
      "h1": { "size": 24, "color": "#1a1a2e", "margin_bottom": 12 },
      "h2": { "size": 18, "color": "#2d2d44", "margin_bottom": 8 },
      "h3": { "size": 14, "color": "#4a4a6a", "margin_bottom": 6 }
    },
    "links": {
      "color": "#0066cc",
      "underline": true
    },
    "code": {
      "font_family": "JetBrains Mono",
      "background_color": "#f5f5f5",
      "border_radius": 4
    }
  },
  "header": {
    "content": [
      {
        "type": "paragraph",
        "text": "{{ $json.body.title }}",
        "style": {
          "font_size": 9,
          "color": "#888888"
        }
      }
    ],
    "border_bottom": {
      "color": "#e0e0e0",
      "width": 1
    }
  },
  "footer": {
    "content": [
      {
        "type": "paragraph",
        "text": "{{ $json.body.author }} — Page {{page_number}} of {{total_pages}}",
        "style": {
          "font_size": 9,
          "color": "#888888",
          "align": "center"
        }
      }
    ],
    "border_top": {
      "color": "#e0e0e0",
      "width": 1
    }
  },
  "content": [
    {
      "type": "headline",
      "text": "{{ $json.body.title }}",
      "level": 1
    },
    {
      "type": "paragraph",
      "markdown": "{{ $json.body.markdown }}"
    }
  ]
}

Enter fullscreen mode Exit fullscreen mode

The key pieces:

  • Page setup: A4 with generous margins. The top margin is larger to accommodate the header. Adjust size to "Letter" for US standard.
  • Styles: Global font, heading hierarchy with decreasing sizes, link styling, and code block formatting. These styles apply to all Markdown content in the document.
  • Header: Appears on every page. The document title in small gray text with a subtle bottom border. The header sits inside the top margin area.
  • Footer: Appears on every page. Author name, page number, and total page count — centered with a top border. {{page_number}} and {{total_pages}} are built-in template variables that the rendering engine resolves.
  • Content: A headline block for the document title, followed by a paragraph block with "markdown" instead of "text". The Markdown field accepts the full Markdown string and renders it according to the style definitions above.

The paragraph block with the markdown field is what makes this work. All Markdown syntax — headings, bold, italic, links, tables, code blocks, lists — renders with your defined styles. No HTML intermediate. No CSS. The JSON definition controls everything.

Step 3: Google Drive / S3 / Email Node

The Iteration Layer node outputs the PDF as n8n binary data. Connect it to whatever storage or delivery node your workflow needs.

Google Drive: Add a Google Drive node, set the operation to "Upload", select the target folder, and map the binary data. The PDF lands in the shared drive.

S3: Add an AWS S3 node, set the bucket and key path, and upload the binary data. Use n8n expressions in the key to include the document title or a timestamp.

Email: Add a Send Email node, configure SMTP or OAuth, and attach the binary data. The recipient gets a styled PDF in their inbox.

Return to caller: If Response Mode on the webhook is set to "Last Node", the PDF binary streams back as the HTTP response. The calling application gets the PDF directly without any intermediate storage.

Chaining: DOCX to Branded PDF

This is where the Markdown approach becomes powerful for document conversion. Combine Iteration Layer Document to Markdown with Document Generation to convert any document format into a consistently branded PDF.

The use case: you receive DOCX files from different teams, each with their own formatting. You need them all in a consistent PDF format with your organization's branding — same fonts, same header, same footer, same page layout.

In n8n, this is two Iteration Layer nodes:

  • Node 1 (Document to Markdown): Convert the DOCX to clean Markdown. The source formatting is stripped. Headers, tables, lists, and body text come through as Markdown structure.
  • Node 2 (Document Generation): Take the Markdown output and render it into a styled PDF using your brand's document definition. Every document comes out with the same look, regardless of how the original DOCX was formatted.

The Markdown acts as a normalization layer. Whatever formatting chaos exists in the source document — Comic Sans headings, inconsistent margins, random font sizes — gets reduced to semantic structure. Your document definition then applies consistent styling on top.

Get Started

Install the Iteration Layer community node from the n8n UI — search for n8n-nodes-iterationlayer under Settings > Community Nodes. The Document Generation docs cover all styling options, content block types, header/footer configuration, and template variables. The n8n integration docs walk through every resource and parameter.

Start with a short Markdown string and a minimal document definition — just the content block with a markdown field. Verify the output renders your Markdown correctly. Then add styles, headers, footers, and page numbers incrementally. Once the template looks right, wire it to your content source. Sign up to get your API key.