Use case

Report PDF API

Generate multi-page data reports as PDFs via a single API call. Full CSS support means charts, tables, and styled layouts render exactly as designed — no workarounds.

Full CSS Grid and Flexbox

Complex dashboard layouts with multiple columns, metric cards, and data tables render correctly. Chromium renders it — same as the browser.

Charts and SVGs

Render charts built with Chart.js, D3, or any SVG-based library. Screenshot-quality rendering, not a canvas export.

Multi-page with headers

Use CSS @page rules to add running headers, footers, and page numbers across multi-page reports.

Background colors and images

printBackground: true ensures background colors, gradients, and images render fully — not stripped like browser print defaults.

Template your HTML

Use any server-side template engine — Jinja2, Handlebars, Blade, ERB. Papyr receives rendered HTML and returns PDF.

Landscape format

Wide data tables and dashboards work better in landscape. Set options.landscape: true for A4 or letter landscape PDFs.

Generate a report PDF

Node.js
const html = `
<!DOCTYPE html>
<html>
<head>
  <style>
    body { font-family: sans-serif; margin: 0; padding: 40px; color: #111; }
    h1 { font-size: 24px; border-bottom: 2px solid #eee; padding-bottom: 12px; }
    .metric { display: inline-block; width: 30%; text-align: center;
               background: #f9f9f9; border-radius: 8px; padding: 20px; margin: 8px; }
    .metric .value { font-size: 36px; font-weight: bold; color: #1a1a1a; }
    .metric .label { font-size: 13px; color: #666; margin-top: 4px; }
    table { width: 100%; border-collapse: collapse; margin-top: 24px; }
    th { background: #f4f4f4; text-align: left; padding: 10px 12px; font-size: 13px; }
    td { padding: 10px 12px; border-bottom: 1px solid #eee; font-size: 14px; }
  </style>
</head>
<body>
  <h1>Q4 2025 Performance Report</h1>
  <div>
    <div class="metric">
      <div class="value">${data.revenue}</div>
      <div class="label">Total Revenue</div>
    </div>
    <div class="metric">
      <div class="value">${data.customers}</div>
      <div class="label">New Customers</div>
    </div>
    <div class="metric">
      <div class="value">${data.churnRate}</div>
      <div class="label">Churn Rate</div>
    </div>
  </div>
  <!-- More sections... -->
</body>
</html>
`;

const response = await fetch("https://api.getpapyr.dev/v1/render/pdf", {
  method: "POST",
  headers: {
    "Authorization": "Bearer pk_live_...",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    html,
    options: {
      format: "A4",
      landscape: false,
      margin: { top: "25mm", right: "20mm", bottom: "25mm", left: "20mm" },
      printBackground: true,
    },
  }),
});

const pdfBuffer = Buffer.from(await response.arrayBuffer());
// Save, email, or return to client
Python + Jinja2
import httpx
from jinja2 import Template

template = Template(open("report_template.html").read())
html = template.render(data=report_data)

response = httpx.post(
    "https://api.getpapyr.dev/v1/render/pdf",
    headers={"Authorization": "Bearer pk_live_..."},
    json={
        "html": html,
        "options": {
            "format": "A4",
            "margin": {"top": "25mm", "right": "20mm",
                       "bottom": "25mm", "left": "20mm"},
            "printBackground": True,
        },
    },
)

with open(f"report_{report_id}.pdf", "wb") as f:
    f.write(response.content)

Common report types

Business analytics reports

Monthly/quarterly KPI summaries with metric cards and trend tables for stakeholders.

Financial statements

P&L, balance sheets, and cash flow statements exported from your accounting data.

Scheduled email digests

Weekly or monthly PDF reports auto-generated and attached to email via cron job.

Client reports

Branded reports generated per-client from your SaaS platform — download on demand or auto-delivered.

Compliance documentation

Audit logs and compliance summaries exported as tamper-evident PDFs for regulatory purposes.

Data exports

Large dataset exports with pagination, rendered from your database query results.

Start generating report PDFs

100 free reports per month. No credit card required. API key in 30 seconds.