-
renderToStream in @inkoxide/render/browser: the PDF as a web ReadableStream<Uint8Array>
in 64 KiB chunks, for a Response (in a service worker, say) or to write to a file the user
picked (showSaveFilePicker(), then stream.pipeTo(await handle.createWritable())). As in
Node, the stream starts once the PDF is ready, and a failed render rejects the promise. It
takes the browser's render options, signal and timeoutMs too.
-
Local files in the browser. <Image src> takes a Blob, such as a File from
<input type="file"> or a drop, directly or as what a function or promise src resolves to;
it is read when the render loads its images, once per render however many images use it.
Font.register({ src }) takes a Blob too: two different Blob objects are different
sources, so registering a face again with another one throws, and with the same one does
nothing. ImageSrcValue and FontSrc include Blob. This works in Node as well.
-
Threads from a CDN. When @inkoxide/render and @inkoxide/wasm are served from another
origin than the page, which cannot start a worker from such a script, the render entry's
engine worker and the pool's threads (thread.js) start as a worker of the page's origin from
a blob: URL that imports the script. The CDN must serve the scripts and assets with CORS; on
a cross-origin isolated page its files need CORS or Cross-Origin-Resource-Policy: cross-origin; a Content Security Policy needs worker-src blob:. Scripts of the page's own
origin start workers as before. Bundlers still see new Worker(new URL(…, import.meta.url)).
examples/browser/tests/cdn.spec.ts tests it in Chromium, Firefox and WebKit.
-
Threads in the browser. On a page that is cross-origin isolated, @inkoxide/render/browser
renders on a pool of Web Workers that share the engine's memory: its threads option is
'auto' by default (the number of cores, at most 8), and engineStatus().threads says how many
the engine got. The PDFs are the same bytes as on one thread. The engine alone renders a 98-page
report about 2.9 times as fast on 8 threads (in Node); a React document gains less (1.3 times
for a 43-page report in Chromium and WebKit). @inkoxide/wasm ships a second module, inkoxide-threads.wasm, which
init(source, { threads }) loads and starts a pool for, and threadCount(); elsewhere it loads
the one-thread module as before. A bug in the engine on a pool thread ends the render's worker,
and the render fails with INTERNAL.
-
A Tailwind build plugin, so that a browser need not load Tailwind's compiler. In client
bundles, inkoxideTailwind() (Vite, Rollup, Rolldown) and inkoxideTailwindEsbuild() from
@inkoxide/tailwind/plugin point @inkoxide/tailwind at @inkoxide/tailwind/precompiled,
which reads a table of the classes the sources use, scanned at build time: the Tailwind
JavaScript a page downloads goes from about 90 KB to about 6 KB with brotli, and styles are
the same. Server bundles keep the compiler. A class the scan does not see fails as an unknown
class, with a reason that says so; the plugin's safelist keeps classes put together at run
time. inkoxideTailwindWebpack() is the plugin for webpack 5 and Rspack (builds that target
Node keep the compiler; each build, and in watch mode each rebuild, scans again), and
withInkoxideTailwind(nextConfig) the one for Next.js 15.3 or later, with Turbopack (the
default in Next.js 16) and with next build --webpack; server bundles keep the compiler. Next's
Turbopack has no hook to scan again, so next dev scans when it starts, and a class that is
new since then needs a restart or a safelist entry. The plugins also read the theme's
@source directives (from cssFile or css): directories, files and globs, @source not,
@source inline("bg-red-{100..900..100}") and @source not inline(…), and source(none) and
source("…") on @import "tailwindcss", with paths relative to the CSS file that has them. A
Vite dev server scans again when the theme file, or a CSS file it imports, changes.
-
Vertical SVG text and SVG text on a path. writing-mode (vertical-rl, vertical-lr, tb,
tb-rl, sideways-rl, sideways-lr) lays text down a column, CJK upright in its vertical
forms with the font's vertical metrics and Latin sideways, by text-orientation (or
glyph-orientation-vertical) and the Unicode vertical orientation of each character.
<textPath> sets text along a path or basic shape, or its own path data, with
startOffset and side. Both read in order when the PDF's text is extracted. SVG text also
takes font-feature-settings, font-variant and font-kerning. @inkoxide/render has
<TextPath>, writingMode on SVG <Text>, and textOrientation, fontFeatureSettings,
fontVariant and fontKerning on SVG text. Vertical text goes along a path too, upright
characters standing across it. A column of upright characters is one run of PDF text, in a
vertical (Identity-V) font over the same embedded font. The text paths of an SVG with more
than 100,000 segments in all fail with INVALID_IMAGE, as does an SVG's text with more than
64 different sets of font features or a span with more than 32 features; the SVGs of a render
with more than 64 sets in all fail with IMAGE_ERROR.
-
Font properties set on an SVG <use> reach the text it copies, as in browsers: the copy is
laid out with them (up to 64 such copies an SVG).
-
className and style on the shapes and text inside an <Svg> (@inkoxide/render): the
classes take fill-*, stroke-*, stroke-<n>, opacity-*, a text colour and the font
utilities, style the SVG attributes CSS sets, and both win over the attributes, as in CSS.
fill-*, stroke-* and stroke-<n> on the <Svg> set the paint its drawing inherits.
@inkoxide/tailwind reads fill, stroke and stroke-width (fill, stroke and
strokeWidth in the flat style, which @inkoxide/style lists as SVG_ONLY).
-
Tagged PDF and PDF/UA-1. The render option tagged writes a structure tree in document
order: paragraphs, headings, lists (with the numbering their labels show), sections, figures
with their alternative text and bounding box, tables with header cells and spans, links that
say what they are, form fields and annotations; the links and images with alt in a paragraph
are elements in place among its text. Everything else (backgrounds, borders, headers and footers,
as pagination artifacts, fixed elements, repeated header rows, images with alt="", in text
too) is marked as decoration. Every glyph maps to text, and extraction reads each cluster once.
pdfUA writes PDF/UA-1, with its metadata and without .notdef glyphs, and refuses a document
without a title, a language, alternative text on its images (in text too), labels on its fields
(in headers too), headings in order or lists made of items (UA_CONFLICT). New PDF/A levels
2a and 3a are tagged. Nodes take role, figure boxes alt, table cells header and fields
label; @inkoxide/render takes them as props (the Role type is exported), with
<Document tagged pdfUA> and conformance="PDF/A-2a". The CLI takes --tagged and
--pdf-ua. Untagged output is unchanged.
-
PDF/UA-2 (ISO 14289-2:2024), on PDF 2.0. RenderOptions::with_pdf_ua_part(PdfUaPart::Ua2)
(Rust), pdfUA: '2' (Node, WASM and @inkoxide/render; true and '1' are still PDF/UA-1;
the type PdfUaPart is exported), <Document pdfUA="2"> and --pdf-ua=2 write the structure
elements in PDF 2.0's namespace and link to structure destinations. The checks for a title,
a language, alternative text, labels, headings and lists are those of PDF/UA-1 (UA_CONFLICT);
a link within the document or a bookmark that goes to decoration (a fixed node, or one with the
role artifact) is refused too, as it has no element to go to. A box with a link holds what
is inside it in its link, which PDF 2.0 does not let hold a paragraph, so the roles inside it
make no elements: a link on a heading's runs keeps the heading.
PDF/A-1, -2 and -3 are older than PDF 2.0, so PDF/UA-2 does not combine with PDF/A: that is
refused (INVALID_ARGUMENT at options.pdfUA in JavaScript). veraPDF checks the output.
-
Structure elements in object streams. In tagged output with compression on, other than at
PDF/A-1b, the structure elements and the parent tree are packed into object streams (up to 128
objects each) and the file ends with a cross-reference stream instead of a table: a tagged
100-page report goes from 1.31 MB to 0.65 MB. Encrypted files encrypt the streams as a whole.
Untagged and uncompressed output is unchanged.
-
Tagging the parts of SVG images. In tagged output, an element of an SVG image (a group, use,
shape, image, text or a) with aria-label, or else a <title> child, is a figure of
its own with that text as its alternative text, inside the image's figure (and inside the
figure of a part that contains it); an element with aria-hidden="true" is decoration.
Only the outermost SVG counts, and only elements that are drawn: not those inside defs,
symbol, clipPath, mask, marker, a pattern, a gradient or a filter. Inside a group
drawn in a layer of its own (with opacity, a mask, a blend mode, isolation or a clip path
other than one path), a part is a figure only when it is all the group draws, as a shape with
opacity is. Each placement of such an image is a form XObject of its own. An image that is no figure of its own (inside a
paragraph's box, say) keeps its alternative text as before and its parts are not tagged.
An element with an empty id, or one from an entity without an id, is no part. Untagged
output draws the same. veraPDF checks PDF/UA-1, PDF/UA-2 and PDF/A-2a.
-
File attachments. A document's attachments are files the PDF carries (from the render
option attachments, or base64 data), listed in the viewer's attachments panel; attachment
nodes and runs show an icon (a push pin, a paper clip, a chart or a tag) that opens one, and
meta.pageMode takes useAttachments. Under PDF/A-3b they are associated files, and
meta.xmpExtensions declares and fills in XMP schemas, such as the metadata a Factur-X or
ZUGFeRD e-invoice declares (the output passes veraPDF's PDF/A-3b profile; it is not checked
with a Factur-X validator); PDF/A-1b, 2b and 2a refuse attachments, and 3a allows them. New validation codes
UNKNOWN_ATTACHMENT, ATTACHMENT_NOT_REGISTERED and ATTACHMENT_TOO_LARGE. Rust takes an
AttachmentStore in RenderOptions::attachments, whose insert_too_large registers a file
over AttachmentStore::MAX_FILE_BYTES (64 MiB) by its size alone; the CLI takes
--attachments <DIR>, whose files are named by their file name, and does not read one over
the limit: a document that uses it fails with ATTACHMENT_TOO_LARGE. @inkoxide/render
takes <Document attachments xmpExtensions>, <Attachment>, facturX() and
facturXRelationship().
-
Variable fonts. inkoxide accepts TrueType (gvar) and CFF2 variable fonts, and a font
declaration takes source (the registered font it draws with) and variations (axis values):
text is shaped and measured at that instance, and the PDF embeds it as a static TrueType
subset, never the variable font. Font.register takes a weight range (fontWeight: [100, 900]) and fontVariationSettings, and styles and Tailwind's [font-variation-settings:…]
take fontVariationSettings. @inkoxide/style exports parseFontVariationSettings and the
types FontVariationSettings and FontVariations, and @inkoxide/react exports
fontVariationsValue. An axis the font does not have is left out, with a warning. A variable
font with more than 63 axes or an avar table of version 2 is refused, and so is one whose
outlines the instancer cannot vary (CFF with CFF2, or glyf without gvar). A declaration
takes at most 16 axes, and a document at most 64 declarations with variations. The
WebAssembly engine grows by about 140 KB with brotli, for the instancer.
-
@media for the page size. @inkoxide/react style objects take '@media …' blocks, and
@inkoxide/tailwind the page variants sm: … 2xl:, max-sm: … max-2xl:, min-[…]:,
max-[…]:, portrait:, landscape:, print: and [@media(…)]:, and a theme's
@custom-variant under one or several @media. A query reads the page's width and height
(margins included), aspect-ratio and orientation; features of screens (hover,
prefers-color-scheme) are errors, and so is a mistake in a block or class for another page
size. Each element's queries are answered for its page before layout, so the engine and the
schema do not change. @inkoxide/react and @inkoxide/render export the MediaStyle type, a
style object with @media blocks (StyleProp stays without them, so a style typed as object
still passes).
-
inkoxide: PdfALevel implements FromStr ("2b".parse()), with ParsePdfALevelError; the
CLI and the Node and WebAssembly bindings read the level through it. An unknown pdfA level in
the bindings now says (expected one of 1b, 2b, 2a, 3b, 3a); pdfA also takes true or false.
-
The inkoxide and inkoxide-cli crates have their crates.io metadata: a README each, the
licence, keywords and categories. The packages leave out the tests and benchmarks, which read
fixtures outside the crate.
-
@inkoxide/render: <Svg> and <Canvas> take alt, as <Image> does.
-
textWrap: 'balance' (text-balance): the lines of a heading or a caption come out about
as long as each other. Each stretch between forced breaks is broken first fit into as many
lines as wrap gives, in the narrowest width that keeps that many; a stretch of one line or
more than 10, beside a float, or with a word wider than its line breaks as wrap.
-
hyphenationPenalty (a style, and a prop of <Text> in @inkoxide/react and
@inkoxide/render, which rejected it): how much textWrap: 'pretty' avoids breaking at a
hyphenation point, 0 to 10 000, default 50, as TeX's \hyphenpenalty. From 10 000, a word is
never broken at a hyphenation point, whatever textWrap.
-
shapeOutside and shapeMargin on floats (a style; shapeOutside and shapeMargin in the
style prop of @inkoxide/react, as CSS strings or objects; [shape-outside:…] and
[shape-margin:…] as Tailwind arbitrary properties): the lines beside a float wrap around a
circle, an ellipse, a rounded inset or a polygon in its margin box instead of the box, as CSS
shape-outside with a basic shape. The float is still placed, and boxes beside it narrowed,
by its margin box. @inkoxide/style has parseShape.
-
flexGrow and justifyContent in a box with floats: the room a box of known height leaves
goes to auto margins, else to the children that grow, else around and between the children
as justifyContent says, as in a column box. flexGrow on a float itself is refused.
-
Romanian hyphenation (ro, ro-MD). hyph-utf8's Romanian patterns have no licence, so the
engine hyphenates Romanian by the syllable rules of DOOM2: a hyphen goes only between the
consonants that separate two vowels (ca-li-ta-te, în-tre-prin-de-re, sculp-tor,
func-ție), never between vowels, with ș/ț written with a comma or a cedilla. It works in
every build, @inkoxide/wasm included, with no file to load; patterns registered for ro still
take precedence.
-
Form fields: sort (the options of a select or list in alphabetical order), edit (a select
that takes a typed value besides its options), noSpell (no spelling check, on a text field
or a select with edit) and align (left, center or right: where the value of a text,
select or list field goes in its box, in the appearance and as the field's /Q). They are
props of the field components of @inkoxide/react and @inkoxide/render.
-
An icon for notes: note (the default), comment, key, help, newParagraph,
paragraph or insert, written as the annotation's /Name and drawn into its appearance; a
prop of <Note>.
-
Colour emoji from SVG-in-OpenType fonts (the SVG table, its documents plain or gzipped, one
glyph each or many in one), with currentColor and context-fill taking the run's colour.
COLR v1 sweep gradients draw around their centre, with every stop, and its composite modes
draw as they say: the blend modes (multiply, screen, color-dodge and the others) and the
Porter-Duff ones (src-in, dest-out, xor and the others; plus as screen). They drew
with the sweep's first colour, and as src-over.
-
Variable fonts: optical sizes, widths and ranges. Text in a font with an opsz axis draws at
the optical size of its font size, each size an instance of its own, unless the declaration
sets opsz or the new opticalSizing: "none". A font declaration takes stretch (its width,
a percentage) and weightRange and stretchRange, as CSS @font-face does: SVG text is
matched by font-stretch too (the family, then the width, the style, the weight, as CSS
does) and draws at its own weight and width within the ranges. At most 64 such instances per
declaration, and 1024 in a document. @inkoxide/react and @inkoxide/render have
fontStretch in styles, on SVG text and in Font.register (a width or a range, [75, 100],
drawn at its wdth), and @inkoxide/tailwind reads font-stretch-*. An instance's
FontBBox holds its own outlines; it was the default instance's, which a heavy instance can
exceed.
-
PDF/A-1b takes images with alpha. One whose alpha is only clear or opaque, as a GIF's
transparency, is written with a stencil mask, which PDF/A-1b allows; it was refused. The new
flattenAlpha render option (flatten_alpha in Rust, <Document flattenAlpha> in
@inkoxide/render, --flatten-alpha in the CLI) draws images with partial alpha on white at
PDF/A-1b, instead of failing with PDFA_CONFLICT, whose message names the option. Other
levels keep the alpha.
-
Validation that knows the render: validate_with_options in Rust, and an options argument
to validate in inkoxide and @inkoxide/wasm (the object render takes), report what a
render with those options would refuse: what the PDF/A level or PDF/UA does not allow
(PDFA_CONFLICT, UA_CONFLICT), attachments missing from them, and their invalid
creationDate or encryption. The CLI's validate takes --pdf-a, --pdf-ua,
--flatten-alpha and --attachments for the same.
-
Unicode passwords. A password is prepared with SASLprep (RFC 4013), as PDF 2.0 asks, and
written as UTF-8, at most 127 bytes once prepared: letters of any script work, and a password
typed composed or decomposed (ä, a + ◌̈) is the same. Passwords were printable ASCII.
Text SASLprep refuses (control, private-use or unassigned characters, mixed-direction text)
is INVALID_VALUE at its path, without the password. Its Unicode tables add about 50 kB with
brotli to the WebAssembly module.
-
An entropy encryption option (Encryption::with_entropy in Rust, encryption.entropy and
<Document entropy> in JavaScript): 16 to 256 random bytes mixed into the derived keys, so
renders of the same document and passwords differ and cannot be compared. entropy: true
draws 32 bytes with crypto.getRandomValues for each render. Without it, encrypted output
stays deterministic.
-
tw.warm(classNames, units) in @inkoxide/tailwind takes the units a render passes to tw(),
to warm class strings with page variants or em, vw and vh values; without them such a
string was an error.