Library / Documents, PDF & OCR
Documents, PDF & OCR
Convert Markdown into a branded PDF with table of contents using PDFMint
Receives Markdown, title and author by POST and returns a branded PDF with an optional table of contents and watermark via PDFMint. Runs on each request.
What it does
## Convert Markdown into a branded PDF with a table of contents Who it is for Anyone holding Markdown — an AI agent's answer, release notes, a knowledge-base page, a report written in an editor — who needs a finished, branded PDF back in the same request. No headless browser to run, no template editor to log into. How it works 1. Receive the Markdown document takes a POST with markdown, title and an optional author. 2. Set your document branding is the one node you edit: brand name, accent colour, page format, whether a table of contents is added, and an optional watermark such as DRAFT. 3. Check the request is usable turns an empty payload into a readable 422 before anything is rendered. 4. Check remaining quota asks PDFMint how many credits are left. The usage operation costs nothing. 5. Build the cover, contents and body does all the work in one place: it numbers every ## and ### heading, builds a contents list from exactly those numbers so the two cannot drift apart, skips headings inside fenced code blocks, counts the words, estimates the reading time, and assembles a cover block. It also derives the running header and the CSS from your accent colour. 6. Render the Markdown as PDF sends the assembled Markdown to PDFMint with your header, page numbers and styling. 7. Did the render succeed? decides which answer the caller gets, because the render node is set to continue on failure. 8. Return the PDF answers the POST with the file itself; Return the error as JSON answers with a status and a reason, so a caller never hangs. How to set it up - Install the verified community node n8n-nodes-pdfmint. It is available on n8n Cloud and self-hosted n8n; Cloud owners and admins can add it from More from the community in the nodes panel. - Create a PDFMint credential with your API key. - Open Set your document branding and put your own brand name, accent colour and page format in it. Nothing else needs editing. How to customise it - Swap Return the PDF for Gmail, Google Drive or S3 if you would rather deliver the file than answer with it. - Set draftWatermark to DRAFT while a document is unfinished; leave it empty for the final version. - Replace the webhook with a Schedule Trigger to turn a nightly report into a PDF. *Disclosure: I build PDFMint, and I wrote this template.*
The steps
- Receive the Markdown document
- Set your document branding
- Check the request is usable
- Check remaining quota
- Is there quota left?
- Build the cover, contents and body
- Render the Markdown as PDF
- Did the render succeed?
- Return the PDF
- Explain what went wrong
- Return the error as JSON
Similar automations
Files & Cloud StorageSend weekly sales PDF reports from Google Sheets to Slack with Claude and MintPDF14 stepsChatbots & Messaging BotsBranded n8n Chatbot Powered by a Langflow Flow3 stepsDocuments, PDF & OCRSplit PDFs by Table of Contents with Gemini26 stepsDocuments, PDF & OCRConvert Bank Statement PDFs to Markdown with Gemini Vision12 steps