1.2.0 release notes
Released
Highlights
- PDF 2.0. Every export is a PDF 2.0 file.
pdfA: truenow produces PDF/A-4 andpdfUA: truePDF/UA-2, alone or together, and tagged output gains what PDF/UA-2 asks for: one Document root, the PDF 2.0 namespace, list numbering, and structure destinations for links and bookmarks. - Checked with veraPDF and PDFium. Representative documents (text, links and lists, a two-page table, visual effects, forms, 80 paragraphs with a forced break, generated quotes and images, variable font instances, ruby and a page shrunk to fit), each with and without a header and footer, pass PDF/A-4 and PDF/UA-2, alone and together, and PDFium, Chrome’s PDF engine, opens them, follows their links, bookmarks and named destinations, and draws the same pages as poppler.
- Closer to Chrome’s print. This release’s rendering fixes were each measured against what Chrome prints for the same page. Collapsed table borders, filters and masks, list numbering, fixed elements, clipping across pages, dashed and dotted lines, text decorations and column rules now match it, and so do variable fonts at every axis, skip-ink underlines, table rows split across pages, generated quotes and images, and content wider than the page, shrunk onto it.
- Hardened. A full security audit of the sanitizer, capture, images, SVG, fonts and the PDF writer. The sanitizer removes more ways in, a template’s fonts stay with its own export, and every unbounded cost the audit found has a limit.
- A new API.
render,downloadandpreviewtake one options object, checked as you pass it, and an export comes back as a file with its page count and warnings. Margins, string headers and footers, bookmarks from headings, a fallback font, flat forms and canceling are new, and every error has a code. - daegun 2.0.0, and CFF2 fonts. Text is shaped and fonts are subset by daegun 2.0.0. CFF2 fonts, static and variable, are converted to CFF and print in their own faces, under PDF/A and PDF/UA too.
Upgrading
The API is new, and 1.1 code needs changing. Each call takes the HTML, then the filename for download or the container for preview, then one options object, the same for all three:
| 1.1 | 1.2 |
|---|---|
pdf.download(html, 'A4', 'a.pdf') |
pdf.download(html, 'a.pdf') |
pdf.download(html, 'Letter', 'a.pdf', security, extras) |
pdf.download(html, 'a.pdf', { size: 'Letter', ...options }) |
pdf.render(html, size, security, extras), giving bytes |
pdf.render(html, options), giving a file: file.bytes |
previewHTML(html, container, { size, orientation }) |
pdf.preview(html, container, options) |
renderHTMLtoPDF(html, config, options) |
pdf.render(html, options) |
escapeHtml(text) |
pdf.escape(text) |
pdf.name(text) |
pdf.safeName(text) |
orientation: 'landscape' |
landscape: true |
metadata: { title, … } |
title, author, subject, keywords, creator and language as options |
taggedPdf: true |
on by default; accessible: false turns it off |
header: (page, total) => html |
header: ({ page, pages }) => html, or a string |
bookmarks: [{ title, page, y, level }] |
bookmarks: [{ title, target: '#id' or { page, y }, children }], or true |
security: { userPassword, ownerPassword, permissions } |
security: { password, ownerPassword, allow: ['print', 'copy', …] } |
'read-only', 'printable' |
security: { allow: ['print', 'copy'] } |
'fillable' |
security: { allow: ['print', 'copy', 'fill'] } |
'locked' |
security: { allow: [] } |
'open', null |
leave security out |
fonts (a FontBridgeMap) |
removed: declare each font with @font-face |
Behavior you may notice:
-
No encryption by default. 1.1 encrypted every export, allowing only print and copy. A 1.2 file is unencrypted unless you pass
security. -
Tagged by default. Every export is tagged for screen readers, which costs a few percent of time and 5–16% of file size on a short page, more on long text and tables (a 60-row table 29%, 4,000 paragraphs 97%).
accessible: falseturns it off. -
Headers and footers use the template’s fonts: a band no longer needs its own
@font-face. -
A misspelled option, a value of the wrong type or one outside its list throws
invalid-option, naming the closest option. 1.1 ignored it. -
Every error is a
PdfErrorwith acode; a fault in daeepdf itself isinternal, with the original as itscause. -
The language defaults to the template’s
<html lang>. -
PDFs declare version 2.0 (they said 1.7).
-
pdfA: trueproduces PDF/A-4, no longer PDF/A-2a. There is no way to get PDF/A-1, 2 or 3. -
pdfUA: trueproduces PDF/UA-2, no longer PDF/UA-1. -
A PDF/A file has no Info dictionary: its document information is in the XMP metadata alone. Other files keep it, since PDFium and poppler read the title from it.
-
New errors:
- a custom page size with a side under 3 pt or over 14,400 pt
- a document over 10,000 pages, from an export or a preview
- a header and footer that leave less than 3 pt for the content
- a password with control, private-use or invalid bidirectional characters. Passwords are prepared with SASLprep before hashing: ASCII ones are unaffected, and others are normalized with NFKC, so a full-width
ABCopens a file made withABC.
-
A font file over 64 MB, once its
Content-Encodingis decoded, isn’t embedded, with afont-not-loadedwarning. -
ownerPassword: ''is no longer honored: a random owner password is used, as when it’s absent. An empty one let anyone lift the restrictions. -
Leaving
'edit'out ofallowalso withholds page assembly.'annotate'allows filling forms too, as PDF ties them. -
A template’s fonts belong to its export and are released after it. A later export never draws with an earlier one’s fonts, and per-glyph fallback uses only the template’s own.
-
Template sanitizing is stricter:
- obfuscated script URLs and unparseable
hrefandsrcvalues are removed - forms lose
action,formaction,formtargetandtarget - a
<frameset>document becomes an empty page - SVG animation elements are removed, so preview SVGs no longer animate
<meta http-equiv>,<meta name=referrer>andreferrerpolicyattributes are removed- a form control named after an element member daeepdf reads (
id,style,langand the like) gets an automatic field name,fieldN, and such anidon a control in a form is dropped
- obfuscated script URLs and unparseable
-
Of the host page’s
<html>and<body>attributes, onlyclass,style,lang,diranddata-*-theme,-schemeand-modeare mirrored into the page frames. -
Template CSS is rebuilt from the browser’s own parse, so a rule after a stray
}is dropped, as the browser drops it. -
A word too long for its line no longer breaks: it overflows, and a page it reaches past shrinks to fit, as in Chrome’s print. In 1.1, runs of 26 characters or more broke every 25.
-
A template’s
htmlandbodyare two boxes,bodyinsidehtml, as in Chrome.htmland:rootrules style one andbodyrules the other, so abodymargin, border or percentage height is the body’s own, insidehtml’s. The page takes thehtmlbackground, else thebodyone, and an image on it is laid out from the first page’s top left and runs on across pages, as Chrome prints it; it started again on each page. -
A text or choice field is left out, with a
font-not-declaredwarning, when the template declares no font at all, as other text without a font is. It used the viewer’s Helvetica, which wasn’t embedded. Checkboxes and radio buttons need no font. -
A fillable text or choice field embeds its font whole, so a PDF with fields is larger by that font once, about 100 kB for Inter. See Fixed.
-
Tagged output:
<strong>and<em>areStrongandEm, as in Chrome’s tagged print. -
A background gradient is laid out as an image is, by
background-size,-position,-repeatand-origin, as Chrome prints it. It was stretched once over thebackground-clipbox. A gradient on a box with a border now has the padding box’s size and repeats under the border, as in Chrome. -
A
background-attachment: fixedlayer is laid out on the exporting window’s viewport at the top of each page, and painted only there, as Chrome prints it. It was laid out on each whole page. Onhtmlorbody, the page’s background runs on across pages, as a scrolling one does. -
Variable fonts lay out and print at the location Chrome uses, optical size included, so text in Inter no longer sets wider than in Chrome’s print. Each location the document uses embeds an instance of its own.
-
Pages lay out on Chrome’s print geometry, the paper rounded up to whole points and then whole CSS px (A4 is 795 × 1123 px), so a line can wrap and a page end can fall a little differently.
-
Content wider than the page is laid out again, up to 1.5 times as wide, and shrunk onto the page, as Chrome’s print does; before, it was cut at the page’s right edge. Its pages hold more, so a document can have fewer.
-
Limits on what an export draws:
- images over 50 megapixels are skipped
- rasters past 64 megapixels per export, and
<canvas>snapshots past 16 megapixels, are skipped with a warning; natively embedded PNGs and browser-decoded images count toward the 64, once per export - raster fallbacks over 16 megapixels are scaled down to fit, and filter and mask rasters are drawn at 216 dpi (was 288)
- a background tiling past 2,000 draws is drawn as pattern blocks
- a color glyph past its own or the document’s work budget, or an SVG past 500,000 visits, draws nothing or goes raster
- shadows stop at 32 layers per element, and past 50,000 blur steps a blurred layer draws solid
- a table header or footer isn’t repeated when it’s hidden, taller than a quarter of the page, or more than 200 elements
- images under a filter or mask count their full decoded size toward the 64 megapixels, and color bitmap glyphs (sbix, CBDT) count too, drawing their outline past it
- a
clip-pathrepeated on the pages its box spans copies at most 1,000,000 path segments per export; past that, later ones clip to their bounding box - a background or mask draws its first 32 image layers, and an export’s background tiles past 100,000 draw as blocks
- a mask or border image JPEG whose header says more than 50 megapixels is skipped
- a color glyph whose paint nests deeper than 128 levels draws only its invisible text
- a fixed element’s links and fields are copied to at most 50,000 annotations per export; past that they stay on their own page, with a warning
- an accessible name reads at most 32
aria-labelledbyids and 1,000 characters - a fillable field’s font of more than 4,096 glyphs carries only its Latin characters, with a warning
-
An export waits for its host stylesheets, fonts and images against one 10-second deadline, not 10 seconds each, with the usual warning. What is still loading then is canceled and left out, and a file the export gave up on isn’t waited for again in its later bands and layouts.
-
Under
pdfA, a CMYK JPEG without its own color profile is embedded as the browser decodes it, in sRGB. -
Page breaks follow Chrome’s print more closely, so page counts can change:
- a break on an inline box or a float no longer starts a page, nor does one with only padding, borders or margins above it at a page’s top
- a box keeps its top margin after a forced break
- a forced break inside a row, a box avoiding breaks, or a flex or grid container splits it there instead of moving it whole
- cells, cells without a row, row groups and table headers carry their breaks as Chrome’s do
- a table’s header repeats on every page the table continues onto, and with its footer around a row split across pages
- a table row crossing a page’s end splits there, as Chrome splits it, rather than moving whole
- a line moves when its line box crosses a page’s end, and a box’s top margin is cut at an unforced break
- a box ending right at a page’s end no longer carries its bottom margin onto the next page’s top, where Chrome truncates it
- flex and grid containers break row by row rather than moving whole
-
Vertical text rises by 0.85em and centers on its column, list markers’ digits are tabular, and outside markers hang from the item’s border box, as Chrome prints them.
-
A stacking context with a blending descendant is drawn as an isolated transparency group, a form, so the blend mixes only with what the group draws.
-
A link to the page’s own address with a fragment jumps inside the PDF, and one whose target no element has makes no link, as in Chrome.
-
Tagged output: an
<a>that gets no link annotation is no longer aLinkelement. -
Preview cards past ten pages fill as they near the viewport.
-
The engine,
daegun.wasm, is 3.0 MB, up from 1.7 MB. -
The bundle,
dist/index.js, is 758 kB, up from 428 kB. -
daeepdf has one dependency, kokyu, from me. An install brings it along.
Added
- Page margins,
margin, as one length or per side, in pt or as'20mm','1in'and the like, on every page; content reaching into them is clipped, as in Chrome’s print. Headers and footers sit inside them. - A template’s
@pagerule sets the size, orientation and margins, as Chrome’s print reads it, unless an option sets them. - Lengths in
mm,cm,in,ptandpxfor the size, margins and bookmark positions. headerandfooteras plain HTML strings, as well as functions of{ page, pages }.bookmarks: truebuilds the outline from theh1toh6headings, nested by level. A bookmark can point at an element’s id, and nests bychildren; one pointing at a missing id is left out with a warning.fallbackFont: text in no declared font is laid out and printed in it, instead of being left out. Headers, footers and the preview use it too.fillable: falseprints form fields flat, as they show, in the page’s own content, accessible and PDF/UA-2 conformant.signalcancels an export with anAbortSignal, and a long export keeps the page responsive.loadTimeoutsets how long an export waits for fonts, images and stylesheets.shrinkToFit: falseleaves content wider than the page at its size.useAppStyles: falselays the template out without the app’s stylesheets.strict: truethrows on any warning.- An export’s warnings, each with a code, on the returned file and on a
stricterror. PdfFile: the bytes, the page count, the warnings,blob()anddownload(name).- The preview takes the export’s options, so it shows margins, headers and footers as they print.
pdf.downloadadds.pdfto a filename without it.- Every option shows its default and units on hover in an editor.
- Tagged output (by default, and under
pdfAandpdfUA):- one
Documentelement at the root, and every element in the PDF 2.0 namespace - an element without a structure type of its own is a
Spanwhen it’s inline or inside a paragraph, heading or span, else aDiv(it was always aDiv) - inline content straight under the body, or in a
Divunder it, is wrapped in aP; a link around blocks leaves them to its parent <caption>is aCaption, and the header and footer rows a table repeats on later pages are artifacts- an element under a filter or mask keeps its structure, and its text can be copied, drawn invisibly over the raster
- lists carry their numbering: Disc, Circle, Square, Decimal, the roman and alphabetic styles, else Ordered or Unordered
- form widgets carry
/Contentsbeside their tooltip <strong>and<em>areStrongandEm;<b>,<i>and<span>staySpan, as Chrome tags them- generated content with alt text after a
/incontentis aFigurewith that alt text, its images the figure’s; an empty one marks it decorative - structure destinations: a
#fragmentlink names its target element beside its page, and so do the open action, bookmarks and, underpdfUA, named destinations. A target with no element of its own (an empty anchor or box, a blank page) names the tagged content at its spot. Page destinations stay for readers older than 2.0, Chrome’s PDF viewer among them.
- one
- CFF2 fonts, static and variable, embed as CFF converted by the engine, their hints carried: each glyph’s stems and masks, and each Font DICT’s hint values. They print in their own faces in poppler and Preview and pass PDF/A-4 and PDF/UA-2.
text-decoration-thickness: from-fonttakes the font’s underline thickness at the run’s variation location, painted in whole px as Chrome paints it.- Text under a bidi override (
unicode-bidi: bidi-overrideorisolate-override, U+202D or U+202E) draws in the order Chrome’s bidi gives it, each piece shaped in its forced direction, in a line, down a column and under a filter. column-ruleis drawn: centered in each gap between columns with content, as tall as the content box, in every border style.contain: paint,strictandcontent, andcontent-visibility: auto, clip asoverflow: clipdoes.- Gradient color hints (
red, 30%, blue) move the blend’s midpoint, as CSS Images 4 curves it. list-style-imagemarkers, and::markercontentwith counters and its own font and color.image-set()backgrounds, drawn from the highest resolution.color()in every predefined space (a98-rgb,prophoto-rgb,rec2020,xyz), andnonecomponents.<select multiple>writes each chosen option, and a text stroke keeps its own alpha.font-feature-settings,font-variant-numeric: tabular-numsand@font-facesize-adjust, in the PDF and under a filter or mask.mix-blend-modemixes only within its isolated group, in the PDF and under a filter or mask, and SVG children blend.- SVG
vector-effect: non-scaling-stroke,stroke-miterlimit,stroke-dashoffset, and a stroke’s own opacity. content-visibility: hiddendraws the box without its content, and a closed<details>only its summary.image-set()and gradient list markers,image-set()masks and border images, and masks of several layers.- List boxes (
<select size>over 1,<select multiple>) show their visible options. - Variable fonts draw where Chrome’s print draws them: each run at its own location (weight, stretch and slant within its
@font-facerule’s ranges, italic asitalorslnt, the optical size from the glyph size, then the rule’s and the element’sfont-variation-settings), with bold and an oblique synthesized where Chrome synthesizes them. font-kerning, everyfont-variant-*value andtext-renderingturn on the OpenType features Chrome turns on, in its order. Caps use the font’s own features where it has them, and are synthesized otherwise.text-decoration-skip-ink: underlines and overlines break where glyphs cross them, as Chrome breaks them.- Ruby text spreads across its base by
ruby-align. - The CSS
clipproperty. - Quotes in generated content:
open-quote,close-quote,no-open-quote,no-close-quoteand thequotesproperty,autotaking Chrome’s marks for the language. A<q>prints its quotation marks. - Images in generated content:
url()images and gradients in::before,::afterand::marker, sized as Chrome sizes them. - A
<details>without a<summary>shows the default one, labeled as Chrome labels it in the browser’s own language: of Chromium’s translations, the one that lays out as Chrome’s default summary does. - Table rows split between pages as Chrome splits them.
- Content wider than the page shrinks onto it, as in Chrome’s print, and the preview shows the same pages.
Changed
- The library goes by daeepdf, the name it’s published under: errors and warnings start with
[daeepdf], and a PDF’s Producer saysdaeepdf 1.2.0. The docs stay at zztaeha.dev/daepdf. - PDF 2.0’s deprecated entries are gone:
/ProcSet,/NeedAppearancesand the Adobe extension entry for AES-256, which is native to 2.0. So is the PDF/UA extension schema in XMP, which PDF/A-4 doesn’t ask for. - Embedded fonts: FontBBox is the box of the subset’s own glyphs, and Flags says Symbolic when the subset maps a character outside Standard Latin, as PDF defines it. PDFs are 0.3 to 1 KB smaller from smaller font programs.
- Counter styles follow CSS Counter Styles 3 (
upper-greekis decimal, as in Chrome). - A template’s body padding and border sit inside the page, and
remfollows the template’s root. - Images are fetched once per export, not kept in a cache across exports.
- An SVG with a CSS filter, mask or clip-path, or with repeating, reflecting or
href-linked gradients, is drawn raster. - Stream dictionaries are written on one line.
- A drawing repeated on many pages, a fixed element’s copies or an SVG spanning pages, is written once as a form and shown on each page.
- CSS gradients interpolate premultiplied everywhere, the canvas included, and stops past either end are cut at their color there. SVG gradients stay straight.
- Blurred box shadows follow the Gaussian Chrome draws, and inset shadows with an offset draw the strip past it.
- Bookmarks are go-to actions, and a CFF font’s Type0 name carries its CMap (
-Identity-H). - Embedded font programs keep only the tables a PDF reads.
- What a clip hides is left out of the PDF, as Chrome’s print leaves it out: a paint wholly outside it, each glyph outside it, a link’s area past it, and a form field it hides.
- A line whose glyphs reach past a page’s edge prints on both pages, as in Chrome.
- Underlines and overlines paint under the text and a line-through over it, and a link’s area is rounded to whole CSS px.
- An SVG with
<use>nested past twelve levels is drawn raster, as Chrome draws it, rather than leaving out what lies deeper. - Streams and PNG data go through kokyu, daeepdf’s first dependency, in place of its own zlib: output within 2% of 1.1’s (2.2% smaller to 1.4% larger on a font, an image and text), compressed 1.3 to 5 times faster.
- A tagged PDF’s structure tree is written in compressed object streams: tagging 4,000 paragraphs adds 97% to the file, where writing the tree plain added 650%.
Fixed
Pages, headers and footers
- A template’s
bodyor:rootbackground covers every page, and its own<html>and<body>dir,lang,classandstyleapply. - Forced breaks on empty elements and on a last child take effect, and orphans and widows count lines, an inline image or SVG as one.
- Header and footer bands reserve the tallest page’s band, and content below a band’s own height no longer shows in it.
- Fixed elements, as Chrome’s print places them:
- they add only the page their top falls on to the count, not the pages their height runs into
- they show on each page from the one their top falls on, never on pages above
- inside a transformed, filtered or contained box they draw once
- Page-bottom gaps stay blank under author styles.
- A fixed element paints where its z-index and tree order put it, and its copies are cut by the clip-paths and masks around it on every page, as Chrome’s print cuts them.
- Which boxes hold their fixed descendants matches Chrome’s print:
container-typeno longer does,transform-style: preserve-3dandoffset-pathdo, and an inline box or a table row never does. A mask lets its fixed descendants repeat. - A fixed element taller than the content gives the preview the export’s page count.
- The preview no longer adds an empty page when the last block’s bottom margin runs past a page’s end; it gives the export’s page count.
- A line, box, row or image ending a fraction of a px past a page’s end moves to the next page, as Chrome’s print moves it, where daeepdf let it end up to half a px past.
- A turned box reaching above the document’s top no longer moves down in a document of several pages.
- A fixed box’s copies are cut by the containing blocks Chrome cuts them by, and paint where their stacking context paints.
- A contained
htmlorbody(anycontain,content-visibility, a size container) keeps the body’s background to the body’s own box, as Chrome does. contain: painton a template’shtmlorbodyclips what overflows it, padding included, as on any box, andbody’soverflowis the page’s whilehtml’s is visible, so it clips nothing there.- A
<summary>, or the default one, that a page’s end would cut moves to the next page with its<details>, as Chrome’s print moves it; a spacer before it was laid out after it. A closed<details>’ hidden content takes no page breaks. - A long document no longer cuts a line in half on every page past the 300th: the page-break pass is bounded by the document’s pages.
break-beforeandbreak-after: avoidandavoid-page(andpage-break-*: avoid) keep boxes together, the break moving back to the latest one allowed, as Chrome’s print moves it.- A
break-inside: avoidbox taller than a page starts the next page before it splits. - A forced break on a flex or grid item breaks at its whole row, as Chrome’s print does.
- A multi-column box crossing a page’s end fills its columns up to the end and goes on at the next page’s top, a numbered list in it counting on, where each page held the top of every column.
- A box whose writing mode differs from its parent’s, such as a vertical box on a horizontal page, moves whole to the next page where a page’s end would cut it, and one taller than a page starts a page and is sliced across the ones after, as Chrome’s print does. It was cut through, a plain one’s vertical lines broken as horizontal ones, and a vertical line running past a page’s end lost its rest.
Layout and painting
- CSS
rotate,scaleandtranslateare drawn. - Clipping:
- clipped content no longer draws on pages its clip never reaches, and leaves the tagged tree with its links
overflowno longer clips an inline box, or a positioned descendant whose containing block is outside the boxclip-pathclips each page’s piece of the element on its own, as Chrome’s print doesdisplay: contentsignoresoverflowandclip-path
- An element under a CSS filter or mask draws everything it would without one: SVG content, child opacity, one-sided borders, transforms, clip paths, overflow clips,
url()backgrounds, shadows and overflowing content. Links and form fields under a filter stay live. A filter and a mask together are filtered, then masked, andclip-pathapplies after the filter. - Dashed and dotted borders, outlines, underlines and column rules follow Chrome’s pattern, fitted so a side starts and ends on a dash. A square dashed outline dashes side by side.
border-image: overlapping widths scale down by one factor, andborder-image-widthpercentages are of the border image area, outset included.- A transform, containment or overflow on a box it doesn’t apply to (an inline box, a table row or row group, ruby) is ignored, as in Chrome.
- An element with a 3D transform prints where it would untransformed, as its warning says: its boxes and text came out at Chrome’s projection of each before, the text slanted.
- An absolute box inside a masked element is masked with it.
- Double, 3D and dashed outlines, double borders, and a border’s sides in one color, rounded or not, print as Chrome draws them, with no seam at the miters.
- Shadows and decorations draw on first letters, vertical text and markers; an outer shadow under a transform keeps its part past the page, and a blurred square corner is soft.
- Oversized
inset()radii are clamped as Chrome clamps them, and repeating radial gradients repeat to the box’s corners. - Background layers:
- gradients are sized, placed and tiled as images are (see Upgrading), each tile’s shading drawn in place, so tiles stay vectors and line up in every viewer
background-blend-modeblends each layer with the color and the layers under it, in a group of their own, as Chrome paints thembackground-attachment: localon a scroll container lays the layer out on what it scrolls, painted inside its padding box- an image moved past its
background-clipbox is clipped to it
- Paint order follows CSS’s phases, as Chrome’s: floats over block backgrounds, inline content over both, outlines over the content they surround.
outline-style: autodraws Chrome’s focus ring. - The first
box-shadowlisted is on top, and a broken inline’s shadow is sliced across its lines as Chrome’s print slices it. - An element with
opacityormix-blend-modeis composited as one group, so its overlapping contents no longer show through each other and a blending element’s children don’t blend with each other.opacity: 0leaves the element out, text and links too. zoomin a template scales text, borders, shadows and transforms with the boxes.overflow-xor-y: clipclips one axis, andoverflow-clip-marginis read.filter: url(#id)draws through the SVG<filter>it names; aurl()naming none is passed over and the rest of the list applies.clip-pathclips tourl(#id)naming a<clipPath>, to a box on its own and toshape().- Masks:
mask-mode: luminanceis read,mask: url(#id)masks by an SVG<mask>, a mask whose layers all fail leaves the element unmasked, andmask-composite, old-webkit-keywords included, composites as Chrome’s print does. transform-boxis read on HTML boxes.- A
box-decoration-break: cloneblock’s background is laid out on the whole box on each page, as Chrome’s print lays it out. - Column rules draw in vertical writing modes.
- A double border, outline, column rule or collapsed table border splits into stripes of whole px, as Chrome’s print splits it.
Tables
- Collapsed borders: one border per grid edge, chosen as CSS 2.1 resolves them and centered on the line, with Chrome’s halves at a page break, repeated header and footer rows, 3D styles and right-to-left tables. They paint above the parts’ backgrounds, and the table’s overflow clips its parts’ backgrounds but not its borders.
- A row’s, row group’s or column’s background shows only behind its own cells.
- A collapsed table and its cells take no
border-image. - A
tfootrepeats at the end of each page a table breaks from, and repeated headers keep their styling. - A rowspan crossing a page break keeps the later cells and the repeated header in their columns: the spanning cell is cut and continues on the next page.
rowspan="0"and spans past their row group follow Chrome’s grid. - Counters don’t count in repeated header and footer rows.
- Collapsed borders on continuation pages are page 1’s resolved ones, shared across the break, and repeated headers and the rows under them sit where Chrome puts them.
- A split row’s other cells sit where Chrome aligns them.
- A split row’s repeated header and footer no longer move the table’s own footer down, and a cut row’s border against a repeated footer is drawn as Chrome draws it.
- A split row’s repeated header and footer show what lies under the table there, as Chrome’s print does: the page’s background, then each box’s from the body down to the table, background images included, each where its own box puts it. It was one flat color.
- In a collapsed table, a part moved off the grid (a relative offset or a transform on it, its row or its group) paints its background inside its borders, on its cells’ padding boxes, as Chrome does.
- A
visibility: collapserow prints as Chrome prints it: hidden, its content’s height (not a specified one), with no border spacing after it. - A collapsed table’s row cut at a page’s foot keeps the line along its top on that page. When most of the row fell on the next page, the line was drawn there, above that page’s top, and no page showed it.
- A table’s background and border paint on its grid, not around its captions.
- A separated table’s repeated header starts at the page’s top whatever its
border-spacing.
Text and fonts
- Underline, overline and line-through take Chrome’s thickness and positions,
doubleandwavyincluded, down a vertical column too. A wavy line is Chrome’s wave: its wavelength, height and phase. ::first-letterand list markers fall back per glyph to a font that has it.- Text that falls back to one other font throughout draws in that font, in either direction.
contentstrings decode CSS escapes.- A multi-format
@font-faceregisters its TTF, OTF or TTC entry. - Disabled host stylesheets no longer apply.
- Vertical text in a font without
vmtxcenters on its column and steps by the font’s own vertical advances. - Vertical text takes the orientation Chrome gives it: under
text-orientation: mixed, Latin and other horizontal scripts turn a quarter clockwise while CJK and most symbols stand upright (UAX #50), anduprightandsidewaysapply as named. A turned run’s shadow turns with it, and skip-ink cuts its underline. writing-mode: sideways-rlandsideways-lrset their lines in columns with every character turned,sideways-lrread bottom to top, decorations and shadows those of the turned line.text-combine-upright: allsets its text upright in one cell of a vertical line, in the font’s half-, third- or quarter-width glyphs (hwid,twid,qwid) where they fit, else scaled across, as Chrome does.- Right-to-left text in a column (Hebrew, Arabic) runs the other way along its line, ordered as Chrome’s bidi orders it, a left-to-right stretch inside it included.
- A
::beforeor::aftermatched by an author’sspanrules draws once, with its own counters, and its text under an author!importantrule draws. - SVG text draws in its instanced faces with
size-adjustand the metric overrides. - Where a page break moved the first text set in a font, that font’s text no longer draws above its lines.
- A CID-keyed CFF color font’s layers draw at their true size, and accented glyphs built with
seacdraw. - Every space Chrome lays out is drawn, as Chrome draws it, so readers that take text from a tagged PDF’s content (Acrobat, screen readers through it) read words apart: where a styled run meets the next (“Somebold” read as one word), and between words in justified, preserved, word-spaced and right-to-left lines. None is drawn where a line wraps, as in Chrome. The glyphs stay where they were.
- Text
unicode-bidi: bidi-overridesets against its letters’ own direction carries its text as written, so copying and screen readers read “over ride”, not “revo edir”. - A template’s CSS keeps its own declaration text when scoped, so layered background and mask values and a
var()shorthand followed by its longhands no longer lose values. - A template rule on
spanno longer moves daeepdf’s baseline probes, which madespan { position: absolute }text vanish. font-size-adjustsets the drawn size.text-shadowis drawn as a shape, blurred as Chrome blurs it, so a reader gets each word once.paint-orderputs a text stroke under its fill.text-align-lastjustifies a last line, andfont-variant-alternates’ functions shape with the alternates@font-feature-valuesnames.text-underline-positionsets an underline clear of the descenders, where the font puts it, or on a vertical column’s right, Japanese and Korean text’s default there;text-underline-offsetmoves a column’s underline too.- Left-to-right words in a right-to-left paragraph sit where Chrome’s bidi puts them, trailing marks included.
text-transformcases text in its language (Turkishigivesİ);capitalizedoesn’t, as in Chrome.text-overflow: ellipsisellipsizes any overflowing line, underpreand right to left too, keeping the space before the cut.- Transparent text stays in the PDF’s text, drawn invisibly, as Chrome’s print keeps it.
- Clipped text, and the line after a
-webkit-line-clamp’s last, leave the PDF’s text by each glyph’s ink, as Chrome culls them. - Each glyph’s width in the PDF is exact, no longer rounded to a thousandth of the em, so a reader’s glyph box ends where the glyph does: letter-spaced text read as “tex t” in pdftotext where Chrome’s read whole.
- Synthesized small capitals copy as the letters typed and are set at Chrome’s size.
- A mark the font moves off its letter’s pen sits where the font puts it: Arabic dots and vowel marks in fonts that build them as marks (Noto Sans Arabic among them), an accent combined with a letter that has no precomposed form, a mark stacked on another. Each was drawn at the pen, after or beside its letter.
- Text drawn with several glyphs for one cluster copies once: a letter with a combining accent, Devanagari vowel signs and conjuncts, Arabic letters drawn as a body and its dots. Each glyph copied the whole cluster, so “q́” read “q́q́” and Hindi words repeated syllables, and after “q́” every q copied with the accent in readers that skip ActualText, pdf.js among them. Each glyph now stands for its own characters, and a cluster they can’t spell in order, or whose marks the font moves over or under their letter, carries its text in /ActualText, which keeps it in order in poppler and PDFium (they read glyphs by where they land). A glyph with no character of its own, such as an Arabic letter’s separate dots, copies as U+034F, which shows nothing.
Lists and counters
- List items are numbered by the
list-itemcounter in document order, so wrapped items, reversed and nested reversed lists, and authorlist-itemcounters number as in Chrome. li valueandol startfollow HTML’s integer rules, 0 and negatives included.- Roman counters past 3999 print as decimal.
counter-setapplies aftercounter-increment.- Inside and outside markers sit where Chrome draws them, in either direction, whatever the line’s alignment.
- A marker whose
contentmixes strings and images lays its parts out as Chrome’s bidi does, so in a right-to-left list they run right to left, each string piece shaped in its own direction. contain: stylescopes counters as Chrome does, and acontent-visibility: autobox’s contents print.
Images and SVG
- SVG shapes take geometry and transforms set by CSS, from a style attribute or a stylesheet,
d: path()included, in inline SVGs and SVG files. - Gradients: an id two gradients share resolves to the first, as
getElementByIddoes; a gradient reads only its own stops; nested gradient references paint as Chrome’s. - Paint in a style attribute follows CSS: the last declaration,
!importantand invalid values. - An SVG without a
viewBoxis sized as Chrome sizes it, stroke lengths take units, and an invalid transform list draws untransformed. - SVG backgrounds use their intrinsic size.
- Content outside an SVG’s viewport is clipped, path data draws up to its first error, and
d="path(...)"draws nothing, as in Chrome. - Dashed circles and ellipses start at 3 o’clock, zero-width strokes draw nothing, hidden shapes don’t print, an SVG image’s root opacity applies, and
<switch>content prints. - An inline SVG keeps what its stylesheet sets, on
<defs>,<symbol>and sprite content a<use>draws too, withcurrentColor, font-relative values and custom properties resolved where the<use>stands. - Radial gradients scale with their
gradientTransform, a gradient fill set on a group reaches its shapes, and a<use>cycle draws nothing. - A non-scaling stroke in a rasterized SVG or an SVG mask is as wide as on the vector path.
url()paint written asURL(, with spaces or with a fallback color is read asurl(is.paint-orderputs an SVG shape’s stroke under its fill, and a stroke under a scale that differs by axis stretches with the shape.- A stylesheet’s 3D transform on an SVG shape draws by its 2D part, as Chrome draws it.
Forms, links and PDF output
- Links with
%-escapes are no longer double-encoded. - Form controls without their own font draw in the surrounding one.
- Textarea appearances wrap.
- Nested bookmark
/Countvalues follow the spec. - The raster budget warning names PNG images too.
- Repeated table rows, row backgrounds and collapsed borders page by their row’s edges, and a cell’s orphaned lines move inside the cell.
- A forced
break-afterreaches intodisplay: contents, andcounter-set: list-itemnumbers as in Chrome. text-transform: capitalizesees the word across inline boxes, and a space between two decorated boxes is decorated.- An inline
<svg>paints its own box, keeps sprite transforms, and pivots transforms about its user space. - A mirrored image stays mirrored under a filter, and percentage SVG opacities and zero dash lists draw as Chrome draws them.
- Under
pdfAandpdfUA, XMP metadata drops the characters XML can’t carry; the Info dictionary keeps them. - A file with more than 10,000 compressed objects spreads them over several object streams.
- Under
pdfA, a profile-less CMYK JPEG in fixed content is sRGB on every page, embedded once. - An
appearance: nonecheckbox or radio draws no check mark; its field keeps its value. - A reader can type any character a field’s font has. The field’s font held only the characters the document drew, so others typed showed as boxes in Chrome’s viewer and not at all in others. A font of more than 4,096 glyphs, as CJK fonts are, carries its Latin characters instead.
- A figure’s alternative text is its accessible name (
aria-labelledby,aria-label,alt, thentitle), as Chrome’s tagged print takes it. keywords: []writes no Keywords entry, and blank keywords are left out.
Exports and previews
loadTimeoutis one deadline for every load (the app’s stylesheets, font files, images), not one after another.- An
<img>still loading atloadTimeoutis left out with an'image-skipped'warning. - A detached preview container throws
'container-detached'at any length, checked where the pages go in. pdf.previewstops at itssignal, keeping the pages it would have replaced, and an export aborted while its PDF is written rejects with'aborted'.- A bookmark past the last page is left out with a warning, its children moved up a level.
- A
pdfUAtitle of only spaces throws'missing-title'. safeNamereads its argument as a string, and a header or footer throwing a string or number passes it to the caller as it is.
Security
- An export can no longer be made to run or allocate without bound:
- the CSS
url()reader no longer backtracks exponentially, and SVG attributes and missing<use>targets are no longer read in quadratic time - nested SVG
<use>references are bounded by one budget, as are color glyph programs, per glyph and per document - content clipped inside an overflow box counts toward the 10,000-page ceiling
border-imagecrops,<canvas>snapshots, shadows, wavy decorations, tilings (gradients included) and repeated table rows are capped, and a hugecolumn-countcosts only the columns with content- an inline SVG with text no longer carries its own copy of the font file
- a glyph whose contour ends don’t increase has no outline
- long fallback and
extendschains of@counter-style, collapsed tables of huge spans, many column backgrounds, long text-field words, long grapheme clusters, heavy COLR gradients and color lines of many stops all cost about their size - the zlib match search is bounded, as zlib’s own is
- a CFF2 font’s conversion to CFF counts its steps: 2,000 crafted glyphs over 200 KB of subroutines took 68 s and now take 0.18 s. A glyph carries at most Type 2’s 96 stems, each hint mask byte counts as a step, and a hint value past a number’s range is left out.
- the CSS
- A server that holds a request open can no longer hold an export: every network wait has a deadline.
- An
<img>or<form>name can’t stand in for a frame document member, a blank or fragmenthrefno longer points at the host page, and template-keyed lookups ignore inherited names. - Image bytes shared across exports are compared, not only hashed.
SECURITY.mdlists the whole sanitizer, the engine on daegun 2.0.0 with its CFF2 conversion, every limit above, and the password and permission rules under Upgrading.- New limits, listed under Upgrading: fixed elements’ annotation copies, image layers and background tiles, mask and border image JPEGs, color glyph nesting, accessible names, fillable fields’ fonts, and fonts over 64 MB.
- Path data,
aria-labelledbylists and color lines cost about their size. Arguments the engine has no room for are an error, not a trap, and an engine that traps is dropped and started anew. SECURITY.mdsays what tagged output keeps of text under a filter or mask: it is written invisibly over the image, so ablur()hides nothing from the PDF.
Performance
- A fixed element many pages tall is copied per page, not per span: over a 3,000,000 px page it exports in 117 ms and 0.8 MB, where 1.1 took 16.3 s and 43.1 MB.
- A block spanning many pages breaks at all its page ends in one layout: one block of 10,000 lines exports in 2.8 s, down from 10.2 s.
- A template’s
@font-facefamilies are read once per capture. - An image or font that never answers costs one 10-second wait per export, not one per page band or layout.
- With default options the benchmark fixtures export in 50 to 100 ms median in headless Chrome, where 1.1’s took 84 to 108 ms, most of the difference 1.1’s default encryption. Like for like, unencrypted and untagged, most take the same time; a 60-row table takes 17 ms more, content wider than the page about 33 ms more, laid out a second time as Chrome’s print does, and a page with a fillable field about 17 ms more, embedding the field’s font whole.
- Page breaks that match Chrome’s cost time on long documents: 4,000 short paragraphs export in 0.62 s untagged, where 1.1 took 0.45 s, and a page of 2,000 fixed elements in 186 ms, where it took 96 ms.
- A variable font used at several weights or styles embeds an instance for each, as Chrome prints them: a page of regular, bold and italic text is about 2 kB larger than in 1.1.