zztaeha

All versions

1.1.0 release notes

Released

Highlights

  • Templates lay out at page size (issue #2). Every template renders inside a page-sized iframe, so @media queries, vw/vh and srcset follow the PDF page instead of the browser window. The same template now gives the same PDF on any screen, phone included. Your app’s own stylesheets still apply, evaluated at page size.
  • Much closer to what the browser shows. Painting order follows real stacking contexts. Synthetic italic, small caps, 3D borders, list markers, line clamping and ellipsis, soft hyphens, multi-column text, clip-path, masks, border-image and SVG all match Chrome and WebKit far more closely.
  • PDF/UA. A new pdfUA: true option produces PDF/UA-1 (ISO 14289-1) accessible PDFs, alone or together with PDF/A. Every tagged export gains proper accessibility structure.
  • Checked with veraPDF. Representative documents (text, lists, multi-page tables, links, forms, images, transparency, headers and footers, right-to-left and CJK text, vertical text, emoji, filters and masks, a 30-section document) pass PDF/A-2a, 2u and 2b and PDF/UA-1. The previous release failed all of them.
  • Color fonts in color. COLRv1 fonts such as current Noto Color Emoji and Nabla print as full-color vector art (gradients, blends, variable paints) matching Chrome, where they printed as one-color outlines. Every color glyph, bitmap emoji included, copies and searches as its real characters in every reader, Preview included.
  • Sturdier and faster. Form fields print, wide-gamut images keep their colors, emoji no longer bloat files, large documents capture several times faster, and default encryption is about 25× faster.
  • A new engine, built from source. Text is shaped and fonts are subset by daegun 1.2.0, through a small wrapper in engine/ that rebuilds reproducibly from this repository; the old engine was a binary this repository couldn’t rebuild. PDFs come out about a fifth smaller (CJK about 40%), exports run faster, and static CFF2 fonts print.

Upgrading

Nothing in the JavaScript API was removed. Behavior you may notice:

  • Responsive templates now pick the breakpoint of the page, not of the window. A grid that showed four columns on a wide screen now shows what an A4-wide viewport shows. This is the fix for issue #2, but it changes output for templates that relied on the old behavior.
  • previewHTML returns a Promise (it returned nothing). Code that ignores the result is unaffected.
  • Moving a preview container in the DOM reloads its page frames; the pages stay blank until the next previewHTML call.
  • PDFs declare version 1.7 (they said 1.6).
  • With custom permissions and no ownerPassword, the owner password is now random. An empty one let anyone lift the restrictions. An explicit '' is still honored.
  • pdfA: true no longer produces an encrypted file by default.
  • pdf.warmup() is optional: rendering starts the engine itself.
  • The engine file is daegun.wasm, exported as daeepdf/daegun.wasm; daeepdf/daepl.wasm is gone. A build step that copies or preloads the engine by name needs the new name.
  • The engine download is 1.7 MB (629 KB gzipped), up from 820 KB (326 KB gzipped).
  • The engine needs WebAssembly reference types: Chrome 96 or Safari 15, both from 2021. Safari 15 was already required.

Added

  • pdfUA: true (on renderHTMLtoPDF options and pdf.render extras): declares PDF/UA-1, implies taggedPdf, shows the document title in viewers, and throws without metadata.title. Combines with pdfA and with encryption.
  • Tagged output (taggedPdf, pdfA, pdfUA):
    • backgrounds, borders, decorations and other non-content drawing are marked as artifacts, and headers and footers as pagination artifacts, so screen readers skip them
    • list items hold their marker as a label and their content as a body
    • table header cells carry a row or column scope
    • SVG graphics are tagged as figures, with alt text from aria-label or <title>; alt="" marks an image as decorative; under pdfUA, figures without alt text are counted in a console warning
    • links carry a description and form fields an accessible name (from aria-labelledby, aria-label, <label>, title or placeholder, in that order)
    • each link and form field sits in its own Link or Form structure element, header and footer ones included, and annotations tab in structure order
  • COLRv1 color fonts: every paint format (solid colors, linear, radial and sweep gradients with pad, repeat and reflect, transforms, clip boxes, reused glyphs, all composite modes), drawn as vector art from the font’s own outlines, TrueType or CFF. Variable color fonts follow the text’s weight and optical size. A repeated glyph is drawn once and reused, except one needing a soft mask, which Preview can’t place when shared.
  • tel: links become real links, alongside http(s): and mailto:.
  • Untagged exports are unchanged by all of the above.

Changed

  • previewHTML renders one page-sized frame per page and returns a Promise that resolves once the pages are on screen. Rapid calls render only the newest.
  • The preview waits for fonts before measuring, so its page breaks match the PDF’s (it could cut a table row the PDF kept whole), and it keeps a page-sized viewport inside a container scaled with CSS zoom, in WebKit too.
  • A relative link (/pricing, terms.html) resolves against the page’s address and stays clickable.
  • Encrypted exports use key salts every reader decrypts, including veraPDF, which miscounts rounds on about 1% of AES-256 files.
  • Embedded fonts carry only the tables a PDF reads: outlines, metrics and hinting. Layout tables (GSUB, GPOS, morx) are left out, and so are a TrueType font’s cmap and name.
  • An embedded font is named by its PostScript name, with a variable font’s instance (InterVariable-Bold), where it showed the family name.
  • A variable font’s descriptor (cap height, bounding box) follows the weight in use.

Fixed

Layout and painting

  • Positioned and z-indexed elements paint in CSS stacking order across any depth, not just among siblings. Negative z-index goes under the flow.
  • Background url() layers paint in their CSS slot (under the border and later layers, above the background color), the template’s own body background image is drawn, and background-repeat: round/space tile correctly.
  • A calc() value resolves instead of being dropped, in:
    • background-size
    • border-radius
    • clip-path points and radii
    • background and gradient positions
  • clip-path geometry boxes (padding-box, content-box, …) are honored.
  • Box shadows:
    • keep their full strength under a translucent background
    • follow the element’s opacity and blend mode
    • inset shadows paint above background colors, gradients and images
    • transparent box and text shadows paint nothing (they drew dark rings and a second copy of the text)
  • inset, outset, groove and ridge borders draw with the browser’s light and dark shades instead of as solid.
  • Rounded boxes with mixed border colors keep their round corners.
  • RTL inline boxes wrapped across lines put their borders on the correct sides.
  • mix-blend-mode reaches images, background tiles, SVG shapes and numbered list markers.
  • Forced page breaks from the app’s own stylesheets apply even to short content. recto/verso breaks work.
  • Transformed elements past page 1, and transforms and gradients under a header or footer, land in the right place.

Text and fonts

  • Bold text no longer prints in the italic face when a family has italic faces registered.
  • Italic text in a family with no italic face is slanted, as browsers do, and oblique from 14deg picks an italic face, as Chrome does.
  • font-variant: small-caps and its variants are synthesized like Chrome.
  • word-spacing reaches the PDF.
  • RTL, centered and right-aligned text no longer overruns its box when letter-spaced.
  • text-overflow: ellipsis works in Safari exports and respects word spacing and small caps. -webkit-line-clamp ends its last line with an ellipsis.
  • A word broken at a soft hyphen (&shy;) prints the hyphen, and the next line starts with the right letter.
  • Text in multi-column layouts no longer merges across columns.
  • Text after a fallback-font character or an emoji no longer drifts when letter-spaced.
  • Text in a fully transparent CSS Color 4 color (oklch(… / 0), color(… / 0)) is invisible instead of black.
  • Vertical text keeps the transparency of an rgba() color.
  • Text using glyphs the font lacks no longer references a missing font, which some readers refused, and copies as its real characters (it copied as repeats of the first missing one).
  • Inline SVG text uses the template’s font instead of a serif fallback.
  • Right-to-left text falls back to another font for characters its font lacks (digits in a Hebrew-only font), placing each run where the browser draws it.
  • ❤️ and other characters followed by the emoji presentation selector use the family’s color font, as browsers do, including fonts like Noto Color Emoji that map the selector only through a variation-sequence table.
  • Color glyphs copy and search as their characters in every reader, Preview included: a COLR glyph copied once per color layer and a bitmap emoji (Apple Color Emoji) not at all. Flags, skin tones and joined sequences copy whole.
  • COLR v0 layers in translucent palette colors keep their transparency (they printed opaque).
  • Bitmap emoji from CBDT fonts (the bitmap Noto Color Emoji common on Linux and Android) sit where the browser draws them; they printed one image height too high.
  • Glyph advances at a variable font’s weight round half up, as OpenType specifies; an advance that fell on a half unit came out one unit narrower.
  • Arabic-Indic digits (١٢٣) print in the right order, inside Arabic text and at the start of left-to-right lines.
  • Text whose font draws several characters with one glyph (Arabic letters sharing a base shape, Ω and the ohm sign) copies and reads aloud as the right characters.

Lists and counters

  • Bullets and <details> triangles are drawn as shapes, so fonts without those glyphs no longer matter.
  • In RTL, markers sit on the right, and numbers read .1.
  • <ol reversed>, string list-style-type values ('→ ') and lower-greek all render correctly; an unknown counter style falls back to decimal.
  • counter(list-item) returns the item’s number.
  • counters() separators can contain commas or parentheses.
  • A sibling’s counter-reset replaces the counter instead of nesting a new one.
  • ::before/::after content sits where the browser draws it, including block and flex-item pseudo-elements.

Images, SVG, filters and masks

  • Wide-gamut (Display P3, Adobe RGB) JPEG and PNG images embed their ICC profile and print with the right colors; WebP and AVIF are converted to sRGB as the browser shows them.
  • Images are waited for before capture, so slow and srcset images no longer go missing, in headers and footers too (a logo still loading was left out).
  • An SVG served without a .svg extension is recognized.
  • Inline SVG:
    • CSS-styled fills, group opacity and named colors render
    • display="none" shapes stay hidden
    • <use> with <symbol> sprites draws
    • embedded data: images are kept
    • transparent and rgba() fills, strokes and gradient stops keep their alpha
    • gradients interpolate as browsers paint SVG
    • shapes filled or stroked with gradients the vector path can’t draw (user-space or href-chained, as Figma, Illustrator and Inkscape export) are rasterized instead of vanishing or turning black, and fill-rule inherits from groups
  • Gradients:
    • a fade to transparent keeps its hue
    • radial gradients default to an ellipse and honor px positions
    • conic gradients keep a px-positioned center and their from angle
    • interpolation clauses (in oklab) no longer break direction
    • implicit stop positions follow CSS
  • Elements with filter or mask-image rasterize with the template’s fonts, real text layout and gradient backgrounds, and blur and drop shadows keep their full size instead of being cut at the box edge.
  • url() masks follow mask-size, mask-position and mask-repeat (including round’s aspect ratio) instead of stretching.
  • A cross-origin border-image no longer aborts the whole export.
  • border-image repeat/space edge tiles and the fill middle are placed and scaled correctly.
  • Form fields print. They carried no Print flag, so their values were left out of print.
  • Unstyled controls draw like the browser’s native controls instead of a bevel, and unchecked checkboxes and radios show their box.
  • Read-only and disabled controls stay read-only in the PDF.
  • Password fields show bullets and never write the value.
  • Selects are combo boxes that show the option text, not its value.
  • A select sits where the browser lays it out; depending on when its font loaded it could land half a pixel off, so the same template gave different PDFs.
  • Textareas are multiline.
  • Same-named fields get unique names.
  • Links and form fields:
    • stay aligned with their content under a header or footer
    • follow CSS transforms
  • Named destinations for #anchor links are sorted, as PDF readers require.

PDF output, tagging and PDF/A

  • PDF/A output is never encrypted by default.
  • In PDF/A and PDF/UA, characters no registered font covers are left out (with a warning) instead of drawing the forbidden missing-glyph box; the line keeps its spacing and the text still copies.
  • PDF/A metadata mirrors every document information entry, with the same creation date.
  • The document language is written to the catalog, where readers look for it.
  • Embedded font subsets carry unique subset tags.
  • CFF-based OpenType fonts (common for CJK) are embedded with the correct font-file type, and variable CFF2 fonts print (they were embedded as TrueType and drew nothing).
  • Static (non-variable) CFF2 fonts print; the export failed with “missing CFF”.
  • Emoji fonts no longer embed their bitmap tables: a PDF with a few emoji from Apple Color Emoji dropped from 113 MB to 59 KB.
  • ToUnicode maps no longer cross byte boundaries.
  • Font sizes are written as proper PDF numbers.
  • Text after a clip spanning two pages keeps its font.

Engine and API

  • pdf.render() works without calling warmup() first.
  • An export in a hidden page no longer waits for the page to be shown: one started in a background tab paused until the tab came back, and one in a hidden webview (a hidden Tauri window on macOS) never finished.
  • Concurrent initialization no longer loses fonts registered in between.
  • The preview and the PDF agree on page count, including trailing blank space.
  • The missing-font warning points to the real fix (@font-face in the template).

Performance

  • Large documents capture much faster: 2000 paragraphs drop from 1.6s to 0.3s, 2000 list items from 3.0s to 0.4s, and a 1500-row bordered table from 17.1s to 1.0s.
  • Default encryption is about 25× faster (AES and SHA-512 rewritten): writing an encrypted PDF takes 32–60ms instead of 0.9–1.5s.
  • The bundle is about 5 kB smaller after a dead-code sweep.
  • The new engine shapes and subsets faster. Repeat exports in Chromium (median of five): 2000 paragraphs 711 → 620 ms, 2000 list items 698 → 588 ms, a 1500-row table 1207 → 1134 ms, a CJK page 298 → 175 ms, an Apple Color Emoji page 556 → 182 ms. The first export with Apple Color Emoji is slower, 897 ms against 548 ms: the engine copies the whole font once before its first subset.
  • PDFs are 5–46% smaller, 23% across the test corpus: about 42% for CJK and 46% for Apple Color Emoji.

Docs

README:

  • API reference entries for previewHTML and renderHTMLtoPDF, and the HTMLToPDFOptions and FontBridgeMap types.
  • How rendering works, with media queries and vw/vh following the page, and how app stylesheets apply to templates.
  • The live preview API.
  • pdf.warmup() is optional.
  • Links and phone numbers.
  • The sanitizer.
  • The owner-password default, and PDF/A’s rule on encryption.
  • Filter and mask limits rewritten to match the current painter, including mask sizing.
  • CORS needs for cross-origin mask and border-image sources.
  • The accessibility section, renamed “Accessibility, PDF/A and PDF/UA”: what tagging covers, the pdfUA option, what veraPDF checked, and how characters no font covers are handled.
  • Color fonts: COLRv1, COLR v0 and bitmap fonts print in color and copy as text; the emoji selector picks the family’s color font.
  • daepdf runs in Electron and Tauri windows (only their Node or Rust side can’t run it), and exports finish in hidden windows and background tabs.
  • CFF2 fonts print, static or variable, but don’t pass PDF/A or PDF/UA validation yet.
  • Text prints only in fonts the template declares, now said outright (Fonts, Troubleshooting), and every complete example declares its font: Quick start, Basic structure, headers and footers and the form example printed no text as written.
  • A header or footer needs its own @font-face; naming a font only the main template declares prints it with the wrong layout.
  • The Vue/Nuxt example’s export button enables once the import lands (it kept the function in a non-reactive variable).
  • How it works says which part is Rust: the WASM engine shapes text and embeds fonts; the PDF itself is written in TypeScript.
  • How the engine file reaches the browser: Vite and webpack 5+ (and the frameworks built on Vite) ship daegun.wasm with the build; with esbuild it has to be copied.
  • pdf.render()’s size is optional (default 'A4'), and its iframe example compiles under TypeScript 5.7+, which types a Uint8Array by its buffer.
  • Troubleshooting names the functions that are named exports and lists what the default export holds.

SECURITY.md: the engine is built from engine/ over daegun from crates.io and rebuilds reproducibly; it was a binary that couldn’t be rebuilt.

Tests

  • The test runner now awaits async tests. Before, it marked them passed without running their assertions.
  • 22 empty tests and ten empty hash tests were replaced or removed; hashing and AES are now checked against Node’s crypto.
  • A shared real-browser harness was added, with a regression test for nearly every fix: 343 tests in total (178 before).

Known limits

  • Firefox has not been tested; Chromium and WebKit have.
  • A mirrored app <link> stylesheet that never finishes loading stalls the export.
  • A preview’s hidden measuring frame stays in the page until the next previewHTML call after its container is removed.
  • Under PDF/A or PDF/UA, a run made only of characters no font covers draws nothing, so copying skips it.
  • COLRv1’s additive PLUS composite has no PDF equivalent and is drawn as Screen, which is slightly darker where both layers overlap.
  • CFF2 fonts, static or variable, don’t pass veraPDF under PDF/A or PDF/UA: the engine’s conversion to CFF leaves out glyph widths. pdf.js also draws a CFF2 font whose em isn’t 1000 units at the wrong size (fix upcoming, below).

Upcoming

  • CFF2 fonts will pass PDF/A and PDF/UA and draw at the right size in pdf.js. daegun converts CFF2 to CFF without glyph widths and without a FontMatrix for a font whose em isn’t 1000 units; the fix belongs in daegun and ships with its next release.
  • The first export with a large static font (Apple Color Emoji) will be as fast as later ones: daegun copies a static font whole before its first subset.

Type to search.