Stop generating PDFs manually. Webhooks let you trigger PDF creation automatically — when a form is submitted, a page is updated, or a schedule fires. Connect Pretty PDF to your existing tools and workflows.
Replace manual scripts and polling with a push-based architecture that generates PDFs the moment something happens.
Instead of polling an endpoint or running scripts on a timer, webhooks push events to your handler the instant something happens. A form is submitted, a CMS page is published, a deployment finishes — the source system sends an HTTP POST to your webhook URL with the event details.
Pair this with the Pretty PDF API: the incoming webhook triggers your handler, which extracts the URL or HTML content from the event payload and calls the Pretty PDF API to generate a PDF. The result is a fully automated, zero-touch PDF workflow. No cron jobs to maintain, no scripts to babysit, no manual intervention required.
This pattern works with any system that can send HTTP webhooks — form builders, CMSes, CI/CD pipelines, email services, RSS readers, monitoring tools, and hundreds of SaaS products that support outbound webhooks.
Any system event that produces content worth archiving or distributing as a PDF can serve as a webhook trigger.
A contact form, survey, or application is submitted. Your webhook handler receives the submission data, formats it as HTML or fetches a confirmation page URL, and calls the Pretty PDF API to generate a PDF receipt or record. Attach the PDF to a confirmation email or store it for compliance.
A CMS page is published or updated. The webhook fires with the page URL, and your handler calls the Pretty PDF API to create a snapshot. Useful for maintaining PDF mirrors of documentation, policy pages, or knowledge base articles that need to stay current.
A cron job or scheduled trigger fires at a set interval — daily, weekly, or monthly. Your handler calls the Pretty PDF API with a list of URLs to archive. Ideal for compliance snapshots, recurring reports, and periodic documentation backups.
An email arrives at a designated address. A service like Zapier or Mailgun parses the email and triggers your webhook with the email body. Your handler converts the email content to a PDF for archival or forwarding as an attachment.
A new blog post or article appears in an RSS feed. Your automation platform detects the new item and sends the article URL to your webhook handler, which calls the Pretty PDF API to generate a PDF archive copy. Build a searchable PDF library of content from any RSS source.
A CI/CD pipeline completes a deployment. The pipeline triggers a webhook that calls the Pretty PDF API with your documentation URLs to generate updated PDF versions of your docs. Attach the PDFs to release artifacts so every release ships with current offline documentation.
Connect Pretty PDF to 6,000+ apps with Zapier's no-code automation platform. No server required.
Zapier connects a trigger (something happens) to an action (do something about it). To generate PDFs automatically, you create a Zap with two steps:
https://api.prettypdfprinter.com/v1/generate/url. Set the payload type to JSON and add your API key in a custom header: X-API-Key: your_api_key. Map the URL or HTML from the trigger step into the request body.Once activated, the Zap runs every time the trigger fires. A new form submission, a new spreadsheet row, a new RSS item — each one automatically generates a PDF and stores it in your chosen destination.
Build visual multi-step PDF workflows with Make's drag-and-drop scenario builder.
Make (formerly Integromat) uses a visual scenario builder where you connect modules in a chain. Each module processes data and passes it to the next. For PDF generation, the typical chain looks like this:
https://api.prettypdfprinter.com/v1/generate/url, add the X-API-Key header, and map the URL or HTML content from the trigger module into the JSON body.Make's visual builder makes complex multi-step flows accessible without writing code. You can add conditional logic (only generate PDFs for certain form values), error handling (retry on failure, alert on repeated failures), and parallel branches (store the PDF and send a notification at the same time).
Make's free tier includes 1,000 operations per month, which may be sufficient for low-volume workflows. The HTTP module for calling the Pretty PDF API is available on all plans.
For teams that want full control over their automation infrastructure, n8n runs on your own servers.
n8n is an open-source workflow automation tool that you can self-host on your own infrastructure. This means your webhook payloads, PDF content, and workflow logic never leave your network — except for the API call to Pretty PDF itself.
https://api.prettypdfprinter.com/v1/generate/url, and include the X-API-Key header. Map the content from the webhook node into the request body.n8n supports credential management, error workflows (trigger a separate workflow on failure), and workflow versioning. You can run it in Docker, on a VM, or in Kubernetes for high-availability setups. The community edition is free and open-source.
When no-code platforms do not fit your needs, a custom webhook handler gives you complete control over the PDF generation flow.
The following Python example uses Flask to receive a webhook, extract the URL from the payload, call the Pretty PDF API, and store the resulting PDF. This is a complete, production-ready starting point that you can extend with authentication, queuing, and error handling.
import os
import hashlib
import requests
from flask import Flask, request, jsonify
app = Flask(__name__)
API_KEY = os.environ["PRETTYPDF_API_KEY"]
API_URL = "https://api.prettypdfprinter.com/v1/generate/url"
PDF_DIR = "/var/pdfs"
# Track processed events for idempotency
processed_events = set()
@app.route("/webhook", methods=["POST"])
def handle_webhook():
payload = request.get_json()
# Deduplicate using event ID
event_id = payload.get("event_id", "")
if event_id in processed_events:
return jsonify({"status": "duplicate"}), 200
# Extract the URL to convert
url = payload.get("url")
if not url:
return jsonify({"error": "No URL provided"}), 400
# Call Pretty PDF API
response = requests.post(
API_URL,
headers={"X-API-Key": API_KEY},
json={
"url": url,
"template": "clean",
"page_size": "A4"
}
)
if response.status_code != 200:
# Return non-200 so the webhook provider retries
return jsonify({"error": "PDF generation failed"}), 502
# Store the PDF
filename = hashlib.sha256(url.encode()).hexdigest()[:16] + ".pdf"
filepath = os.path.join(PDF_DIR, filename)
with open(filepath, "wb") as f:
f.write(response.content)
# Mark event as processed
processed_events.add(event_id)
return jsonify({"status": "ok", "file": filename}), 200
This handler implements idempotency (skipping duplicate events), error propagation (returning non-200 so the webhook provider retries), and file storage. In production, replace the in-memory processed_events set with a database or Redis cache, and add webhook signature verification for your specific provider.
Follow these guidelines to build webhook-driven PDF workflows that are reliable, secure, and auditable.
Most webhook providers sign their payloads with a shared secret. Verify the signature on every incoming request to ensure the webhook is genuine and has not been tampered with. Never process unsigned or unverified webhooks in production — an open webhook endpoint without signature verification is an attack vector.
Webhook providers may deliver the same event multiple times due to retries or network issues. Track processed event IDs in a database or cache and skip duplicates. This prevents generating the same PDF twice, which wastes API quota and creates confusion in your output storage.
For high-volume workflows, do not call the Pretty PDF API synchronously inside your webhook handler. Instead, accept the webhook, enqueue the PDF generation job (using Redis, RabbitMQ, SQS, or any job queue), and return a 200 response immediately. A background worker picks up the job and calls the API. This pattern prevents webhook timeouts and lets you control concurrency.
Monitor your webhook handler for failures. Set up alerts (email, Slack, PagerDuty) when PDF generation fails repeatedly. Track the failure rate over time. Most webhook providers also offer delivery logs and failure notifications on their end — enable those as a secondary monitoring layer.
Maintain an audit trail of every PDF generated through your webhook pipeline. Log the event ID, source URL, timestamp, PDF file location, and any errors. This log is invaluable for debugging, compliance reporting, and understanding your PDF generation patterns over time.
Connect Pretty PDF to your existing tools with webhooks. One trigger, one API call, one styled PDF — fully automated.