Skip to content

Introduction

Hey there! Welcome to Press – a document language that automatically flows content into your design. It's perfect for generating professional PDFs from your software, and is particularly well-suited to transforming AI-generated content into polished documents.

TIP

Looking for the documentation for api.papermill/v1? That's moved here.

What makes Press different?

In Press, you build a template that describes how a set of documents should look. When you're ready to generate individual documents, Press intelligently flows the provided content into your design.

A Simple Example

Here's a simple Press document that defines a page with a title and some text:

xml
<press>
  <document>
    <page width="21cm" height="29.7cm" page-margin="2cm">
      <h1>My Report</h1>
      <p>Lorem Ipsum...</p>
    </page>
  </document>
</press>

You can see that Press is a little like HTML, and we've designed it to feel familiar to web developers and designers. "But wait!" I hear you cry, "I have to generate XML???" Fear not, when using the API from code most developers will simply send the parts of a document that change, such as content and data for typesetting. These can be sent as XML, but also using markdown and JSON.

Press is much more powerful than HTML, particularly when designing printed layouts. Using Press, you can define:

  • Page Definitions, which can be reused in a document. For example, you might have pages for the left and right side of a book, or for section dividers in a report.
  • Content Flows, also known as Flows. Flows are individual pieces of content that can be flowed between frames and across pages. For example, the articles in a magazine are content flows. Most formal documents have at least one content flow - the main body of text.
  • Components, which are reusable design elements. For example, a captioned figure is a widely used component, but components can be anything you want - a particular visualisation reused through a document, a logo - anything you want to reuse.
  • Flexible Style - Press supports styling of elements using styles on the element itself, or inside a <styles> tag. It also allows you to provide data in a <data> section, for example to generate a table from a CSV file, or to create document sections based on XML or JSON.

If all that sounds a little daunting - don't worry! You can keep your documents as simple as our first example above and learn the most powerful features of Press as and when you need them. We'll also walk you through the language using a simple example in the next section.

The Press Philosophy

We describe Press as a design-first language. In Press, you create a template that defines the layout and styling of your documents without providing the actual content. When you're ready to create a document, you Press flows content into the template, automatically breaking and move across frames and pages as needed.

Press encourages you to:

  • Design your templates first – define your page layouts, typography, and visual structure before adding content.
  • Separate content from presentation – Press will flow your text, data, and images into the frames within your design.
  • Think in precise layouts – In Press, you have complete control over the positioning of elements in the page. It's like using a technical version of Adobe InDesign.

Whether you're creating invoices, reports, marketing materials, or almost anything else, Press adapts content to your design.

Ready to dive in?

From here you have a few options:

  • Follow the tutorial: Get started

  • Create an account at Papermill and experiment with the example templates.

  • Browse this documentation to deep-dive on particular topics.


Each section includes practical examples and common "gotchas" we've learned from real-world usage.