Leaf

Leaf for developers

Leaf is an open document format meant to replace PDF. It looks the same on every device, but keeps real content inside, so it stays editable, fillable and signable.

Why a new format

PDF was built for printing. Inside, it is mostly instructions to draw text at fixed positions, which is why it is reliable to view and painful to edit. Signing usually means a paid service.

Leaf keeps the reliability and stores what the document means: headings, paragraphs, tables and form fields. Pages are laid out from that content and sealed, so every viewer draws the same page.

What you can do

Edit like a doc

Change the text and the pages re-flow on their own.

Fill forms

Form fields are part of the file, not drawn on top of it.

Seal and sign

Anyone can check a signature and see whether anything changed since, with no signing service.

Export to PDF

Every Leaf file exports to a standard PDF, and PDFs can be opened in the viewer too.

Inspect everything

A Leaf file is a ZIP of plain JSON. Open it and read the content, layout and edit history.

A full PDF toolkit

Annotate, fill, merge, split, redact, add watermarks, run OCR and set passwords on ordinary PDFs.

How a file is built

A .leaf file is a ZIP package with a hash for every part:

mimetype                application/vnd.leaf+zip
manifest.json           version, parts, SHA-256 of each part
content/document.json   the content as a tree of blocks
content/styles.json     page size, margins, styles
layout/pages.json       sealed page layout
data/values.json        form answers
history/changes.jsonl   edit log
versions/               sealed versions
signatures/             signatures over sealed versions

The specification describes each part, the security model and how PDF import and export work.

Try it

Open the viewer and load your own .leaf or .pdf, or download a sample Leaf file to open in it. In Chrome or Edge you can install the viewer as an app that opens .leaf and .pdf files when you double-click them.

Status

Leaf is at version 0.1, a draft for public discussion. The format may still change, so do not use it yet for anything that must stay readable for years. Signatures in the viewer use demo keys while key handling is designed; do not rely on them for legal signing.

Feedback on the spec is the most useful contribution right now. Open an issue on GitHub or write to [email protected].

Open by design

PartLicense
Format specificationCC BY 4.0
Core library (core/)Apache 2.0
Viewer app (viewer/)AGPL-3.0

The format and library are permissive so browsers and companies can add Leaf support. The viewer is AGPL so hosted forks share their improvements. The name Leaf and its logo identify the official format and apps.