Skip to content
Power On Labs

Small web-data tools, and the runs that show what they return.

How do I turn my own HTML into a PDF?

Send the HTML itself instead of a URL. It is rendered in a real browser — the same engine your users have — and printed to PDF, so what you get is what Chrome's “Save as PDF” would give you, without running a headless browser yourself.

The two settings that matter: format: "pdf", and fullPage: false so the output is paginated A4 rather than one long strip of paper as tall as the content. For an invoice, a receipt or a report, A4 is what you want.

A real run

Input — the HTML is sent as a string in the html field
{
  "html": "<!doctype html>\n<meta charset=\"utf-8\">\n<title>Invoice 2026-0042</title> ...",
  "format": "pdf",
  "fullPage": false
}
The HTML itself, unescaped — a whole document, styles included
<!doctype html>
<meta charset="utf-8">
<title>Invoice 2026-0042</title>
<style>
  @page { margin: 18mm; }
  body { font: 12pt/1.5 Helvetica, Arial, sans-serif; color: #111; }
  h1 { font-size: 20pt; margin: 0 0 2mm; }
  .meta { color: #555; margin-bottom: 8mm; }
  table { width: 100%; border-collapse: collapse; }
  th, td { text-align: left; padding: 2mm 0; border-bottom: 1px solid #ddd; }
  th.n, td.n { text-align: right; }
  tfoot td { font-weight: bold; border-bottom: none; }
</style>
<h1>Invoice 2026-0042</h1>
<p class="meta">Issued 15 September 2026 &middot; due 15 October 2026</p>
<table>
  <thead><tr><th>Description</th><th class="n">Qty</th><th class="n">Unit</th><th class="n">Amount</th></tr></thead>
  <tbody>
    <tr><td>Page captures</td><td class="n">1,200</td><td class="n">$0.01</td><td class="n">$12.00</td></tr>
    <tr><td>PDF renders</td><td class="n">300</td><td class="n">$0.01</td><td class="n">$3.00</td></tr>
  </tbody>
  <tfoot><tr><td colspan="3">Total</td><td class="n">$15.00</td></tr></tfoot>
</table>
Output
{
  "url": "(inline HTML)",
  "finalUrl": null,
  "ok": true,
  "statusCode": null,
  "title": "Invoice 2026-0042",
  "format": "pdf",
  "width": 794,
  "height": 1123,
  "pageHeight": 1080,
  "truncated": false,
  "bytes": 19492,
  "durationMs": 504,
  "error": null,
  "key": "001-html.pdf"
}

794×1123 is A4 at 96 dpi, which is how you can tell from the row alone that the page size took. The PDF that run produced is here, 19,492 bytes, unedited.

Two things that will cost you an hour if nobody tells you

Or from a URL instead

The same tool takes urls in place of html and prints a live page to PDF — an article, a receipt page, a dashboard. With fullPage: true you get one tall page instead of A4 sheets, which is better for archiving a page as it looked and worse for printing it.

What it costs

$0.01 per PDF produced — the same event as a screenshot, because it is the same capture. A render that fails is not charged.

The tool that does it

Website Screenshot & PDF Generator API on Apify Store.

$0.01 per successful capture. No start fee, no subscription. A URL that fails is not charged.