Scheduled report as a PDF, sent by email (n8n)

An n8n workflow that fetches data on a schedule, builds a color-coded HTML report, renders it to PDF and emails it every morning.

Last updated

Operations render_html_to_pdf (POST /v1/render)
Platforms n8n
Nodes Schedule Trigger, HTTP Request, Code, pdfrender, Gmail

Every morning at 7:00 this workflow fetches records from an API, builds one HTML report and emails it as a PDF. The sample tracks expiry dates, such as vehicle insurance, inspections and permits. It groups them by urgency: expired in red, due within 7 days in orange, due within 30 days in yellow.

The same chain serves a weekly status digest or a monthly client report. Change the schedule, the data source and the HTML. The report is A4 landscape, with the date in the page header and page numbers in the footer.

The steps

  1. Every day at 7:00 (Schedule Trigger). Runs in the workflow's time zone.
  2. Fetch records (HTTP Request). Reads a JSON array of records with name, type and an ISO date expires.
  3. Build report HTML (Code). Runs once for all records, keeps those expired or due within 30 days, sorts them by date and color-codes them.
  4. Render PDF (pdfrender, Render HTML to PDF). Sends the HTML to POST https://api.pdfrender.dev/v1/render and puts the PDF in the binary field data.
  5. Email the PDF (Gmail). Attaches data and sends it to your team.

Fetch records carries pinned sample records, so Execute workflow runs the whole chain before you point it at your API. Headers and footers use CSS @page rules (page headers and footers).

Get the workflow

Download workflow.json and its setup notes from GitHub, then use Import from File in n8n. On self-hosted n8n, install the community node @pdfrender-dev/n8n-nodes-pdfrender under Settings > Community Nodes first.

Get your API key

Get your API key and add it to n8n as a pdfrender API credential. Each render costs 1 credit, whatever its page count, and a failed render costs nothing.

FAQ

Can it send a weekly or monthly client report instead?
Yes. Set the Schedule Trigger's interval to weeks or months and point the fetch step at the client's data. Then change the HTML in the Code node. Any n8n node that outputs items can replace the HTTP Request step, for example a database query or Google Sheets.
What if nothing is due?
The report still goes out and says that nothing expires in the next 30 days. To skip the email on such days, add an If node after the Code node that checks count.