DEV Community

Custodia-Admin
Custodia-Admin

Posted on • Originally published at pagebolt.dev

How to Take Screenshots and Generate PDFs in n8n Workflows Using PageBolt API

How to Take Screenshots and Generate PDFs in n8n Workflows Using PageBolt API

You're building automation workflows in n8n. Your workflow monitors competitor prices, tracks design changes, generates reports, or creates audit trails. You need screenshots or PDFs — but running Puppeteer in an n8n execution breaks your workflow (300MB+ memory, 5–10 second startup per execution).

PageBolt's REST API solves this. One HTTP Request node. One API key. Screenshots and PDFs on demand, inside your workflow.

Setup: Get Your API Key

  1. Go to pagebolt.dev/pricing
  2. Sign up (free tier: 100 requests/month, no card)
  3. Copy your API key from the dashboard
  4. In n8n, create a new Credential of type "Header Auth"
    • Name: PageBolt API
    • Header: Authorization
    • Value: Bearer YOUR_API_KEY

Done. Your n8n instance can now call PageBolt.

Node 1: HTTP Request — Take a Screenshot

Add an HTTP Request node to your workflow:

Configuration:

  • Method: POST
  • URL: https://api.pagebolt.dev/v1/screenshot
  • Authentication: Select "PageBolt API" (your credential from above)
  • Send Body: Raw
  • Body:
{
  "url": "{{ $json.targetUrl }}",
  "options": {
    "format": "png",
    "width": 1280,
    "height": 720,
    "full_page": false
  }
}
Enter fullscreen mode Exit fullscreen mode

Input (from previous node):

{
  "targetUrl": "https://example.com"
}
Enter fullscreen mode Exit fullscreen mode

Output:

{
  "url": "https://example.com",
  "format": "png",
  "width": 1280,
  "height": 720,
  "image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...",
  "screenshot_time_ms": 847
}
Enter fullscreen mode Exit fullscreen mode

The image field is base64-encoded PNG. Save it to a file or send to storage:

{
  "filename": "screenshot-{{ $json.url.replace(/[^a-z0-9]/gi, '-').toLowerCase() }}.png",
  "data": "{{ $json.image }}"
}
Enter fullscreen mode Exit fullscreen mode

Node 2: HTTP Request — Generate a PDF

Add another HTTP Request node for PDFs:

Configuration:

  • Method: POST
  • URL: https://api.pagebolt.dev/v1/pdf
  • Authentication: "PageBolt API"
  • Body:
{
  "url": "{{ $json.targetUrl }}",
  "options": {
    "format": "A4",
    "margin": "1cm",
    "print_background": true
  }
}
Enter fullscreen mode Exit fullscreen mode

Output:

{
  "url": "https://example.com",
  "format": "A4",
  "pdf": "data:application/pdf;base64,JVBERi0xLjQKJeLj...",
  "pdf_size_bytes": 142356,
  "generation_time_ms": 2104
}
Enter fullscreen mode Exit fullscreen mode

Same pattern — pdf field is base64-encoded.

Real Workflow Example: Daily Competitor Screenshot Report

Monitor 10 competitor sites daily. Take screenshots. Generate a PDF report.

Workflow:

  1. Trigger: Cron (every day at 9 AM)
  2. Loop: Iterate over competitor URLs
  3. Screenshot Node: Call PageBolt /screenshot for each URL
  4. Collect: Gather all screenshots
  5. PDF Report Node: Generate single PDF with all screenshots embedded
  6. Send Email: Email PDF to team

Nodes:

Cron Trigger
  ↓
Set URLs (competitor list)
  ↓
For Each URL
  ├→ HTTP Request: Screenshot
  ├→ Save to Object Storage (AWS S3, etc.)
  └→ Collect metadata
  ↓
Merge all data
  ↓
HTTP Request: Generate PDF with embedded images
  ↓
Send Email (Gmail node) with PDF attachment
  ↓
Log completion
Enter fullscreen mode Exit fullscreen mode

Key Options

Screenshot Options

  • format: png, jpeg, webp
  • width/height: Viewport size (e.g., 1280x720, 1920x1080)
  • full_page: true to capture entire scrollable page
  • wait_for_selector: Wait for specific element before capturing
  • block_ads: true to remove ads
  • block_banners: true to hide cookie banners

PDF Options

  • format: A4, Letter, Legal, A3, A5
  • margin: CSS value like "1cm" or "0.5in"
  • landscape: true for landscape orientation
  • print_background: true to include CSS backgrounds

Error Handling

Add a Try/Catch block around your HTTP nodes:

HTTP Request: Screenshot
  ├→ (if success) Continue to next step
  └→ (if error) Catch node
       ├→ Log error: "Screenshot failed: {{ $json.message }}"
       └→ Send notification
Enter fullscreen mode Exit fullscreen mode

n8n's error handling ensures failed API calls don't break your workflow.

Pricing & Limits

  • Free tier: 100 requests/month
  • Starter: $29/month → 10,000/month
  • Scale: $99/month → 100,000/month

At 10 competitors × daily screenshot = 300/month, you're well within free tier.

Next Steps

  1. Create the PageBolt API credential in n8n
  2. Add HTTP Request node to a test workflow
  3. Test with a single URL
  4. Build your multi-step workflow
  5. Deploy and automate

No Puppeteer management. No memory leaks. No on-call incidents. Just REST.

Try it free: 100 requests/month, no credit card.


Learn more: pagebolt.dev/docs — full API reference for all options.

Top comments (0)