zztaeha

Limits

37 limits in daeepdf 1.2.0, each read from the source that sets it. They keep a template, an image or a font from taking unbounded time or memory.

Past most of them an export still finishes, with a 'limit-reached' warning or the thing drawn more simply. Each entry says which.

Pages

How large a document and its pages can be, and how much work laying it out may take. Two of these are errors: a page side out of range and a document over 10,000 pages throw before anything is drawn. The rest change the layout past their bound, one of them with a 'limit-reached' warning.

Pages in a document

A document has at most 10,000 pages.

Past 10,000 pages, exports and pdf.preview throw 'too-many-pages' as soon as the layout shows the count, before anything is drawn, so a runaway template fails fast instead of filling memory. Content an overflow box clips adds no pages.

It bounds the whole export: every page holds a copy of each fixed element, each header and footer is laid out once a page, and each page is a set of objects in the file. A real document over 10,000 pages has to be split into several exports.

import pdf from 'daeepdf'

// An inch-square page, so the page count is the content's height in inches
const tall = (inches: number) => pdf.render(`<div style="height: ${inches}in"></div>`, {
  size: { width: '1in', height: '1in' },
})

const file = await tall(10000)
file.pages // 10000
const error = await tall(10001).catch((e: { code: string }) => e.code)
error // 'too-many-pages'
  • Set in: MAX_PAGES = 10000 in src/capture/types.ts.
A page side

Each side of a page is from 3 to 14,400 pt.

That is about 1 mm to 200 in (5.08 m), the range of page sizes PDF itself allows. It holds for a size of { width, height } and for the lengths in the template's @page { size }; the named sizes are all inside it. A side outside it throws 'invalid-page-size', in exports and in pdf.preview.

Besides PDF's own range, the lower bound keeps a zero or tiny side from making a document of endless pages.

import pdf from 'daeepdf'

const banner = (height: string) => pdf.render('<p>Banner</p>', { size: { width: '8.5in', height } })

// The page-side limit: 200 in is 14,400 pt, the longest side there is
const file = await banner('200in')
const error = await banner('201in').catch((e: { code: string }) => e.code)
error // 'invalid-page-size'
  • Set in: MAX_PAGE_PT = 14400 in src/shared/page.ts.
Content wider than the page

Content wider than the page is shrunk onto it by at most 1.5 times.

With shrinkToFit, the default, content that reaches past the page's right edge is laid out again on a page up to 1.5 times as wide, then shrunk onto the paper, to no less than 2/3 of its size. What reaches past 1.5 page widths is cut off at the paper's right edge, without a warning. With shrinkToFit: false nothing is shrunk, and the content is cut at the page's own edge.

It is Chrome's print behavior, factor included, and daeepdf matches it so a page holds what Chrome's print would put on it: on an A4 page, 795 px wide, text 1,100 px in prints and text 1,250 px in doesn't, in Chrome's print and in daeepdf alike.

import pdf from 'daeepdf'

// A row 3,000 px wide on an A4 page, which is 795 px wide. The shrink limit lets content
// reach 1.5 times as far, to 1,192.5 px, and cuts off the rest
const file = await pdf.render(`<style>
  @font-face { font-family: Inter; src: url('/fonts/inter-var.ttf'); }
  body { font: 12pt Inter; }
  .at { position: absolute; }
</style>
<div style="position: relative; width: 3000px; height: 1in">
  <span class="at" style="left: 1000px">Shrunk</span>
  <span class="at" style="left: 1250px">Cut off</span>
</div>`)
// The PDF holds 'Shrunk', and 'Cut off' is past the edge
  • Set in: MAX_SHRINK = 1.5 in src/capture/index.ts.
Page-break fixes per page

The page-break pass makes at most 30 fixes for each page the layout runs to, and 300 for a short one.

Chrome lays the template out as one long column, and daeepdf then finds what each page's end would cut: a line of text, an image, a table row, a box that avoids breaks. It moves each to the next page, one fix at a time, as Chrome's print does, and lays the document out again after each.

Plain text needs about one fix a page, and tables and nested boxes a few, so a document reaches the bound only when something keeps undoing its own fixes. Past it the pass stops, with a 'limit-reached' warning, and the page ends after that aren't fixed: a line or a box there is cut by the page's edge. 1,600 lines on pages that hold 3 each make 534 pages of whole lines, as in Chrome's print.

The bound is there because every fix costs a layout of the whole document, so a template can't make the pass run longer than its pages need. A layout past 10,000 pages stops the pass at once, and the export throws 'too-many-pages'.

  • Set in: FIXES_PER_PAGE = 30 in src/capture/breaks.ts.
A repeated table header or footer

A table's header or footer of more than 200 elements isn't repeated.

Where a table runs onto another page, daeepdf repeats its <thead> at the top of that page and its <tfoot> at the bottom, as Chrome's print does. A group is counted as its rows plus every element inside them; past 200, it prints once where it stands and isn't repeated, without a warning. A group taller than a quarter of the page, or hidden, isn't repeated either.

Here Chrome's print differs: a header of 201 elements repeated on every page of a three-page table in Chrome, and on none in daeepdf. The bound is there because each repeat is a copy that every later page-break fix lays out again.

  • Set in: MAX_HEADER_ELEMENTS = 200 in src/capture/breaks.ts.
Repeated table header and footer copies

A document copies at most 10,000 elements to repeat table headers and footers.

Each page a <thead> or <tfoot> is repeated on costs its element count, its rows and what they hold, for all the document's tables together. Once 10,000 are spent, the pages after get no repeated header or footer, without a warning. A header row of ten cells costs 11 a page, so it repeats on about 900 pages.

The bound is there because every later page-break fix lays all the copies out again.

  • Set in: MAX_HEADER_CLONES = 10000 in src/capture/breaks.ts.
A counter written in symbols

A list marker or counter written in repeated symbols has at most 120 of them.

A symbolic or additive counter style writes a number as repeated symbols: a symbolic style of one symbol writes 3 as three of it. A number that would need more than 120 symbols, or a style whose pad is over 120, is written in the style's fallback instead, decimal unless it names another. Nothing warns.

It is Chrome's own limit, and daeepdf matches it so the marker it draws is the one Chrome laid out: with an @counter-style of one star, item 120 is 120 stars and item 121 is "121.", in Chrome's layout and in the PDF.

  • Set in: MAX_LENGTH = 120 in src/capture/css/counters.ts.

Loading

How long an export waits for the files a template names, and how much of a font or a color profile it takes. What is still loading at the deadline is left out, so a slow server costs a document its fonts and images, never the export itself.

Waiting for fonts, images and stylesheets

An export waits at most 10 seconds, or loadTimeout ms, for all the files a template loads.

It waits for the template's fonts, for the app's stylesheets it lays out with (useAppStyles), and for images: <img>s, and url() images in backgrounds, masks, border images and list markers. They load together, under one wait that ends at loadTimeout ms, 10,000 unless you set it, or at once when the export's signal aborts: at loadTimeout: 2000, an export with a stalled font, image and app stylesheet took 2.1 s here. A file an export gave up on isn't waited for again in its later layouts, headers and footers.

Past the deadline, what is still loading is canceled and left out. A font is 'font-not-loaded', and its text prints in fallbackFont or is left out. A CSS image or an <img> is 'image-skipped'. An app stylesheet is left out of the layout without a warning.

The bound is there because a server that sends its headers and then holds the body would otherwise hold the export forever.

import pdf from 'daeepdf'

const html = `<style>
  @font-face { font-family: Inter; src: url('/fonts/inter-var.ttf'); }
  body { font: 12pt Inter; }
</style>
<p>Hello</p>`

// The load-wait limit at 0 ms: no time for the font, so it is left out, and its text with it
const rushed = await pdf.render(html, { loadTimeout: 0 })
rushed.warnings.map((w) => w.code) // ['font-not-loaded', 'font-not-declared']

// For a slow font server, wait longer
const file = await pdf.render(html, { loadTimeout: 30_000 })
file.warnings // []
  • Set in: LOAD_WAIT_MS = 10000 in src/capture/frame.ts.
A font file

A font file is at most 64 MB.

The size is counted as the file arrives, after the browser has decoded any Content-Encoding, so a small compressed response that unpacks past 64 MB is caught too. Past it, the fetch is canceled and the font is 'font-not-loaded', a warning, not an error: its text prints in fallbackFont or is left out.

The bound keeps one file from filling the memory of the engine, which holds an export's fonts while it writes the PDF.

  • Set in: MAX_FONT_BYTES = 64 << 20 in src/daegun/fonts.ts.
A font subset drawn as an image

Text the browser draws for daeepdf carries at most 12 MB of fonts per layout.

Text in an SVG drawn as an image, and text under a filter or mask, is drawn by the browser rather than by daeepdf, so each such SVG or raster carries a copy of the glyphs it needs from the template's fonts. One layout, the content or the run of a header's or footer's pages, makes at most 12 MB of these copies. Past it, 'limit-reached' warns, and later such text draws in the browser's own fallback font. Text daeepdf draws itself, nearly all of it, never counts.

The bound is there because the copies are inlined in their SVGs as base64, about 16 MB for the 12, so a template repeating such text would otherwise hold a copy of a font for each.

  • Set in: MAX_SUBSET_BYTES = 12 << 20 in src/capture/fonts.ts.
A PNG's color profile

A PNG's color profile is read up to 4 MB.

A PNG keeps its ICC profile compressed in an iCCP chunk, which daeepdf inflates to embed with the image. One that inflates past 4 MB, or is broken, or is for a different number of channels than the image has, is dropped, and the image is embedded without it, its colors taken as plain RGB or gray. Nothing warns.

The bound is there so a few bytes of crafted data can't inflate into gigabytes. A JPEG's profile is stored uncompressed, so it can be no larger than the file.

  • Set in: maxSize = 4 * 1024 * 1024 in src/images/parse.ts.

Images and painting

Bounds on pixels and on repeated drawing. daeepdf draws most of a page as vectors and text, and some things as images: a filter, a mask, a border image, a conic gradient, a canvas, an SVG it can't draw as vectors. The raster budget is the one to know first: 64 megapixels per export, which PNG images count toward and JPEGs don't. Past most of these limits something is drawn more simply, and past a few it is left out.

An image

An image daeepdf has to decode is at most 50 megapixels.

A PNG, WebP or AVIF image over 50 megapixels is 'image-skipped', as is any image drawn on a canvas: under a mask, as a border image or in an element with a filter, a JPEG judged by the size its header gives. A JPEG <img> or background is embedded as it is, never decoded, so it prints at any size: a 52-megapixel JPEG printed here, and a 50.01-megapixel PNG was skipped.

For scale, an A4 page at 600 dpi is about 35 megapixels. The bound is there because a decoded image takes up to about 16 bytes a pixel on its way into the PDF, so 50 megapixels is about 800 MB, and an image's header can claim any size: it is checked before any buffer is made.

  • Set in: MAX_IMAGE_PIXELS = 50_000_000 in src/images/parse.ts.
An element drawn as an image

An element daeepdf draws as an image has at most 16 megapixels.

What daeepdf can't draw as vectors it draws as an image at 216 dpi, 3 px a pt: an element under a filter or mask, a border image, a conic gradient, an SVG the vector path can't take. One that would pass 16 megapixels at 216 dpi is drawn at the lower resolution that fits, without a warning. That happens past about 1,778,000 pt², an element 1,333 pt (18.5 in) square; a whole A4 page at 216 dpi is 4.5 megapixels.

A <canvas> over 16 megapixels is 'image-skipped' instead. The bound is there because an element-sized canvas at full resolution would take gigabytes for a large element.

import pdf from 'daeepdf'

// 5,000 × 4,000 is 20 megapixels, past the raster-element limit
const file = await pdf.render('<canvas width="5000" height="4000" style="width: 5in"></canvas>')
file.warnings.map((w) => w.message) // ['A 5000x4000 <canvas> is past the 16 MP raster cap – skipped.']
  • Set in: MAX_RASTER_PIXELS = 16_000_000 in src/capture/raster/canvaspaint.ts.
Pixels drawn per export

An export rasterizes and decodes at most 64 megapixels in all.

What counts: every image daeepdf draws itself (filters, masks, conic gradients, border images, SVGs drawn as images), each <canvas>, each PNG image by its pixels, each image the browser decodes (WebP, AVIF, and a PNG or JPEG daeepdf's own reader refuses), images under a filter or mask at their full decoded size, and color bitmap glyphs, as in emoji fonts with sbix or CBDT tables. An image used many times counts once. A JPEG embedded as it is doesn't count at all. A layout pass thrown away, when a header or footer grows, gives back its rasters but not its decoded images.

Past it, 'limit-reached' warns once, and whatever doesn't fit is left out: a PNG <img> with an 'image-skipped' of its own, a color bitmap glyph drawn as its outline instead. Five 16-megapixel canvases reached it here. For scale, eight 8-megapixel photos saved as PNG spend it all, and as JPEG cost nothing.

The bound is there because a small filtered SVG repeated through a document could otherwise take gigabytes.

  • Set in: left = 64_000_000 in src/capture/raster/canvaspaint.ts.
A canvas side

An image daeepdf draws itself is at most 32,767 px on a side.

That is the longest side every browser backs a canvas at; past it a canvas has no pixels. daeepdf keeps each canvas of its own within it, as it keeps them within 16 megapixels: a thin element under a filter, 12,000 pt tall, would need 36,000 px at 216 dpi, and is drawn at 32,767, about 197 dpi. Nothing warns.

A template's own <canvas> larger than the browser can back is 'image-skipped'. In Chrome, 33,000 px a side was fine here and 70,000 was too many.

  • Set in: MAX_CANVAS_SIDE = 32767 in src/capture/raster/canvaspaint.ts.
Background and mask layers

A background or mask draws its first 32 image layers.

Past 32 layers in one background-image or mask-image list, the rest are skipped: the bottom ones, since the list runs top first. 'limit-reached' warns once per export.

The bound is there because every layer is drawn for each element and each page, and a class repeats its list on every element it styles; past a few dozen, stacked layers can't be told apart.

import pdf from 'daeepdf'

const box = (count: number) => {
  const layers = Array.from({ length: count }, (_, i) => `linear-gradient(${i * 11}deg, #0001, transparent)`)
  return pdf.render(`<div style="height: 2in; background-image: ${layers.join(', ')}"></div>`)
}

// The image-layers limit: 32 layers draw, and a 33rd is one too many
;(await box(32)).warnings // []
;(await box(33)).warnings.map((w) => w.code) // ['limit-reached']: the 33rd layer isn't drawn
  • Set in: MAX_IMAGE_LAYERS = 32 in src/capture/images.ts.
Background tiles per export

An export draws at most 100,000 background tiles one by one.

A repeating background is drawn tile by tile, and every tile of every layer of every element on every page counts. Once an export has drawn 100,000, each later tiled background is drawn as blocks: images that each hold a grid of its tiles, made as an SVG pattern and drawn from the browser's rendering, so they count toward the raster budget. It looks the same, a vector tile a little less sharp. Nothing warns.

The bound is there because a tiny tile over large boxes on many pages would otherwise make millions of drawing commands.

  • Set in: tiles = 100_000 in src/capture/raster/canvaspaint.ts.
Tiles of one background

One background layer draws at most 2,000 tiles one by one.

A layer whose tiles over its box come to more than 2,000 on a page is drawn as blocks instead, each an image holding a grid of tiles, so that no more than 2,000 are placed: a 10 px pattern over a whole A4 page is about 9,000 tiles. A gradient layer past it is drawn as an image tile first, then in blocks. Nothing warns.

The bound is there so a tiny tile stays a bounded number of drawing commands however large its box.

  • Set in: MAX_TILE_DRAWS = 2000 in src/capture/images.ts.
Stops of a repeating gradient

A repeating gradient is written with at most 2,000 stops.

A repeating-linear-gradient(), repeating-radial-gradient() or repeating-conic-gradient() is written as its stops repeated along the gradient line. Past 2,000 stops it stops repeating, and the last stop is stretched to the end of the line. A two-stop pattern repeats in full while its period is at least 1/1,000 of the line, 1 pt on a line 1,000 pt long; a finer one turns into one long blend where the stops run out. Nothing warns.

The bound is there because a period can be made as small as one likes, and each stop is written into the PDF.

  • Set in: MAX_TILED_STOPS = 2000 in src/capture/css/css.ts.
Shadows of one element

An element draws at most 32 shadows of each kind.

Past 32 layers in a box-shadow or a text-shadow list, the rest are dropped, the bottom ones, since the list runs top first. Nothing warns.

A document also has 50,000 blur steps for all its shadows: a blurred shadow takes up to 60, one for each 2 pt of blur, and once they are spent each later shadow is drawn in one step, a plain shape with no blur.

The bound is there because every layer redraws the element, 60 times for a blurred one, and a class repeats its list on every element it styles.

  • Set in: MAX_SHADOW_LAYERS = 32 in src/capture/css/css.ts.
clip-path copies across pages

clip-path shapes copied across pages hold at most 1,000,000 path segments per export.

A box with a clip-path that spans pages is clipped on each page by its own copy of the shape, and a polygon() or path() costs its segments on every page past the first. Past 1,000,000 segments in all, 'limit-reached' warns, and each later clip-path on a box that spans pages clips to its shape's bounding box, a rectangle. A 1,000-point polygon on a box 1,200 pages tall reached it here, and one 900 pages tall didn't.

The bound is there because a short path on a box thousands of pages tall would otherwise be written thousands of times.

  • Set in: MAX_CLIP_COPIES = 1_000_000 in src/capture/walk.ts.

SVG

An inline SVG, or an SVG image, is drawn as PDF vectors when daeepdf can convert it whole, and as an image from the browser's own rendering otherwise. Two of these bounds decide when an SVG takes the second way, and it then still prints, at 216 dpi instead of as vectors; the third bounds the copies made for <use>s with custom properties of their own. None of them warns.

<use> nesting

<use> nests at most 12 deep in an SVG drawn as vectors.

An SVG whose <use> elements reach a 13th level, a <use> drawing a <use> drawing another, isn't drawn as vectors: the whole SVG is drawn as an image from the browser's rendering, at 216 dpi, and counts toward the raster budget. A chain of 12 drew as vectors here and one of 13 as an image. A <use> that reaches itself draws nothing.

The bound is there because each level walks its target again for every instance, so nested uses multiply the work.

  • Set in: MAX_USE_DEPTH = 12 in src/draw/svgvector.ts.
An SVG drawn as vectors

Converting an SVG to vectors takes at most 500,000 steps.

Each element visited, each path segment and gradient stop, and each 64 characters of an element's attributes is a step, and a <use> walks its target again for every instance. Past 500,000 the conversion stops and the whole SVG is drawn as an image from the browser's rendering instead. A group of 1,000 rectangles used 10 times drew as vectors here, and used 100 times as an image.

The bound is there because a small SVG of nested uses can multiply into millions of shapes.

  • Set in: MAX_WORK = 500_000 in src/draw/svgvector.ts.
SVG copies in custom-property contexts

An SVG copies at most 5,000 elements for <use>s that draw in their own custom properties.

A <use> whose custom properties differ from the template root's, an --icon-color set on it say, draws its target with them, so a var() inside resolves to the use's values. daeepdf makes a copy of the target for each such context, counting the elements copied, at most 5,000 in one SVG. Past it, a later <use> draws with the custom properties of the template's root instead. Nothing warns.

The bound is there because nested <use>s, each in a context of its own, multiply the copies.

  • Set in: MAX_CONTEXT_COPIED = 5000 in src/capture/images.ts.

Fonts and glyphs

Bounds on reading a font's glyphs. daeepdf reads outlines itself for color glyphs, underline skip-ink and fonts with CFF2 outlines, and a crafted font can make one glyph cost without end, through composites, subroutines or paints that reach the same part down many paths. Most bounds come in pairs, one for a glyph and one for a whole document or font subset. Ordinary text never meets them: daeepdf embeds the font and the viewer draws its glyphs.

A glyph's outline

Reading one glyph's outline takes at most 262,144 points or steps.

daeepdf reads glyph outlines itself for color glyphs, which it draws from them as paths, and for underline skip-ink, which breaks an underline where it crosses a glyph. A glyph past 2¹⁸, 262,144 points of a TrueType outline or steps of a CFF one, has no outline: a color glyph's layer built on it draws nothing, and an underline crosses it unbroken. Nothing warns.

A TrueType glyph holds fewer than 65,536 points, but its components, and a CFF glyph's subroutines, can repeat each other and expand a crafted glyph exponentially, which is what the bound stops.

  • Set in: MAX_OUTLINE_WORK = 1 << 18 in src/writer/outlines.ts.
Glyph outlines per document

A document reads at most 2,097,152 points or steps of glyph outlines.

The steps above, for every glyph a document reads, across its fonts: once 2²¹, 2,097,152, are spent, no glyph not yet read gets an outline, with the same effect, color glyph layers drawn empty and underlines unbroken. Glyphs already read keep theirs. Underline skip-ink keeps its own budget of the same size for each layout, and a clip that cuts a line one for each export, past which a glyph is culled by its box instead of its ink. Nothing warns.

The bound is there so many distinct glyphs can't each spend the budget of one.

  • Set in: MAX_DOC_OUTLINE_WORK = 1 << 21 in src/writer/outlines.ts.
A color glyph

Drawing one color glyph takes at most 100,000 steps.

A COLRv1 color glyph is a graph of paints that can share parts, so a crafted one can reach the same paint down 2ⁿ paths. Each paint visited, gradient stop, repeat of a gradient's period, sweep wedge, 32 radial solves and 64 bytes of shading is a step. Past 100,000 steps, or 16 MB of drawing for one glyph, the glyph draws nothing, and its text stays in the PDF, invisible, to be found and copied. Nothing warns.

The bound is there because a few bytes of font can describe an exponential amount of painting.

  • Set in: MAX_PAINT_STEPS = 100_000 in src/writer/colr.ts.
Color glyphs per document

A document spends at most 2,000,000 steps drawing color glyphs.

The steps above, for all of a document's color glyphs together, with 64 MB of their drawing: once spent, each later color glyph draws nothing, its text kept invisible. Nothing warns.

The bound is there so many color glyphs can't each spend the budget of one.

  • Set in: MAX_DOC_PAINT_STEPS = 2_000_000 in src/writer/colr.ts.
A color glyph's paint nesting

A color glyph's paints nest at most 128 deep.

One glyph's paints nest at most 64 deep as the font is read, but a PaintColrGlyph paint draws another color glyph, which brings its own. Drawing caps them all together at 128 levels, and a glyph nested deeper draws nothing, its text kept invisible. Nothing warns.

The bound is there because glyphs that draw each other would otherwise nest without end.

  • Set in: MAX_NESTING = 128 in src/writer/colr.ts.
A color font's layers

Reading one color glyph's paint graph visits at most 100,000 nodes, 64 deep.

As daeepdf reads a COLRv1 glyph from its font, each paint it reaches is a node, a shared one read once. Past 100,000 nodes, or 64 levels, the depth the format suggests, the glyph isn't read as color at all: it draws from the font's COLRv0 layers or bitmaps for it when there are any, else as its plain glyph. Nothing warns.

The bound is there because a layer list can reach itself, and a crafted graph can be huge.

  • Set in: MAX_NODES = 100_000 in src/daegun/colorfonts.ts.
A CFF2 glyph converted to CFF

Converting one CFF2 glyph to CFF takes at most 262,144 steps.

PDF embeds CFF outlines but not CFF2, the PostScript outlines of variable OpenType fonts, so daeepdf's engine rewrites a CFF2 font's subset as CFF, reading each glyph's outline itself so that every step counts: each operand and operator, through every subroutine call. A glyph past 2¹⁸, 262,144 steps, draws empty, its space kept. Nothing warns.

The bound is there because subroutines calling subroutines can make a crafted glyph cost far more than its bytes.

  • Set in: MAX_GLYPH_WORK = 1 << 18 in engine/src/cff.rs.
A CFF2 subset converted to CFF

Converting a CFF2 subset to CFF takes at most 16,777,216 steps.

The steps above, for the whole subset of one font: once 2²⁴, 16,777,216, are spent, each glyph left draws empty. Nothing warns.

The bound is there so many glyphs can't each spend the budget of one.

  • Set in: MAX_WORK = 1 << 24 in engine/src/cff.rs.
A CFF2 glyph's hints

A CFF2 glyph converted to CFF keeps at most 96 stem hints.

Hints help a viewer render small text on a screen; they don't change the outline. Type 2 charstrings, the CFF that PDF embeds, allow at most 96 stems a glyph, so a glyph with more keeps its first 96 and none of its hint masks, its outline whole. Each byte of a hint mask counts as a step toward the glyph's budget, and a hint value too large for a CFF number is left out. Nothing warns.

The bound is the Type 2 format's own.

  • Set in: MAX_STEMS = 96 in engine/src/cff.rs.

Bounds on annotations and on the text written for screen readers. None of them warns but the first, and none changes what the page shows.

A fixed element's links and fields

Links and form fields in fixed content are copied to at most 50,000 annotations per export.

A position: fixed element repeats on every page from its own on, and its links and form fields repeat with it, each copy an annotation in the PDF. The copies of all fixed elements together stop at 50,000: past that, 'limit-reached' warns, and a fixed element whose copies don't fit keeps its links and fields on its own page, while its drawing still repeats. Ten links in a fixed header fit on 4,999 pages here, and not on 5,002.

The bound is there because those annotations grow with the page count, and each is an object in the file.

  • Set in: MAX_FIXED_ANNOTS = 50_000 in src/capture/index.ts.
An accessible name

A form field's accessible name reads at most 32 aria-labelledby ids, and holds 1,000 characters.

A field's name for screen readers, which is also its tooltip in the PDF, comes from aria-labelledby, else aria-label, its <label>, title or placeholder, else its field name. Of aria-labelledby, the first 32 distinct ids are read and the rest ignored, and the name is cut to 1,000 characters, never in the middle of a character. Nothing warns.

The bound is there because the PDF writes the name twice for each field, and a list of ids can be as long as a template likes.

  • Set in: MAX_LABEL_IDS = 32 in src/capture/types.ts.
A fillable field's font

A fillable field's font is embedded whole up to 4,096 glyphs.

A fillable field carries every character its font has, so a reader can type any of them. A font of more than 4,096 glyphs, as Chinese, Japanese and Korean fonts are, carries Basic Latin, Latin-1, Latin Extended-A, common punctuation and the euro sign instead, and 'limit-reached' warns. Any other character typed into one of its fields shows only if the document already uses it in that font.

The bound is there because such a font whole is megabytes, about 2.4 MB for Source Han Sans, added to every PDF with a field in it.

  • Set in: MAX_FIELD_FONT_GLYPHS = 4_096 in src/writer/fonts.ts.

Type to search.