Skip to content

Layout report

POST /v1/check and pressjet check answer what is wrong with a document, as data a program or an AI agent can act on without looking at the page. The format is spec/check.schema.json; a document with one of each measurable defect and the report it must produce are in spec/fixtures.

{
  "ok": false,
  "pageCount": 4,
  "pages": [{ "number": 1, "width": 595.3, "height": 841.9, "filled": 1.0 }],
  "diagnostics": [
    {
      "code": "missing_glyph",
      "severity": "error",
      "pointer": "/children/0/children/2",
      "page": 4,
      "message": "1 character(s) have no glyph in the embedded fonts and print as empty boxes: U+4E2D",
      "fix": "Replace them with characters the fonts cover (Latin, Greek, Cyrillic, punctuation, currency, arrows, mathematical and technical symbols), or draw them as an image.",
      "characters": ["U+4E2D"],
      "count": 1
    }
  ]
}

The command line prints the same report as text, two lines per finding:

out.pdf: 4 pages, 1 error
error missing_glyph at /children/0/children/2 (page 4): 1 character(s) have no glyph in the embedded fonts and print as empty boxes: U+4E2D
  fix: Replace them with characters the fonts cover (Latin, Greek, Cyrillic, punctuation, currency, arrows, mathematical and technical symbols), or draw them as an image.

Rules

  • ok is true when no diagnostic is an error. An error means content is missing or unreadable, or the document cannot be rendered. A warning means the content is complete but the page looks wrong.
  • pointer is a JSON Pointer into the layout.
  • A document that cannot be rendered is a report, not an HTTP error: pageCount is 0 and the diagnostics list what was refused. Only a malformed request (not JSON, a wrong version, an unknown request field) answers with a problem document.
  • No document text is repeated. A report carries key names the caller wrote (shortened), code points and measurements, so it is safe to log.
  • A finding is reported once per code and node, with the first page it appears on, even when the node repeats on every page.
  • At most 50 diagnostics are listed; dropped counts the rest.
  • anchors, when nodes have an id, lists where each was placed: { "id", "page", "x", "y", "width", "height" }, the page it first appears on and its box there in points from the page's top left corner. The PDF carries the same places as named destinations.
  • HTML: a check of an HTML request lists the compiler's findings first, with an empty pointer, then the layout report of the document it compiled to.
  • Every definition below is geometry or font coverage. Nothing is a judgement of taste; look at a preview for balance, spacing and emphasis.

Diagnostics

Lengths are points. "Past" an edge means by more than 0.5 pt.

Code Severity Defined as Extra fields
invalid_document error A node type, node key, property or style key the format does not have, a missing properties or children, loose text outside a text node, what a requested conformance needs and is missing (a PDF/UA title, language or image alt), or any other refusal of the validator. Unknown keys are all listed in one answer; other refusals stop at the first.
limit_exceeded error The document passes a budget: pages, nodes or image pixels.
ignored_value warning A keyword style (flexDirection, flexWrap, justifyContent, alignItems, alignSelf, textAlign, position, borderStyle, objectFit) or a color whose value the format does not have. Rendering ignores it.
missing_glyph error A text node holds characters that neither its face nor the fallback faces (Liberation Sans, then DejaVu Sans) have a glyph for. characters (up to 8 code points), count
unsupported_script error Reserved for scripts whose layout the engine does not support. count
outside_page error A node's box, or the lines of a text node, pass an edge of the page. Reported for the outermost node that passes each edge, not for its children. overflow
overflows_parent warning A node in the flow passes an edge of the view that holds it. Absolutely positioned nodes are exempt. overflow
cramped_lines error A text node of more than one line whose line height is less than 85% of its font size, so lines print over one another. It happens when a lineHeight in points is inherited by larger text. lineHeight, fontSize
word_broken warning A line of a text node ends inside a word because the word alone is wider than the line. lines, width
sparse_last_page warning The last page a page node flows onto, when there is more than one, has less than 15% of its content height filled. filled
stranded_heading warning The flow of a page ends with a text node of at most two lines, and the next page of the same page node begins with text that is smaller by 1 pt or more, or the same size and not bold while the first is bold. Only columns are followed to find the last node. Fix it with keepWithNext on the heading.
low_resolution_image warning An image is drawn at fewer than 100 pixels per inch. dpi
barcode_too_small warning A barcode's modules are narrower than 0.25 mm as drawn, too fine for most scanners and phone cameras. module (millimetres)
barcode_covered warning Text or an image is drawn over a barcode, including a verification code. Boxes are compared where they are painted, after transform.
font_substituted warning A text asks for a weight the family lacks by 100 or more, or for italic in a family without one (it is slanted). From HTML, also a family that is not available; it is an error when the list has no fallback. requestedWeight, weight, slanted
invalid_request error HTML only: an unknown or malformed request field.
ignored_css warning HTML only: a property, at-rule, selector or page size the print profile cannot honour; it is left out.
ignored_html warning HTML only: content that is not rendered, such as scripts.
missing_resource error or warning HTML only: an image that is not attached (error), or a style sheet or font file that is not (warning).

What it does not see

  • Overlap between two absolutely positioned nodes.
  • Contrast, alignment between unrelated nodes, and whether a table's column widths suit its data.
  • Refusals after the first, when the first is not an unknown key: a bad font family hides a bad page size further down.

For other renderers

The report format is specified apart from the engine so that another renderer of the same document format can produce it. The definitions above are the contract; the fixture is the test.