An agreement built on three supplied templates

A customer sends their own paper as three PDF files — the page with their name and address at the top, a plain page for the pages that follow, and the page of conditions they always attach at the end. A file used that way is called a template. What they want back is a supply agreement that looks as though it came off their own printer, and the surest way to fail at that is to try to redraw any of it.

All three templates are kept exactly as they came: the engine reads each file, takes its page in as it stands, and puts the new text on top. So the customer's letterhead looks exactly as they made it, and the conditions they agreed to are the ones on file, word for word. How many pages the plain page is needed for is settled by the table of deliveries itself: it takes the pages it takes, and the document is that long.

What this example shows

  • Three separate templates read and used as they stand.
  • One template repeated behind however many pages the table needs.
  • A supplied page kept whole, and counted as a page of the document.

The source code, complete

Nothing is left out and nothing is simplified: this is the program exactly as it runs, for the developer who uses this library. The third is the description itself: a plain list of what the page has to say, which is what the service is sent.

Read the Rust source Read the Python source Read the JSON source

The document itself

Open the document in English Open the document in French

Examples near this one

The watermark a trial copy carries

What you get before you pay anything: a watermark across every page, and the same pages under it, laid out exactly as a paid copy lays them out. This is also the document that says what a licence key changes, and why every figure on this site is measured with one.

An interactive form

A form a reader fills in: text boxes, a check box, a drop-down, radio buttons.

A document signed with a demonstration certificate

A page carrying a digital signature that any change to the file breaks, made with a certificate that exists only for the demonstration. Every command that made the key and the signature is printed on the page, with the one that checks it without this library.

Every example, by subject