---
type: Attested Computation
title: page-to-pdf
identifier: web/page-to-pdf
description: Render a webpage to a PDF (headless Chromium via Playwright) -- the print-to-PDF cousin of web/screenshot.py. Pass headers=<json object> to send extra request headers, as in web/screenshot.py.
pack: web
tags:
- internet
- documents
runtime: fragletc
image: ofthemachine/headless-browser@sha256:f79c496c6737113c0f6e2d648474a67fb1a416fa34c22220d5714d0b7c6a6036
network: required
stdin: none
execution_class: environmental
procedure_hash: sha256:e6c751e4af2b550620d30da2809fdf059802332f245d418bb4ec7dc5db2a7443
parameters:
- name: url
  type: string
  required: true
  description: Page URL to render
- name: headers
  type: string
  required: false
  description: JSON object of extra non-secret HTTP headers (e.g. Accept-Language); recorded in plaintext in receipts, so never credentials
computation: https://tools.ofthemachine.com/web/page-to-pdf.py
executor:
  resource: https://github.com/ofthemachine/fraglet
  receipt:
  - schema
  - fragletc
  - procedure
  - procedure_hash
  - image
  - image_digest
  - network
  - stdin_mode
  - params
  - inputs
  - argv
  - env
  - memo_key
  - started
  - finished
  - exit_code
  - stdout
  - outputs
  format: fraglet-receipt/2 (fragletc --receipt <path>, or FRAGLETC_RECEIPT_DIR)
attester:
  resource: https://tools.ofthemachine.com/receipt/attest.py
  method: 'deterministic, no re-execution: procedure_hash equals sha256 of computation; memo_key recomputes from the receipt''s own fields; claimed params and any artifact hash match the receipt'
generated:
  by: process:tools/catalog/compile.py
  at: '2026-11-13T18:27:40Z'
outputs:
- page.pdf
---

# page-to-pdf

Render a webpage to a PDF (headless Chromium via Playwright) -- the print-to-PDF cousin of web/screenshot.py. Pass headers=<json object> to send extra request headers, as in web/screenshot.py.

Use when the user wants a PDF of a web page as the browser would print it, including layout and images.

# Schema

## Parameters
- `url` (string, required) — Page URL to render
- `headers` (string, optional) — JSON object of extra non-secret HTTP headers (e.g. Accept-Language); recorded in plaintext in receipts, so never credentials

## Outputs
- `page.pdf` (declared file under /output)

# Execution

The computation is [`web/page-to-pdf.py`](https://tools.ofthemachine.com/web/page-to-pdf.py) (frontmatter `computation`; in `tools.tar.gz` the same file sits at `web/page-to-pdf.py` beside this bundle), run by `fragletc` in `ofthemachine/headless-browser@sha256:f79c496c6737113c0f6e2d648474a67fb1a416fa34c22220d5714d0b7c6a6036` with network `required`. Its identity is `procedure_hash` = sha256 of that file, shebang included — the same value every receipt records. Parameters are passed as `-p name=value`; `--receipt run.json` (or `FRAGLETC_RECEIPT_DIR`) writes the receipt, a `fraglet-receipt/2` JSON document with the fields listed under `executor.receipt`.

# Attestation

A run's receipt is attested with [`receipt/attest.py`](https://tools.ofthemachine.com/receipt/attest.py): the computation that ran is this script (`procedure_hash`), the receipt is internally consistent (`memo_key` recomputes from its own fields), the claimed parameters are the ones that ran, and an artifact claimed as an output hashes to what the receipt recorded. No re-execution: attestation is provenance fidelity, not reproduction.

Environmental: the tool reaches the network, so outputs depend on state outside its inputs; the receipt records exactly what ran and what came out and makes no reproduction claim.

Skill: [SKILL.md](https://tools.ofthemachine.com/web/SKILL.md)
