Limits
Every document is held to a set of resource limits. Each default is set far above what real documents use, and the limits exist so that a few bytes of payload or data cannot ask for millions of pages, cells or shapes. The same limits apply to the PDF and the DOCX, so a document inside them renders in both.
Most limits are judged before anything is rendered: a definition past one is refused whole, answered 400 with the limit's code (see Errors), and nothing is stored or billed. Three are judged while the PDF's pages are laid out, because only layout knows how many pages or tiles a document makes; each says below what it does.
The request
| Limit | Value | Past it |
|---|---|---|
| Request body | 1 MB | 413, with PAYLOAD_TOO_LARGE in a Problem Details body, before the definition is read |
Resource limits
| Name | Code | Default | What it bounds |
|---|---|---|---|
payloadBytes | PAYLOAD_TOO_LARGE | 16 MiB (16,777,216 bytes) | The definition's text in UTF-8, and with it the text data binding and components add to it, and an svg file the document names |
assetBytes | ASSETS_TOO_LARGE | 64 MiB (67,108,864 bytes) | The files the document names, together: fonts, images, attachments, certificates, list-marker images and svg files, each counted once however often it is used |
decodedImageBytes | IMAGES_TOO_LARGE | 512 MiB (536,870,912 bytes) | What the document's PNG, GIF and BMP images take once decoded, together, counted from each image's header. A small file can hold a very large picture: a 778 KB PNG of 10,000 x 10,000 pixels is gigabytes decoded. A JPEG is carried as it is and not counted |
nesting | NESTING_TOO_DEEP | 43 levels | How deep the document nests once its components are composed, counted as its JSON nests (the root's object is level 2, each object or array inside it one more) |
equationNesting | EQUATION_TOO_DEEP | 64 levels | Grouping levels inside one equation: braces, fences, a fraction's or a root's arguments, chemistry's brackets |
equationText | EQUATIONS_TOO_LARGE | 65,536 characters | The source of all the document's equations together |
contentNodes | CONTENT_TOO_LARGE | 250,000 nodes | Content nodes that data binding adds by repeating a source's rows and items; counted apart, the nodes components splice in, and the nodes the definition itself holds |
componentUses | TOO_MANY_COMPONENTS | 1,000 uses | How many times the document splices in a component, every level counted |
tableCells | TABLE_TOO_LARGE | 100,000 cells | The cells of all the document's tables together, each table its rows times its widest row (a ragged table is padded to its widest row, and spans cover that grid) |
pages | TOO_MANY_PAGES | 10,000 pages | The pages the PDF's layout lays. Judged in layout |
barcodeMarks | BARCODES_TOO_LARGE | 250,000 marks | The bars, squares, hexagons and dots of all the document's barcodes together; one large QR code is some 7,800 |
svgGeometry | SVG_TOO_LARGE | 250,000 segments | The geometry of all the document's svg, written as JSON or as markup: a shape is one, a polyline its points, a path the segments that draw it (an arc up to 4,096), counted again for each use that repeats it, a list marker's clipPath counted for each marker it clips, and what an svg draws after a text in a clipping textRenderingMode counted once for each of that text's letters |
backgroundTiles | TOO_MANY_BACKGROUND_TILES | 250,000 tiles | The copies of tiled backgroundImages the PDF paints, pages and boxes together. Judged in layout |
balanceTrials | TOO_MANY_BALANCE_TRIALS | 5,000 layouts | The layouts the PDF spends balancing flowing columns (columnCount); one block of columns takes about eight, and columns nested in columns multiply them. Judged in layout |
What happens past each
- Every limit but
pages,backgroundTilesandbalanceTrials: the whole definition is refused with the code,400, and the message names what passed the limit and the value accepted. Nothing of the document is rendered. pages: layout stops at the limit and no file is written; the report carriesTOO_MANY_PAGES. A DOCX is paginated by the application that opens it, so this limit is the PDF's alone.backgroundTiles: the document is still written, but past the limit nothing more is painted behind its boxes, and an error in the report names the image. Give thebackgroundImagea larger image, or abackgroundSizethat draws it larger.balanceTrials: the document is still written; the remaining column blocks fill their columns in order, unbalanced, and a notice carries the code.
Composition and text
A few limits belong to the document language itself and are the same everywhere:
| Limit | Value | Past it |
|---|---|---|
| Component nesting | 8 levels | A component that uses a component, and so on, may nest 8 deep. A deeper use is skipped and reported as unresolved: through the API, 400 with UNRESOLVED_COMPONENT. A component that includes itself, directly or through another, is the usual cause |
Nested $data values | 4 levels | A data value may itself hold $data tokens, which are resolved in turn, four levels below the token the document writes. A token deeper than that is left as written, and the render report names it |
[br, N] | 100 | [br, N] draws at most 100 line breaks; a larger N draws 100 |
Staying inside the limits
- Reuse a file rather than copying it: a logo used in every row of a table is one file, counted once.
- Prefer a JPEG for a photograph: it is carried as it is and adds nothing to
decodedImageBytes. - A table of thousands of rows fits inside
tableCells(10,000 rows of eight columns are 80,000 cells), but a ragged table counts every row at its widest. - Give a tiled
backgroundImagean image near the size of the area it covers, so it is painted a few times rather than thousands.