Skip to main content
Generate PDFs with pdfn and send them as email attachments using Resend. Works with invoices, receipts, order confirmations, and reports.

Setup

Install Resend alongside your existing pdfn setup:
Add your Resend API key:
.env.local

API route

Generate a PDF and send it as an attachment:
app/api/send-invoice/route.tsx
The example uses two React components:
  • Invoice — pdfn template for the PDF attachment
  • InvoiceEmail — email template for the email body
You can also use html or text instead of react for the email body if you don’t need a React component.

Multiple attachments

Generate and attach multiple PDFs:
Resend has a 40MB limit per email. For large PDFs, send download links instead.

Next steps

Generate & Render

Client setup, generate() and render() parameters

Components

Document, Page, and layout components