Skip to content

Quick start

This page walks through your first render — from key to PDF — without touching the dashboard.

Export your key into the environment your script runs in:

Terminal window
export POLI_PAGE_API_KEY=pp_test_...
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.

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)