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 the starter workflow

  1. Import the SheetsToLabels n8n workflow JSON.
  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. Replace custom-REPLACE_ME and the sample variables in Prepare request.
  6. Run the workflow. The Generate PDF node should expose 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.

Connect a real trigger

Replace the Manual Trigger and sample Code node with Google Sheets, Airtable, Webhook, Postgres, Shopify, or another source. Keep the HTTP node 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.