---
type: Attested Computation
title: markdown-to-pdf
identifier: doc/markdown-to-pdf
description: 'Render Markdown to one PDF with headless Chromium: inline text, a single .md (or .html) file, or a tar/tar.gz/zip bundle of pages plus the images and fonts they reference by relative path. Several pages become one document with page breaks (ordered by manifest.txt/order.txt when present, else by path) and a table of contents. style=reader applies clean reader typography; style=none renders the page exactly as authored, adding only the page box -- for pages that bring their own <style>, like newspapers, posters, and one-sheets.'
pack: doc
tags:
- documents
runtime: fragletc
image: ofthemachine/headless-browser@sha256:8ac6f2f481f40e32a0b2f8dd7a834fd03197b1556bd8f55b1f167cd71d4877b0
network: none
stdin: buffer
execution_class: hermetic
procedure_hash: sha256:8921a19d73692007cd2e35ec8edd09136d5c460e4f08f9579045c26f558e3139
parameters:
- name: source
  type: file
  required: false
  description: A .md or .html file, or a tar/tar.gz/zip bundle of pages and their assets
- name: text
  type: string
  required: false
  description: Inline Markdown (or pipe stdin), when there is no source file
- name: page
  type: string
  required: false
  description: Render only this entry of a bundle (e.g. index.html); omitted, every .md in the bundle
- name: style
  type: string
  required: false
  default: reader
  description: reader (house typography) or none (the page exactly as authored, plus the page box)
- name: toc
  type: string
  required: false
  default: auto
  description: 'Table of contents: auto (when there is more than one page), true, or false'
- name: title
  type: string
  required: false
  description: Document title, shown as a heading above the contents (reader style only)
- name: size
  type: string
  required: false
  default: A4
  description: Paper size (A4, Letter, ...)
- name: margin
  type: string
  required: false
  description: Page margin on all sides (default 18mm for reader, 12mm for none)
computation: https://tools.ofthemachine.com/doc/markdown-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:
- document.pdf
---

# markdown-to-pdf

Render Markdown to one PDF with headless Chromium: inline text, a single .md (or .html) file, or a tar/tar.gz/zip bundle of pages plus the images and fonts they reference by relative path. Several pages become one document with page breaks (ordered by manifest.txt/order.txt when present, else by path) and a table of contents. style=reader applies clean reader typography; style=none renders the page exactly as authored, adding only the page box -- for pages that bring their own <style>, like newspapers, posters, and one-sheets.

Use when the user wants a PDF of some Markdown -- one note, a folder of documents compiled into a digest, or a designed page with its own assets and styling.

# Schema

## Parameters
- `source` (file, optional) — A .md or .html file, or a tar/tar.gz/zip bundle of pages and their assets
- `text` (string, optional) — Inline Markdown (or pipe stdin), when there is no source file
- `page` (string, optional) — Render only this entry of a bundle (e.g. index.html); omitted, every .md in the bundle
- `style` (string, optional, default `reader`) — reader (house typography) or none (the page exactly as authored, plus the page box)
- `toc` (string, optional, default `auto`) — Table of contents: auto (when there is more than one page), true, or false
- `title` (string, optional) — Document title, shown as a heading above the contents (reader style only)
- `size` (string, optional, default `A4`) — Paper size (A4, Letter, ...)
- `margin` (string, optional) — Page margin on all sides (default 18mm for reader, 12mm for none)
- stdin (optional) — piped input is read in full and hashed into the run's receipt

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

# Execution

The computation is [`doc/markdown-to-pdf.py`](https://tools.ofthemachine.com/doc/markdown-to-pdf.py) (frontmatter `computation`; in `tools.tar.gz` the same file sits at `doc/markdown-to-pdf.py` beside this bundle), run by `fragletc` in `ofthemachine/headless-browser@sha256:8ac6f2f481f40e32a0b2f8dd7a834fd03197b1556bd8f55b1f167cd71d4877b0` with network `none`. 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.

Hermetic: no network, so `memo_key` also fully determines the outputs — a re-run with the same inputs must reproduce them, which makes results from this tool safely memoizable.

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