Quick start
This page walks through your first render — from key to PDF — without touching the dashboard.
Set your API key
Section titled “Set your API key”Export your key into the environment your script runs in:
export POLI_PAGE_API_KEY=pp_test_...Render a PDF
Section titled “Render a PDF”require "poli_page"
client = PoliPage::Client.new(api_key: ENV.fetch("POLI_PAGE_API_KEY"))
pdf = client.render.pdf( project: "billing", template: "invoice", data: { invoice_number: "INV-001", total: 1280 })pdf is a binary-encoded String of PDF bytes. Write it to disk, upload it to S3, or return it from a Rails controller.
Example
Section titled “Example”require "poli_page"
client = PoliPage::Client.new(api_key: ENV.fetch("POLI_PAGE_API_KEY"))
pdf = client.render.pdf( project: "billing", template: "invoice", data: { invoice_number: "INV-001", total: 1280 })
File.binwrite("invoice.pdf", pdf)