Generate PDFs with n8n

Import an n8n workflow that generates a PDF file from a SheetsToLabels template

n8n can keep the successful API response as binary data and pass it to Google Drive, S3, email, a filesystem node, or PrintNode. Self-hosting n8n controls the automation environment, but template variables are still deliberately sent to the SheetsToLabels cloud API for rendering.

Import a starter workflow

  1. Import one of the workflow JSON files:
  2. Create an HTTP Header Auth credential.
  3. Set the credential name to Authorization and its value to Bearer sk-your-api-key.
  4. Select that credential in Generate PDF.
  5. Edit placeholders only in Set config (templateId, layout, sample variables, and any Sheet/Drive IDs).
  6. Run the workflow. Generate PDF exposes the PDF under the binary property data.

The workflow exports no credentials. A credential must be selected after every import into a new n8n instance. Configurable values live in the Set config node so you do not hardcode secrets in the HTTP node.

Connect a real trigger

Replace the Manual Trigger with Google Sheets, Airtable, Webhook, Postgres, Shopify, or another source. Keep Generate PDF and map the source into:

{
  "templateId": "custom-1234567890",
  "layout": { "type": "single" },
  "records": [
    {
      "variables": {
        "name": "Alex Morgan",
        "code": "ag193",
        "qrUrl": "https://example.com/ag193"
      }
    }
  ]
}

Create idempotencyKey from a stable source identifier and version. For a webhook, use the event ID. For a database row, use its primary key and updated timestamp. The HTTP node already sends X-Integration-Source: n8n; change it to airtable, shopify, or another source when attribution to the originating system is more useful.

Store or send the file

Connect the binary property data to a file-aware node:

  • Google Drive: Upload a file.
  • S3: Upload an object.
  • Email: attach binary property data.
  • Read/Write Files from Disk: self-hosted n8n only.
  • PrintNode: convert the binary PDF to base64 and create a print job.

Do not turn the PDF bytes into JSON text. On non-2xx responses, configure an error branch that reads the problem JSON and stores code, detail, and requestId.

Start an API trial after the imported workflow is configured.