zztaeha

CSS properties

202 properties daeepdf 1.2.0 reads from the browser's computed style to draw the PDF, found in its source by the compiler, so none is left out.

Every other property still shapes the PDF through the layout: daeepdf reads where the browser put each box and line, so grid-template-columns or text-indent print as Chrome lays them out without being read here.

Boxes and layout

Chrome lays the template out and daeepdf reads where every box and line landed, so most of these properties reach the PDF through that layout and print as Chrome places them. daeepdf reads them itself only to measure a box, to decide where a page breaks, or to order what paints over what: a box's place and size always come from the layout, never from its width or top. Each entry says what the read is for, and where the result differs from Chrome's print.

display

Decides what is printed at all, how a box paints, and where a page break may fall.

An element with display: none prints nothing, and neither does anything inside it: no box, no text, no link, no form field, no image fetched, and no counter reset or incremented. display: contents makes no box, so the element's children print but its own background, border, overflow, clip-path, filter and mask-image don't apply, as in Chrome.

An inline box paints its background, border and shadow on each line it wraps onto, cut as box-decoration-break says. Containment and overflow don't apply to an inline box or to a table row, row group or column, and a transform doesn't apply to an inline box; daeepdf ignores them there, as Chrome does.

For page breaks, a forced break-before or break-after takes effect only between block-level boxes in flow (block, list-item, flow-root, table, flex, grid, table rows and row groups), as in Chrome's print, and not on an inline-level box, a float or a display: contents element itself. Flex and grid containers split row by row.

The table displays are also read to resolve collapsed borders and to show a row's, row group's or column's background behind its own cells, and list-item to draw a marker.

import pdf from 'daeepdf'

const html = `<style>
  @font-face { font-family: Inter; src: url('/fonts/inter-var.ttf'); }
  body { font: 12pt Inter; }
  .internal { display: none; }
</style>
<p>Invoice 1042, due 30 June</p>
<p class="internal">Note to self: check the rate</p>`
const file = await pdf.render(html)
// The note isn't in the PDF, not even as hidden text.
position

Read to keep out-of-flow boxes out of page breaks, to repeat fixed boxes on every page, and to order painting.

absolute and fixed boxes are out of the flow, so a page break never moves one: what an absolute box holds past a page's end prints on the next page. relative and sticky boxes print where the layout puts them.

A fixed box repeats on every page, in the same place, as Chrome's print repeats it. It is laid out once against the page's content area, so bottom: 0 puts it at the foot of every page, and its links and form fields repeat with it. Each copy paints where its z-index and tree order put it among that page's content, cut by the clip-path, clip and masks around it. A box with a transform, a filter, containment or a matching will-change holds its fixed descendants instead, and those print once, where they are.

A box positioned other than static paints in a layer of its stacking context, by z-index, and a fixed or sticky box always makes a stacking context. clip applies only to absolute and fixed boxes. An overflow box clips an absolute descendant only when it, or a box inside it, is that descendant's containing block, as CSS has it.

In a collapsed table, a row, row group or cell that position: relative moves off the grid paints its background inside its own borders while the table's borders stay on the grid, as Chrome draws it (see top).

import pdf from 'daeepdf'

const lines = Array.from({ length: 60 }, (_, i) => `<p>Line ${i + 1}</p>`).join('')
const html = `<style>
  @font-face { font-family: Inter; src: url('/fonts/inter-var.ttf'); }
  body { font: 12pt/18pt Inter; }
  .stamp { position: fixed; right: 0; bottom: 0; }
</style>
<div class="stamp">Confidential</div>${lines}`
const file = await pdf.render(html)
file.pages // 3
// "Confidential" prints at the foot of all 3 pages.
top

Read only on a relatively positioned table part, to tell whether it moved off its table's grid.

daeepdf takes every box's place from the layout, so an offset by top reaches the PDF through it, as Chrome places the box, and daeepdf doesn't read the value for that.

It reads it itself on a table row, row group or cell with position: relative: an offset by top or left, or a transform, on the part or a row or group around it, has moved it off the table's grid. In a collapsed table its background then paints inside its own borders, on its cells' padding boxes, and the collapsed borders stay where the grid has them, as Chrome draws them.

left

Read only on a relatively positioned table part, as top is.

Like top, it places a box through the layout, and daeepdf reads it itself only to tell whether a relative offset moved a table part off its grid, where in a collapsed table the part's background paints inside its own borders.

float

Read to keep floats out of forced page breaks and out of their ancestors' text decorations.

A float prints where the layout puts it. A break-before or break-after on a float is ignored, as in Chrome's print, since forced breaks fall only between boxes in flow.

An ancestor's text-decoration doesn't reach into a float, as CSS has it, so an underline on a paragraph doesn't underline a floated note inside it. A floated ::first-letter sits in its own box, and daeepdf puts its baseline at an estimate from the middle of that box rather than reading the font's.

A float paints after the flow's block backgrounds and before its text, as one, as CSS orders it and Chrome paints it, so where a later block runs under a float, the float is on top (see z-index).

z-index

Orders the painting of positioned boxes, and of flex and grid items, within their stacking context.

A box with position other than static, or a flex or grid item with a z-index, paints in a layer of the nearest stacking context: negative layers first, under the flow, then the flow, then the other layers by z-index, equal ones in tree order. A positioned box with z-index: auto paints among the layers at 0 and makes no stacking context. Each copy of a fixed box paints where its z-index puts it on its page.

A z-index other than auto, where it applies, makes the box a stacking context, as do opacity below 1, mix-blend-mode, isolation: isolate, clip-path, a transform, paint or layout containment and the matching will-change names. A stacking context with a blending descendant is drawn as an isolated group (see isolation).

Within the flow, daeepdf paints in CSS's order, as Chrome does: every in-flow block's background and border, then the floats, then the text and inline boxes, inline-blocks and flex and grid items each as one, then the outlines, then a stacking context that isn't positioned, with the layers at 0. So where boxes overlap in the flow, such as one pulled up by a negative margin, the earlier box's text lies over the later box's background, and each phase keeps the clips around what it paints.

width

Not read for an HTML box, whose width daeepdf measures from the layout; read for SVG geometry.

A box is as wide as Chrome laid it out, so width, min-width, max-width and box-sizing print as Chrome sizes the box. The template lays out at the width of the page's content area: the page less its margin, or less the template's @page margins as Chrome's print reads them.

Content that reaches past the page's right edge lays the page out again that wide, up to 1.5 times, and shrinks it onto the paper, as Chrome's print does; shrinkToFit turns that off. Content a box clips, and a position: fixed box, don't count toward that width.

daeepdf reads width itself on SVG elements: the computed width of a <rect>, <image>, <use>, <svg> or <foreignObject> in an inline <svg> goes onto the drawing as its attribute, so a size a stylesheet gives it holds.

height

Measured from the layout for an HTML box; read for SVG geometry and a few repairs at page breaks.

A box is as tall as Chrome laid it out. One taller than the space left on its page runs on to the next, its background and border drawn as one shape the page's edge cuts, or as one box per page with box-decoration-break: clone.

daeepdf reads the value itself in three places: the computed height of a <rect>, <image>, <use>, <svg> or <foreignObject> in an inline <svg>, written onto the drawing as width is; an empty box of fixed height that a split table's repeated header or footer cuts, which grows by that band so the rest of it starts below; and a pseudo-element whose content is an image, which keeps the height you gave it, as Chrome sizes the image by it.

vertical-align

Read on table cells, to place a split row's content where Chrome's print places it.

Where inline boxes and text sit on a line comes from the layout, so vertical-align there prints as Chrome lays it out. daeepdf reads the value itself only on table cells.

When a page's end splits a row, Chrome's print sets the content of the row's middle and bottom cells from the top, and a cell spanning into the row from above stays where it is. daeepdf holds those cells' content in the same places as the break grows the row.

align-items

Read on a flex or grid container a page's end splits, to keep aligned items where Chrome's print keeps them.

Items print where the layout put them. When a page break grows a flex line or a grid row, an item placed by alignment, by its own align-self or its container's align-items (center, end, baseline and the rest), keeps its place from the row's start, as Chrome's print keeps it, rather than centering again in the taller row. Items with normal or stretch grow with the row.

align-self

Read with align-items on the items of a flex or grid row a page's end splits.

An item's own value wins over its container's align-items, and auto takes the container's. See align-items for what daeepdf does with an item placed by alignment when a page break grows its row.

flex-direction

Read to choose how a page break moves a flex item: down a column, or by its margin.

To move a box to the next page, daeepdf puts an invisible spacer before it. In a column flex container, a spacer pushes the items after it down, as in a block. In a row flex container or a grid, a spacer would become an item of its own, so the item moves by its top margin instead, and its line or row grows to fit, as Chrome's print grows it. Either way the container breaks row by row rather than moving whole.

margin-top

Read to cut or keep a box's top margin at a page break, as Chrome's print does, and to move flex items.

At an unforced break, a top margin that the page's end falls in is cut, and the box starts at the top of the next page, as Chrome's print starts it. After a forced break, such as break-before: page, the margin is kept, so the box starts that far below the page's top.

A box first in its parent, below the parent's top border or padding, takes the parent with it to the next page unless the parent starts its page; with no border, padding or overflow between them, its margin collapses through the parent, as CSS has it.

In a flex or grid container, daeepdf moves an item down by adding to its margin-top, as a spacer there would become an item (see flex-direction). Boxes a negative margin makes overlap paint in CSS's order (see z-index).

margin-right

Read only for a clip-path whose reference box is the margin box.

Margins place boxes through the layout and print as Chrome places them. daeepdf reads margin-right and margin-left itself only to grow the reference box of a clip-path such as inset(0) margin-box from the border box to the margin box.

margin-bottom

Read to find where a box's margin ends, for page breaks in flex and grid rows and under a table's caption.

A flex or grid item's row runs to the bottom of its margin box, which is how daeepdf tells which items share a row when it breaks the container row by row. In a table with its caption on top, daeepdf moves the header to the next page by the caption's bottom margin, as a spacer there would land below the header.

It also sizes a clip-path with the margin-box reference box (see margin-right).

margin-left

Read only for a clip-path whose reference box is the margin box.

It places the box through the layout, and daeepdf reads it itself only for a clip-path with the margin-box reference box (see margin-right).

padding-top

Read to find a box's padding and content boxes, and whether a page break takes a box with its first child.

daeepdf finds a box's padding box and content box from its border box as Chrome laid it out, inset by the border widths and paddings, the corners curving as border-radius gives them. The padding box is where overflow and paint containment clip and where background layers are placed by default; the content box is where an <img>, <canvas> or inline <svg> draws and where background-origin: content-box and background-clip: content-box lie.

For page breaks, top padding keeps a first child's top margin from collapsing through its parent, so a page's end falling there takes the parent to the next page with the child (see margin-top).

padding-right

Read to find a box's padding and content boxes, and where an ellipsis goes.

It insets the content box as padding-top describes. The "…" of text-overflow: ellipsis and of -webkit-line-clamp ends at the content box's end, inside this padding.

padding-bottom

Read to find a box's padding and content boxes, and where a page's end may split a table cell.

It insets the content box as padding-top describes, and a -webkit-line-clamp box's last shown line is the last one above it. A page's end can't fall in a table cell's bottom padding or border, so a row whose cut would land there moves to the next page whole, as Chrome's print moves it.

padding-left

Read to find a box's padding and content boxes.

It insets the content box as padding-top describes.

zoom

Scales a box and all it holds in a template, as Chrome draws it; on the page around daeepdf's frames, canceled.

daeepdf lays a template out in a frame of its own inside your page. A zoom on an ancestor of that frame, such as a preview container zoomed to fit, would change the layout in it in some browsers, so daeepdf cancels it on the frame and scales the frame visually instead. The export lays out the same whatever zoom your page has.

In a template, zoom scales a box and everything in it, as Chrome lays it out. Chrome computes lengths unzoomed, so daeepdf scales each one it reads, from font sizes and borders to shadows and transforms, by the element's zoom. A variable font keeps its unzoomed optical size, as in Chrome, and an inline <svg> without a viewBox is scaled whole.

Visibility, overflow and containment

These decide what prints and what is cut. A clip in the page is a clip in the PDF, and text, links and form fields it hides wholly are left out of the file, as Chrome's print leaves them out. Containment and will-change matter in print mostly for which box holds a position: fixed descendant, which otherwise repeats on every page.

visibility

Hides an element's own painting; a descendant set back to visible still prints.

With hidden or collapse, the element's background, border, shadow, outline, text, image, form field and link are left out of the PDF, and its text isn't in the file to select or search. Its space stays in the layout, and its counters still count. A descendant with visibility: visible prints, as in Chrome.

visibility: collapse on a table row prints as Chrome prints it: the row is hidden, takes its content's height rather than a height you set, and has no border spacing after it.

On SVG elements the value goes onto the drawing, where a hidden shape doesn't print.

import pdf from 'daeepdf'

const html = `<style>
  @font-face { font-family: Inter; src: url('/fonts/inter-var.ttf'); }
  body { font: 12pt Inter; }
  .redacted { visibility: hidden; }
  .redacted .note { visibility: visible; }
</style>
<p class="redacted">Account 4421 0098 7731 <span class="note">on file</span></p>`
const file = await pdf.render(html)
// The text holds "on file" and nothing of the account number.
content-visibility

hidden prints the box without its contents; auto prints everything, contained.

content-visibility: hidden prints the element's own background, border and outline and none of its contents: no text, children, pseudo-elements or list marker, and on an <img>, <svg> or other replaced element no drawing. A link keeps its area. It doesn't apply to a table.

A browser skips drawing an auto box while it's off screen, and Chrome's print draws it all, so daeepdf prints its contents wherever they fall. It keeps the containment auto implies: the contents are clipped to the padding box as overflow: clip clips them, and counters are scoped inside.

A closed <details> prints only its summary, as Chrome hides the rest with content-visibility: hidden on its ::details-content, which a stylesheet can override. On the template's html or body, any value but visible keeps the body's background on the body's own box instead of the whole page, as Chrome does.

import pdf from 'daeepdf'

const html = `<style>
  @font-face { font-family: Inter; src: url('/fonts/inter-var.ttf'); }
  body { font: 12pt Inter; }
  .answer { content-visibility: hidden; height: 48pt; border: 1pt solid #999; }
</style>
<p>1. Name three noble gases.</p>
<div class="answer">Helium, neon and argon</div>`
const file = await pdf.render(html)
// The empty bordered box prints; the answer in it doesn't.
overflow

A box that clips its overflow clips it in the PDF too, and what it hides wholly is left out of the file.

hidden, clip, auto and scroll clip the box's content to its padding box, its corners following border-radius inset by the border, on every page the box spans. A scroll container prints at its first scroll position, without scroll bars. Content a clip hides adds no pages. Under clip, overflow-clip-margin lets the content reach out past the box it names, the padding box by default.

Text, links and form fields wholly outside the clip are left out of the PDF, as Chrome's print leaves them out, text glyph by glyph by its ink, so a letter the edge cuts stays in the text and one just past it leaves it.

It doesn't apply to an inline box, a table row, row group or column, or display: contents, and daeepdf ignores it there, as Chrome does. An absolutely positioned descendant escapes the clip unless the box, or one inside it, is its containing block. On the template's body, overflow belongs to the page, as CSS gives it to the viewport, and html's is always visible, so neither clips there, unless either has containment, which keeps the body's overflow its own.

Clipping reads overflow-x and overflow-y; daeepdf reads the shorthand itself to trim an inline <svg> to its content box where it isn't visible, and to tell, at a page break, that a box's first child's margin doesn't collapse through it.

import pdf from 'daeepdf'

const html = `<style>
  @font-face { font-family: Inter; src: url('/fonts/inter-var.ttf'); }
  body { font: 12pt/18pt Inter; }
  .excerpt { height: 36pt; overflow: hidden; }
</style>
<div class="excerpt">First line<br>Second line<br>Third line<br>Fourth line</div>`
const file = await pdf.render(html)
// Two lines fit in 36pt. The fourth is cut, and isn't in the PDF's text.
overflow-x

Read with overflow-y to decide whether a box clips, and along which axes.

daeepdf clips a box to its padding box when overflow-x or overflow-y is hidden, clip, auto or scroll. Chrome makes a visible axis beside a clipping one auto for every value but clip, so both axes clip then. clip on one axis alone clips that axis only: with overflow-x: clip and overflow-y: visible, the content runs on past the bottom, as in Chrome's print.

text-overflow: ellipsis takes effect where the block's overflow-x clips, and a background-attachment: local layer covers what a scroll container scrolls.

overflow-y

Read with overflow-x to decide whether a box clips.

See overflow-x: overflow-y: clip with overflow-x: visible clips at the bottom and lets a long line run on past the side, as in Chrome's print.

overflow-clip-margin

How far past its box a box under overflow: clip lets its content reach before the clip cuts it.

It names the box the clip starts from, padding-box by default, content-box or border-box, and a length it grows by on every side, its rounded corners growing with it, as Chrome's print clips. It applies where overflow-x or overflow-y is clip; hidden, auto and scroll clip at the padding box whatever it says, and so does paint containment.

clip

clip: rect() on an absolutely positioned or fixed box cuts its drawing, as Chrome's print cuts it.

The rectangle is rect(top, right, bottom, left), each edge measured from the top left of the border box, and auto at that edge of the border box. It applies only to position: absolute and fixed boxes and is ignored on others, as CSS has it. Unlike overflow, it cuts the box's own background, border and shadow too.

What it hides wholly is left out of the PDF, text, links and form fields included. A box over several pages has each page's part cut on its own, and each copy of a fixed box is cut alike. clip-path does the same with any shape.

import pdf from 'daeepdf'

const html = `<style>
  @font-face { font-family: Inter; src: url('/fonts/inter-var.ttf'); }
  body { font: 12pt Inter; }
  .tab { position: absolute; clip: rect(0, 60pt, auto, 0); }
</style>
<div class="tab">INVOICE 2024-117</div>`
const file = await pdf.render(html)
// Only the first 60pt print: "INVOICE" is in the text, the number's end isn't.
contain

Clips, holds fixed descendants and scopes counters, each as CSS containment asks.

paint, strict and content clip the box's contents to its padding box, as overflow: clip does, and what that hides wholly is left out of the PDF.

layout, paint, strict and content make the box a stacking context and the containing block of its position: fixed descendants, which print once, inside it, instead of repeating on every page, as in Chrome's print. style, strict and content scope counters and quotes: what is reset, incremented or opened inside stays inside. size and inline-size change only the layout.

Containment doesn't apply to an inline box or a table row, row group or column, and is ignored there. Any containment on the template's html or body keeps the body's background on the body's own box, and paint there clips what overflows it, padding included, as on any box.

container-type

Read only on the template's html and body, where a size container keeps the body's background to its box.

Container queries are the layout's: what they select prints as Chrome laid it out. daeepdf reads the value itself only on the template's html and body: when either is a size or inline-size container, the page takes only html's background and the body's stays on the body's box, as Chrome does.

A size container doesn't hold its position: fixed descendants, which repeat on every page as Chrome's print repeats them.

will-change

Read for the stacking contexts and containing blocks it makes, as Chrome makes them.

Chrome gives a box now what the change it names would give it later. transform, translate, rotate, scale, perspective, transform-style and the offset names make it the containing block of its position: fixed descendants, except on an inline box; filter and backdrop-filter do on any box, and contain where containment applies. A fixed descendant then prints once, inside it, instead of on every page.

opacity, isolation, mix-blend-mode, clip-path, mask, filter, transform and perspective make it a stacking context, so its positioned descendants paint inside it. Nothing else changes: the property it names takes effect only from its own value.

isolation

isolate makes a stacking context, so a mix-blend-mode inside blends only with what is inside it.

A stacking context with a blending descendant is drawn in the PDF as an isolated transparency group, as CSS Compositing asks: the blend mixes with what the group draws, not with what lies under the group. isolation: isolate makes a box such a context without any other effect, as Chrome draws it.

With nothing blending inside, it changes only where the positioned descendants paint. On SVG elements the value goes onto the drawing.

Backgrounds

daeepdf draws backgrounds as Chrome prints them with background graphics on: the color as a vector fill, linear and radial gradients as vector shadings and url() images embedded, each layer laid out by background-size, background-position, background-repeat and background-origin and clipped to its background-clip box. It always prints them, and doesn't read print-color-adjust. What a PDF has no operator for is drawn another way: a conic gradient and an SVG image as images, and background-clip: text as a flat color.

background-color

Fills the box under its image layers, clipped to the bottom layer's background-clip box.

The color is a vector fill of the border box by default, under every background-image layer, its corners curved by border-radius. The last value of background-clip, the bottom layer's, sets the box it fills, and with text it fills nothing. A translucent color keeps its alpha, as the fill's opacity in the PDF.

A box over several pages is filled as one shape the pages cut, or as one per page with box-decoration-break: clone, and an inline box fills each line it wraps onto. The template's html background, else its body one, covers every page, as Chrome prints a document's canvas. A table row's, row group's or column's color shows only behind its own cells.

daeepdf always prints backgrounds, as Chrome does with Background graphics checked. An unstyled <input>, <button>, <select> or <textarea> keeps Chrome's native look, a 1px gray border with 2px corners, until you give it a background or a border.

background-image

Draws each layer: gradients as vector shadings, url() images embedded, conic gradients and SVGs as images.

Layers paint last to first, so the first listed is on top, all above the background color and under the border. A linear or radial gradient, repeating or not, is a vector shading, stops with partial alpha included. A conic gradient has no PDF shading and is drawn as an image at 3 pixels per point. image-set() draws its option of highest resolution, as print wants.

A url() image is fetched once per export. A JPEG goes into the PDF as it is, a PNG as its pixels compressed again, WebP and AVIF decoded by the browser into pixels, and an SVG drawn as an image at 3 pixels per point. A GIF, BMP or TIFF, an image that doesn't load in time, a cross-origin one served without CORS headers, and any other value daeepdf can't draw are skipped with an 'image-skipped' warning, and the layers under them still print.

An element draws its first 32 layers; past them the rest are skipped with one 'limit-reached' warning per export. Each layer is laid out by its own value of background-size, background-position, background-repeat, background-origin, background-clip, background-attachment and background-blend-mode, a shorter list repeating as CSS repeats it, so background: url(a.png), url(b.png); background-repeat: no-repeat repeats neither.

import pdf from 'daeepdf'

const gif = 'data:image/gif;base64,R0lGODlhAQABAAAAACw='
const html = `<style>
  @font-face { font-family: Inter; src: url('/fonts/inter-var.ttf'); }
  .hero { font: 24pt Inter; height: 120pt; color: white;
    background-image: url(${gif}), linear-gradient(#1e3a8a, #3b82f6); }
</style>
<div class="hero">Spring catalog</div>`
const file = await pdf.render(html)
file.warnings.map((w) => w.code) // ['image-skipped'], for the GIF layer alone
background-position

Places each layer's first tile in its background-origin box, as Chrome places it.

Keywords, lengths and percentages resolve against the origin box less the tile, so 100% 100% puts the tile in the bottom right corner, and the four-value form, such as right 4px bottom 4px, works as Chrome computes it. A repeating layer tiles out from that tile both ways.

A fixed layer is placed on the page's content area instead (see background-attachment), and the template's page background from the first page's top left.

background-size

Sizes each layer's tile, as Chrome sizes it.

auto takes an image's natural size, divided by its resolution for an image-set() option, or the whole origin box for a gradient, which has none. cover and contain scale an image to cover or fit the origin box, keeping its ratio. A length or percentage with auto keeps the ratio, and percentages are of the origin box. An SVG with only a viewBox takes its ratio, fitted into the box, and one with neither fills it.

A gradient tile is one vector shading the PDF repeats, however small the tile (see background-repeat for the limits).

background-repeat

Tiles each layer as Chrome does: repeat, repeat-x, repeat-y, no-repeat, space and round.

A repeating layer covers its background-clip box with whole tiles from the one background-position places, cut at the edges of that box. space spreads whole tiles edge to edge and doesn't repeat where fewer than two fit. round scales the tile so a whole number fit, and with auto size on the other axis scales it there too, keeping the image's ratio.

Image tiles are drawn one by one up to 2,000 per layer and 100,000 per export; past either, they are drawn in blocks of several tiles, each one image, so the box is still covered. A gradient's tiles are one shading the PDF repeats within the same limits, and past them its tile is drawn as an image and tiled the same way.

background-origin

Sets the box each layer is placed and sized in: the padding box unless you say otherwise.

padding-box, border-box and content-box are found from the border box Chrome laid out, inset by the border widths and paddings. A layer is cut by its background-clip box, not by its origin box, so a repeating layer runs on under the border, as in Chrome.

It is ignored for a fixed layer, laid out on the page's content area, and for the template's page background, which Chrome's print lays out from the page's top left whatever html's margin or origin.

background-clip

Clips each layer to its border, padding or content box; text prints the text in a flat color instead.

Each layer is clipped to its own box, border-box by default, with the corners border-radius gives, inset for the padding and content boxes. The background color takes the last value, the bottom layer's. An image placed past its clip box is cut at its edge.

A PDF can't clip a fill to the shapes of glyphs, so text is drawn another way. The box paints no fill and no layer clipped to text, only its box-shadow, and text with a transparent fill (color: transparent, or -webkit-text-fill-color: transparent, as the gradient-text pattern sets it) paints in one flat color: the first stop of the first gradient layer, else the background-color, else black. A url() image gives no color. Chrome's print shows the gradient through the glyphs. Text with a color of its own paints in that color, as in Chrome.

daeepdf reads -webkit-background-clip first and this one after; Chrome keeps the two as one property.

import pdf from 'daeepdf'

const html = `<style>
  @font-face { font-family: Inter; src: url('/fonts/inter-var.ttf'); }
  h1 {
    font: 800 36pt Inter;
    background: linear-gradient(90deg, #7c3aed, #db2777);
    background-clip: text;
    color: transparent;
  }
</style>
<h1>Annual report</h1>`
const file = await pdf.render(html)
// The heading prints as text you can select and search.
-webkit-background-clip

The prefixed name of background-clip, which daeepdf reads first; in Chrome the two are one property.

Everything background-clip says holds for it, text included. A stylesheet that sets -webkit-background-clip: text alone for gradient text gets that text in a flat color, as background-clip: text does.

background-attachment

fixed is laid out on the page's content area at the top of each page; local follows a scroll container's content.

scroll, the default, lays a layer out on its box. A fixed layer is laid out on the viewport of the window daeepdf lays the page out in, which is the page's content area, at the top of every page, and is painted only where the box covers that area there, as Chrome prints it. A box running over several pages shows the layer in the same place on each page where it covers that spot.

A local layer on a scroll container is laid out on all it scrolls, at its first scroll position, and painted inside its padding box with the content, never under its border, as Chrome paints it. On a box that doesn't scroll, local prints as scroll.

On the template's html or body, the page's background runs on across pages whatever the attachment, as Chrome lays out a document's canvas.

background-blend-mode

Blends each layer with the layers and color under it, in a group of their own, with the PDF's blend modes.

These blend modes each have a PDF one of the same name: multiply, screen, overlay, darken, lighten, color-dodge, color-burn, hard-light, soft-light, difference, exclusion, hue, saturation, color and luminosity. A value without one, such as plus-lighter, draws as normal.

A box whose layers blend draws its background as an isolated group, so they mix with its own color and lower layers only, not with what lies under the box, as CSS Compositing asks and Chrome paints it. The group then takes the element's opacity and mix-blend-mode. The PDF viewer does the blending.

Borders, outlines and shadows

Borders, outlines and box shadows are vector paths drawn in Chrome's geometry: dashes and dots in its pattern, double and 3D styles in its proportions and shades, corners as border-radius curves them. A border-image is drawn from its source cut into nine slices, each an image. A collapsed table resolves its borders itself and draws one per edge of its grid (see border-collapse).

border-top-width

How wide the top border is drawn, and how far the padding box sits inside the border box.

Chrome computes it to 0 where the style is none or hidden, so only a drawn border has a width. It is drawn inward from the edge of the border box, in the points the layout gives it (1px is 0.75pt). A double border narrower than 3px draws solid, as Chrome draws it.

It also sets where the padding box starts, which overflow, background-clip: padding-box and the default background-origin use, and how much a rounded corner's inner curve shrinks. In a collapsed table, the widest border meeting at an edge wins (see border-collapse). A border-image draws in place of the border, as wide as this by default.

border-right-width

How wide the right border is drawn, as border-top-width describes for the top.

border-bottom-width

How wide the bottom border is drawn, as border-top-width describes for the top.

At a page break, the end of a page can't fall in a table cell's bottom border or padding, so a row whose cut would land there moves to the next page whole, as Chrome's print moves it.

border-left-width

How wide the left border is drawn, as border-top-width describes for the top.

border-top-style

The top border's style, drawn as Chrome draws it.

solid is a band. dashed and dotted follow Chrome's pattern, the gaps stretched so each side starts and ends on a dash; dots are square up to 3px wide and round past that. double is two lines a third of the width each. groove, ridge, inset and outset are drawn in a dark and a light shade of the color, worked out as Chrome works them out. none and hidden draw nothing.

Sides that share a width, style and color draw as one ring, with no seam at the corners, and sides that differ meet in mitered corners. In a collapsed table, hidden wins over every other border at its edge, and inset and outset draw as ridge and groove, as CSS 2.1 has it.

Chrome draws an unstyled form control's border natively until you give it one of your own, and daeepdf reads the top style to tell (see background-color).

border-right-style

The right border's style, drawn as border-top-style describes.

border-bottom-style

The bottom border's style, drawn as border-top-style describes.

border-left-style

The left border's style, drawn as border-top-style describes.

border-top-color

The top border's color, its alpha kept as the PDF's opacity.

It arrives as Chrome computes it, currentColor resolved, and any color syntax Chrome computes, oklch() and color-mix() among them, is converted to sRGB. A transparent side draws nothing. Sides of one color fill as one shape, so a translucent border shows no darker corners where its sides meet.

border-right-color

The right border's color, as border-top-color describes.

border-bottom-color

The bottom border's color, as border-top-color describes.

border-left-color

The left border's color, as border-top-color describes.

border-radius

Read as written only where a split table's repeated rows show the boxes around the table; the corners come from the longhands.

Chrome computes the shorthand into border-top-left-radius and the other three corners, which daeepdf reads to curve every box. It reads the shorthand itself in one place: where a page's end splits a table row and the table repeats its header, the backgrounds of the boxes around the table show under the repeated rows, each with its box's corners.

border-top-left-radius

Curves the top left corner of the box's background, border, shadow, outline and clips.

One value is a circle's radius and two, H V, an ellipse's. A percentage is of the box's width for H and its height for V, so 50% makes an ellipse of a box that isn't square. Where the radii along a side add up to more than its length, all of them shrink by one factor until they fit, as CSS has it, so border-radius: 9999px makes a pill.

The curve shapes the background color and each layer's clip, both edges of the border, the box shadow, whose curve grows with its spread and blur, the outline, whose curve grows with its offset, and the clip of overflow, inset by the border. An inline box broken over lines keeps only the corners at its start and end under box-decoration-break: slice.

border-top-right-radius

Curves the top right corner, as border-top-left-radius describes.

border-bottom-right-radius

Curves the bottom right corner, as border-top-left-radius describes.

border-bottom-left-radius

Curves the bottom left corner, as border-top-left-radius describes.

border-image-source

Draws a border image in place of the border: a url() image, an image-set() or a gradient, cut into nine slices.

The source is drawn on a canvas and cut into nine slices by border-image-slice, each embedded as a PNG: a url() image at its natural size in pixels, and a gradient, linear, radial or conic, over the border box at 3 pixels per point, since a gradient has no size of its own. image-set() takes its option of highest resolution.

With a source, the CSS border isn't drawn, though its widths still size the border image. A source that doesn't load, a cross-origin image without CORS headers among them, is skipped with an 'image-skipped' warning, and the CSS border draws instead. A collapsed table and its cells take no border image, as in Chrome.

The slices count toward the export's raster budget of 64 megapixels, and a source image over 50 megapixels is skipped.

import pdf from 'daeepdf'

const html = `<style>
  @font-face { font-family: Inter; src: url('/fonts/inter-var.ttf'); }
  .frame { font: 12pt Inter; border: 6pt solid #b91c1c;
    border-image-source: url('/images/missing-frame.png'); border-image-slice: 30; }
</style>
<div class="frame">Certificate of completion</div>`
const file = await pdf.render(html)
file.warnings.map((w) => w.code) // ['image-skipped']
border-image-slice

Where the border image's source is cut into its nine slices.

Numbers are pixels of the source at its natural size, for a gradient CSS pixels over the border box, and percentages are of that size; a slice larger than the source takes all of it. The default, 100%, makes the whole source the four corners. Without fill the middle slice is left out; with it, the middle draws over the background, scaled as the top and left edges are, as CSS has it.

border-image-width

How wide the border image's edge slices are drawn.

A number multiplies the border width on that side, so the default, 1, is the border width. A length is used as it is, a percentage is of the border image area, outset included, and auto is the slice's own size. Where two opposite sides add up to more than the area, all four shrink by one factor until they fit, as CSS has it.

border-image-outset

How far the border image reaches past the border box.

A length is used as it is, and a number multiplies the border width on that side. The image draws over the outset area, outside the box, without moving anything in the layout, as in Chrome.

border-image-repeat

How the edge and middle slices fill their lengths: stretch, repeat, round or space.

The first value is for the top and bottom edges and the second for the sides. stretch scales a slice to the length. repeat tiles it from the middle of the edge, cutting tiles at both ends. round scales it so a whole number fit. space spreads whole tiles with even gaps, ends included, and draws none where none fit. An edge slice keeps its aspect, its cross size being the border image width.

box-shadow

Draws outer and inset shadows as vector paths, blurred as Chrome blurs them.

Offsets, blur and spread are drawn as vector paths following the box's border-radius. A blur is a stack of layers, one per 2pt of blur up to 60, each ending where Chrome's Gaussian falls to its share, so the edge fades as Chrome's does, in fine steps a close zoom can show. An outer shadow is never drawn under its own box, so a translucent background doesn't show it. An inset shadow draws over the background and its layers, under the border.

A transparent shadow draws nothing. An element draws its first 32 shadows, and a document draws 50,000 blur layers in all, after which each blurred shadow draws in one step, with a hard edge.

The first of several shadows is on top, as CSS puts it and Chrome's print draws it. An inline box broken over lines casts the shadow of the whole box laid end to end, each piece showing its part and the cut sides none, as Chrome's print slices it; with box-decoration-break: clone each piece casts its own.

box-decoration-break

slice cuts a broken box's border and corners at each break; clone draws each piece as a whole box.

An inline box broken over lines: with slice, the default, its border and rounded corners draw only at the box's start and end, and its background layers run on as one strip across the pieces. With clone, every piece has its own border and corners, and its background is laid out on it.

A block over pages: with slice, each page shows its part of one shape, the page's edge cutting the border and the background. With clone, each page's part is a whole box of that part's height, with its border and rounded corners all around, as Chrome prints it, and its background layers are sized to the whole box and start again at each part's top, so a gradient shows its first stretch on every page.

The outline is drawn whole around every piece either way. Under slice the pieces share one box-shadow, cut where the box is; under clone each casts its own.

outline-width

How wide the outline is, drawn outward from outline-offset past the border box.

Chrome computes it to 0 when outline-style is none. The outline is a ring around the border box, whole around every piece of the box: each line of an inline box and each page's part of a block. It takes no room in the layout. A double outline narrower than 3px draws solid, as Chrome draws it.

Outlines paint last in the flow, as CSS orders them: over the box's own content and over a later box's background, still cut by the overflow clips around the box, as in Chrome's print.

outline-style

The outline's style, drawn as the same style of border is.

solid, dashed, dotted, double, groove, ridge, inset and outset draw as border-top-style describes, a square dashed outline dashing side by side. auto draws Chrome's print's focus ring, whatever the width: 2px of outline-color centered on the outline's edge, inside 1px of white, its corners at least 2px round.

outline-color

The outline's color, its alpha kept as the PDF's opacity.

It arrives as Chrome computes it and is converted to sRGB, as border-top-color is. A transparent outline draws nothing.

outline-offset

How far outside the border box the outline starts; a negative offset draws it inside.

A positive offset leaves a gap between the border and the outline. A rounded box's outline has corners grown by the offset and the outline's width, as Chrome draws them, and square corners stay square.

daeepdf draws the outline with its box, under the box's content, where Chrome draws outlines over everything else in their stacking context. An outline moved inside by a negative offset can hide under a child's background in daeepdf and shows over it in Chrome.

Text

How a run of text looks once Chrome has laid it out: its color, spacing, case, wrapping and paint. daeepdf reads where Chrome put each line and word and draws the glyphs itself, so what a property changes in the layout, line breaks, alignment and spacing, prints where Chrome's print puts it, and what it changes in the painting is drawn as each entry says. Text prints only in a font the template declares with @font-face, or in fallbackFont.

color

The text's color, which daeepdf fills the glyphs with.

Any color Chrome computes works: names, hex, rgb(), hsl(), hwb(), lab(), oklch() and color() in every predefined space. daeepdf converts it to sRGB, each channel clipped to its range, and writes its alpha as the run's opacity, so rgb(0 0 0 / 0.5) prints half transparent. A decoration, a list marker and an SVG's currentColor take this color unless they set their own, and -webkit-text-fill-color overrides it for the fill alone.

Text in a fully transparent color is invisible but stays in the PDF's text, so it can be found and copied, as in Chrome's print, and its text-shadow prints. Its decorations still print. Two cases paint anyway: -webkit-text-stroke outlines the glyphs, and text under background-clip: text takes a stand-in color, as the -webkit-text-fill-color entry says.

import pdf from 'daeepdf'

const file = await pdf.render(`<style>
  @font-face { font-family: Inter; src: url('/fonts/inter-var.ttf'); }
  p { font: 12pt Inter; }
  .note { color: transparent; }
</style>
<p>Total: 42</p>
<p class="note">Hidden note</p>`)
// 'Hidden note' doesn't show, but the PDF's text holds it beside 'Total: 42'
line-height

The height of each line, which Chrome lays out and daeepdf reads, deciding where lines sit and where a page breaks between them.

daeepdf takes each line's position from Chrome's layout and its baseline from the font, so any value, normal, a number, a length or a percentage, prints with the spacing Chrome's print gives it.

It also decides where a page breaks inside a paragraph. A line's box is its glyphs grown by the leading line-height adds, the whole px of the half-leading above and the rest below, as Chrome splits it, and a line whose box would cross the page's end moves to the next page, orphans and widows kept. normal is measured from the line's first font: its ascent, descent and line gap.

text-align

How lines align in their box, which Chrome lays out and daeepdf prints where Chrome put each line.

left, right, center, start and end need nothing of daeepdf: each line is drawn from where Chrome's layout starts it.

justify widens the spaces between words. daeepdf doesn't widen spaces inside a run of text, so a justified paragraph goes word by word, each word set where Chrome put it. It prints as Chrome's print does, word for word, the last line left as Chrome leaves it.

text-align-last sets the last line, and a line before a forced break, apart, as its own entry says.

text-align-last

How the last line of a block, and a line before a forced break, align.

justify spreads that line across the box. daeepdf draws it word by word, as it draws justified lines, each word where Chrome's print sets it. Its other values only move where Chrome starts each line, which daeepdf reads, so they need nothing of it.

text-transform

Changes the text's case; daeepdf draws the changed text and puts it in the PDF's text, as Chrome's print does.

uppercase, lowercase and capitalize change the characters daeepdf draws, so a searched or copied word reads as it prints. Letters of any script count, so capitalize makes élan into Élan, and it sees a word across inline boxes as Blink does: wor<b>ld</b> becomes World, its l left lowercase.

uppercase and lowercase map case in the text's language, from the nearest lang, as Chrome's print does: under lang="tr", uppercase turns i into the Turkish İ. capitalize maps in no language, as Chrome's does, so there izmir becomes Izmir.

import pdf from 'daeepdf'

const file = await pdf.render(`<style>
  @font-face { font-family: Inter; src: url('/fonts/inter-var.ttf'); }
  h2 { font: 12pt Inter; text-transform: uppercase; }
</style>
<h2>Total due</h2>`)
// The PDF's text is 'TOTAL DUE', so a search for it finds it
letter-spacing

Space added after each character, which daeepdf sets as the PDF's character spacing.

Chrome lays out the spaced text and daeepdf gives the run the same spacing, so each glyph lands where Chrome's print puts it. Any length works, and a percentage of the font size.

As in Chrome, spacing other than 0 turns off the font's optional ligatures, liga, clig, dlig, hlig and calt, whatever font-variant-ligatures asks for. In vertical text each character is placed where Chrome stepped it down the column, its spacing included.

word-spacing

Space added at each space between words; daeepdf sets each word where Chrome put it.

daeepdf doesn't widen the spaces in a run of text, so a run with word-spacing goes word by word, each word at its place in Chrome's layout, as a justified line does. Word and letter spacing together print as Chrome's print has them. Any length works, and a percentage of the font size.

white-space

Whether the source's spaces and line breaks are kept or collapsed, which Chrome lays out and daeepdf follows.

Under normal, nowrap and pre-line, spaces collapse and daeepdf draws a line's words as one run with single spaces. Under pre, pre-wrap and break-spaces they are kept, and each word goes where Chrome put it, so a run of spaces or a tab prints as wide as Chrome laid it out.

The spaces themselves are drawn, as Chrome draws them, so text taken from the PDF keeps its words apart; none is drawn where a line wraps.

text-overflow

ellipsis cuts a line too long for its box with …, which daeepdf draws as Chrome's print does.

It applies on a block with an overflow that clips, to each line wider than the box, whatever its white-space: a nowrap or pre line, or a word too long to wrap. daeepdf measures the line in its fonts and keeps the longest part that fits with the …, a space before the cut included, drawn in the line's own font and color. clip, the default, leaves the line to the box's overflow clip.

In right-to-left text the … goes on the left, where the line overflows: a Hebrew line keeps its start, a line of Latin its end, as Chrome's bidi lays them out. Vertical text never gets one.

import pdf from 'daeepdf'

const file = await pdf.render(`<style>
  @font-face { font-family: Inter; src: url('/fonts/inter-var.ttf'); }
  p { font: 12pt Inter; width: 100px; white-space: nowrap; overflow: hidden; }
  p { text-overflow: ellipsis; }
</style>
<p>Abbreviation overflowing</p>`)
// The PDF's text is 'Abbreviatio…', as Chrome's print cuts it
-webkit-line-clamp

Shows a box's first lines only, the last one shown ending in …, as Chrome's print does.

With display: -webkit-box, -webkit-box-orient: vertical and overflow: hidden, Chrome lays out every line and the box shows the first ones. daeepdf finds the last line the box shows, cuts it to fit with … as text-overflow does, and the box's overflow clip hides the rest. Lines in blocks inside the box count too.

The lines past the clamp are clipped and left out of the PDF's text, as in Chrome's print. In right-to-left text the … goes on the left.

import pdf from 'daeepdf'

const file = await pdf.render(`<style>
  @font-face { font-family: Inter; src: url('/fonts/inter-var.ttf'); }
  p { font: 12pt Inter; width: 120px; overflow: hidden; }
  p { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
</style>
<p>one two three four five six seven eight nine ten eleven twelve</p>`)
// The second line ends 'four five six…'
text-shadow

Shadows under the text, drawn from the glyphs' outlines and blurred as Chrome's print blurs them.

Each shadow is the run's glyph outlines filled in the shadow's color, at its offset and under the text, the last one listed lowest, as in Chrome. A sharp shadow is a vector shape; one with a blur radius is blurred by a Gaussian of half that radius, as Chrome draws it, on an image at 216 dpi. The color's alpha is the shadow's opacity. Shadows print on first letters and list markers too.

A shadow is a shape, not text, so the PDF's text holds each word once, as Chrome's print does.

One case stays as it was: in vertical text, or where a run's outlines can't be read, a shadow is a copy of the text, sharp at 55% of its alpha for a blur, which a text extraction reads again.

-webkit-text-fill-color

The color the glyphs are filled with, overriding color for the fill alone.

daeepdf fills the glyphs in it, while color still colors decorations and anything set to currentColor.

transparent fills nothing. With -webkit-text-stroke that leaves the outline alone. Under background-clip: text, the gradient-text pattern, daeepdf doesn't clip the background to the glyphs: the text takes a stand-in color, the gradient's first stop or else the background color, and the box paints no background. Transparent text that is neither stroked nor clipped is invisible but stays in the PDF's text, as with a transparent color.

-webkit-text-stroke-width

The width of an outline along the glyphs' edges, which daeepdf draws with the PDF's own text stroke.

A width above 0, with -webkit-text-stroke-color, outlines each glyph, the stroke centered on its edge, as Chrome's print strokes it. With -webkit-text-fill-color: transparent the text is the outline alone; otherwise fill and outline print together. A synthesized bold widens the stroke by its own em/32.

It applies wherever text prints: in lines, first letters, list markers and vertical text.

-webkit-text-stroke-color

The color of the outline -webkit-text-stroke-width draws.

Nothing is stroked without a width above 0. Its alpha is the stroke's own, apart from the fill's, so a translucent outline around an opaque fill prints as Chrome's print has it. Left out, it is the text's color.

text-rendering

A hint Chrome takes for shaping, which daeepdf follows where it changes the glyphs.

optimizeSpeed turns off the font's liga, clig and calt features, as Chrome's print does, and keeps its kerning. auto, optimizeLegibility and geometricPrecision change nothing in the PDF.

ruby-align

How ruby text and its base spread across the width the wider one takes, which Chrome lays out and daeepdf prints.

Chrome spreads the narrower of a ruby's base and annotation by ruby-align: space-around, the default, space-between, center or start. daeepdf reads the spread from where Chrome placed each character and draws the text in pieces at those places, so ruby prints as Chrome lays it out. The annotation prints in its own font and size, like any text.

Text decoration

Underlines, overlines and line-throughs, which daeepdf draws as lines of its own, placed and sized as Chrome's print places them. A decoration paints across the inline content of the box that sets it, its descendants' text included, up to a box out of flow, a float or an inline block, as in browsers. Underlines and overlines go under the glyphs and break where they cross them; a line-through goes over them.

text-decoration

The shorthand for a decoration's line, style, color and thickness; daeepdf reads the longhands it sets.

For HTML text daeepdf reads text-decoration-line, text-decoration-style, text-decoration-color and text-decoration-thickness, so text-decoration: underline wavy red prints as those say. The shorthand itself is read only for text in an inline SVG, carried onto the SVG daeepdf draws as an image.

text-decoration-line

Which lines decorate the text: underline, overline and line-through, alone or together.

Each is a line daeepdf draws at the thickness and place Chrome's print gives it: an underline below the baseline by half its thickness, 1px at least, by text-underline-offset, or where text-underline-position puts it; an overline with its bottom at the font's ascent; a line-through a third of the ascent above the baseline. blink draws nothing, as in Chrome.

A decoration isn't inherited, but it paints across the box's inline content, a <span> inside an underlined link included, up to a box out of flow, a float or an inline block, as browsers paint it. A space between two decorated boxes is decorated too. Down a vertical column an underline runs on the left, unless text-underline-position puts it on the right, and an overline on the right, as Chrome draws them.

text-decoration-style

The line's style: solid, double, dotted, dashed or wavy.

Each prints as Chrome's print draws it. double is two lines of the thickness 1px apart, the second further from the text. dotted and dashed follow Chrome's pattern, fitted so the line starts and ends on a dash. wavy is Chrome's wave, its wavelength, height and phase, and sits a thickness and 1px further from the text than a solid underline or overline.

text-decoration-color

The decoration's color, the text's color unless set.

Its alpha is the line's opacity, and transparent draws no line. A decoration takes the color of the box that sets it, so a link's underline keeps the link's color under a differently colored <span> inside it, as in browsers.

text-decoration-thickness

How thick a decoration's line is.

auto, the default, is a tenth of the font size, floored to whole px and 1px at least, as Chrome paints it. A length, or a percentage of the font size, is rounded to whole px, 1px at least. from-font takes the font's own underline thickness, at the run's point in a variable font, floored to whole px; a font that states none takes auto's.

text-decoration-skip-ink

Whether underlines and overlines break where glyphs cross them.

auto, the default, breaks an underline or overline around each glyph that reaches into its band, the gap padded by the line's thickness up to 13px, and ignores ink reaching less than half a px in, as Chrome's print breaks it. none draws the lines whole. A line-through never breaks.

It works down vertical columns too, and text that paints nothing, in a transparent color, still breaks its underline. A text-combine-upright cell's lines don't break.

text-underline-offset

How far below the baseline an underline's top edge sits, or how far past where text-underline-position puts it.

auto, the default, is half the line's thickness, 1px at least. A length, or a percentage of the font size, is rounded to whole px and takes that gap's place. Under text-underline-position: under or from-font it moves the line on from where those put it, and down a vertical column it moves the line away from the text. It moves underlines only.

text-underline-position

Where an underline goes: near the baseline, clear of the descenders, where the font says, or which side of a vertical column.

auto, the default, puts it just below the baseline (see text-underline-offset). under puts it a px below the em box, clear of descenders, and from-font at the font's own underline position, read at the run's point in a variable font, each where Chrome's print places it. A font that states no position takes auto's.

Down a vertical column the underline runs on the left, or on the right at right. Text in Japanese or Korean, by its lang, takes the right unless it says left, as in Chrome. Text turned sideways takes under and from-font as horizontal text does.

Writing modes and direction

Right-to-left and bidirectional text, and text set in vertical columns. Chrome's own bidi and vertical layout place every character, and daeepdf reads those places and shapes each run in the direction it runs. Vertical text goes without a few things horizontal text has, an ellipsis, ::first-letter and ::first-line, and fallback to another font per character, and a column must fit on its page.

direction

The base direction of text, ltr or rtl, which Chrome's bidi lays out and daeepdf follows.

Chrome runs the Unicode bidi algorithm and places each word, and daeepdf reads those places. A line that mixes right-to-left letters with left-to-right ones, a brand name or a number in Hebrew or Arabic, goes word by word, each word where Chrome put it and each run in it shaped in its own direction, digits left to right.

A right-to-left line of left-to-right letters alone goes word by word too, so a neutral at its end lands where Chrome's bidi sets it: Latin text! under direction: rtl prints with the ! on the left.

It also places what daeepdf draws itself: a list marker goes right of its item, its brackets mirrored, and the … of text-overflow: ellipsis goes on the left.

unicode-bidi

How an element's text takes part in the bidi algorithm; daeepdf prints Chrome's result, overrides included.

normal, embed, isolate and plaintext change only where Chrome's layout puts each word, which daeepdf reads. bidi-override and isolate-override, like U+202D and U+202E in the text, force the text's direction against its letters' own: daeepdf reads the pieces Chrome's bidi set the text in from each character's box and shapes each piece in its forced direction, in a line, down a column and under a filter.

The PDF's text keeps the characters as written, so overridden text reads as it was written when copied or read aloud, where Chrome's print gives it reversed.

import pdf from 'daeepdf'

const file = await pdf.render(`<style>
  @font-face { font-family: Inter; src: url('/fonts/inter-var.ttf'); }
  p { font: 12pt Inter; }
  .back { unicode-bidi: bidi-override; direction: rtl; }
</style>
<p><span class="back">override</span> plain</p>`)
// The PDF's text reads 'override plain', as written
writing-mode

Sets text in vertical columns, vertical-rl, vertical-lr, sideways-rl or sideways-lr, instead of horizontal lines.

Chrome lays the columns out and daeepdf draws each character where Chrome placed it. Under vertical-rl and vertical-lr each character stands upright or turns a quarter clockwise, as text-orientation says. Under sideways-rl every character turns a quarter clockwise, and under sideways-lr a quarter counterclockwise, read bottom to top. The -rl modes set their columns right to left and the -lr ones left to right. Each glyph lands where Chrome stepped it down the column, an upright one centered across it.

Vertical text keeps its color, letter-spacing, text-shadow, -webkit-text-stroke and decorations. It goes without some of what horizontal text has: no text-overflow ellipsis, no ::first-letter or ::first-line, and no fallback per character, so a column draws in its first declared family alone.

A box whose writing mode differs from its parent's, such as a vertical box on a horizontal page, isn't broken inside, as Chrome's print doesn't break it: a page's end moves it whole to the next page, and one taller than a page starts a page and runs on across the ones after it, each column drawn on every page it reaches.

text-orientation

How characters stand in a vertical column: mixed, upright or sideways.

Under mixed, the default, CJK characters and most symbols stand upright while Latin and other horizontal scripts turn a quarter clockwise, cluster by cluster, by Unicode's vertical orientation data (UAX #50), as Chrome does. upright stands every character upright, Latin included, and sideways turns them all. Right-to-left text in a turned run goes the other way along its line, in the order Chrome's bidi gives it.

Under sideways-rl and sideways-lr every character turns whatever this says, and in horizontal text it changes nothing.

text-combine-upright

all sets a short run, such as a date's two digits, upright and side by side in one character's cell of a vertical column.

As in Chrome, the run takes the first of the font's half-, third- and quarter-width forms (hwid, twid, qwid) that fits 1.1em, or 1em under an underline or overline, and is squeezed across to fit where none does. It has no letter spacing, and its decorations run down the cell without skip-ink.

It applies under vertical-rl and vertical-lr; in horizontal text and under sideways-rl and sideways-lr it changes nothing.

Fonts

Which font text prints in, and in which of its forms. A run prints only in a family the template declares with @font-face, or in fallbackFont, and daeepdf embeds a subset of that font, shaped by daegun, at the point in a variable font Chrome's print uses and with the OpenType features Chrome turns on. Where Chrome would make a bold, an oblique or small capitals the font doesn't have, daeepdf makes them the same way.

font-family

The families text is set in; text prints only in one the template declares with @font-face.

daeepdf can't use the fonts installed on a machine. Each run takes the first family in its list that one of the template's own @font-face rules declares, skipping generic names such as sans-serif and serif and any family no rule declares. Text whose list names no declared family is left out, with a 'font-not-declared' warning naming its first family, unless fallbackFont gives it a font. Only rules in the template count: an @font-face in your app's stylesheets lays text out in the browser but can't print it. Headers and footers use the template's fonts.

A character the chosen font lacks falls back on its own, to the next declared family in the list that has it, then to any other family the template declares. One that no declared font has prints as the font's placeholder glyph, or under pdfA or pdfUA is left out, with a 'glyph-missing' warning.

Put a declared family first. A family before it that the machine has installed, as in Arial, Inter, lays the text out in Arial in Chrome while daeepdf draws it in Inter, so lines break where Arial's narrower widths put them and print wider than Chrome laid them out. With fallbackFont set, daeepdf takes the undeclared families out of the template's font-family lists before layout, so Chrome lays text out in the font that prints.

import pdf from 'daeepdf'

const file = await pdf.render(`<style>
  @font-face { font-family: Inter; src: url('/fonts/inter-var.ttf'); }
  p { font-size: 12pt; }
</style>
<p style="font-family: 'Brand Sans', Inter">Set in Inter</p>
<p style="font-family: 'Brand Sans', serif">Left out</p>`)
file.warnings.map((w) => w.code) // ['font-not-declared']
font-size

The text's size, which daeepdf draws its glyphs at, scaled by its face's size-adjust.

Glyphs print at the computed size in pt, px × 0.75, times the size-adjust of the @font-face rule the text's face comes from, as Chrome scales them. Sizes written in pt carry straight into the PDF: 12pt text is 12pt type.

In a variable font with an optical size axis, the glyph size in px also sets opsz, unless font-optical-sizing is none, and each optical size the document uses embeds an instance of its own.

font-weight

The weight daeepdf draws in: a variable font's wght axis, or a bold made from a lighter face, as Chrome's print does.

In a variable font the weight sets wght, clamped to the range the face's @font-face rule declares, as in font-weight: 100 900, or to the font's own axis where the rule declares none. Each weight the document uses embeds an instance of its own, so regular and bold text carry two subsets of one file.

Where the face can't reach the weight, a static face or a rule whose range ends below 600, text at 600 or more gets a synthesized bold, as Chrome's print draws it: the glyphs stroked an em/32 wide in their own color. font-synthesis-weight: none turns that off.

import pdf from 'daeepdf'

const file = await pdf.render(`<style>
  @font-face { font-family: Inter; src: url('/fonts/inter-var.ttf'); font-weight: 100 900; }
  p { font: 12pt Inter; }
</style>
<p>Regular, <b>bold</b> and <span style="font-weight: 300">light</span></p>`)
// Three subsets of Inter, at wght 400, 700 and 300
font-style

Italic or oblique text, drawn from the font's own italic or slant, or slanted by daeepdf where it has neither, as Chrome's print does.

italic takes a variable font's ital axis, else its slnt axis at 14°, clamped to the font-style range of the face's @font-face rule; oblique with an angle sets slnt to that angle. A static italic face is taken for italic and for an oblique of 14° or more, which Chrome treats alike.

A font that can't slant that far, Inter among them, gets a synthesized oblique, its glyphs sheared by 0.25, about 14°, as Chrome synthesizes it. An oblique under 14° in such a font prints upright, as in Chrome, and font-synthesis-style: none keeps every slant from being synthesized.

font-stretch

The face's width, which a variable font's wdth axis draws.

In a variable font with a wdth axis the stretch's percentage sets it, clamped to the font-stretch range of the face's @font-face rule; condensed and the other keywords are their percentages. A font without the axis, Inter among them, prints at its own width, as in Chrome: no width is synthesized.

daeepdf doesn't choose between faces by it, so two @font-face rules of one family that differ only in font-stretch aren't told apart. Give a condensed face a family of its own.

font-size-adjust

Scales a font by its x-height, or the metric named, and daeepdf draws the glyphs at the size Chrome lays them out at.

Chrome scales the text so its x-height, or the metric named, is the given share of the font size, and lays the lines out at that size. daeepdf takes the size from Chrome's own layout of the font, with the optical size it sets, so "Hello wide world" at 12pt in Inter with font-size-adjust: 0.3 prints 52pt wide, as in Chrome's print.

The @font-face descriptor size-adjust is another thing, and prints as Chrome scales it (see font-size).

font-variant

The shorthand for the font-variant-* properties; daeepdf reads the longhands it sets.

For HTML text daeepdf reads font-variant-caps, font-variant-numeric, font-variant-ligatures, font-variant-east-asian, font-variant-alternates and font-variant-position, which this sets. The shorthand itself is read only for text in an inline SVG, carried onto the SVG daeepdf draws as an image.

font-variant-caps

Small capitals and their kin, from the font's own features where it has them and made from its capitals where it doesn't, as Chrome's print does.

daeepdf looks the features up for the script of the text's first cased letter: small-caps takes smcp, all-small-caps smcp and c2sc, petite-caps pcap, all-petite-caps pcap and c2pc, unicase unic and titling-caps titl. Petite caps the font lacks become small caps.

Small caps the font lacks, as in Inter, are synthesized: lowercase letters, or every letter under all-small-caps, drawn as capitals at 70% of the size, rounded to whole pixels as Chrome rounds it. unicase without unic shrinks the capitals instead, or lowercases them into the font's smcp where it has that. Titling caps are never synthesized, and font-synthesis-small-caps: none turns synthesis off.

Synthesized capitals copy as the letters written, as in Chrome's print: "Small Caps" copies as "Small Caps", though it prints in capitals.

import pdf from 'daeepdf'

const file = await pdf.render(`<style>
  @font-face { font-family: Inter; src: url('/fonts/inter-var.ttf'); }
  p { font: 12pt Inter; font-variant-caps: small-caps; }
</style>
<p>Small Caps</p>`)
// Inter has no smcp, so the small capitals are made from capitals, and the PDF's text is still 'Small Caps'
font-variant-numeric

Figure and fraction forms, each turning on the font's OpenType feature as Chrome does.

lining-nums turns on lnum, oldstyle-nums onum, proportional-nums pnum, tabular-nums tnum, diagonal-fractions frac, stacked-fractions afrc, ordinal ordn and slashed-zero zero. A font without the feature prints its default forms, as in Chrome: nothing is synthesized.

List markers set their digits in tabular figures, as Chrome's ::marker style does.

font-variant-ligatures

Which ligatures the font may form, each value turning its OpenType features on or off as Chrome does.

common-ligatures turns on liga and clig, discretionary-ligatures dlig, historical-ligatures hlig and contextual calt, and each no- value turns the same ones off. none turns all five off, and normal leaves the font's own defaults. Letter spacing other than 0 turns all five off whatever this says, as in Chrome.

font-variant-east-asian

East Asian glyph forms, each turning on the font's OpenType feature as Chrome does.

jis78, jis83, jis90 and jis04 turn on jp78, jp83, jp90 and jp04; simplified smpl, traditional trad, full-width fwid, proportional-width pwid and ruby ruby. They change the glyphs only in a font with the features, a Japanese or Chinese one; in any other the text prints as it is.

font-variant-alternates

Alternate glyphs, by keyword or by the names an @font-feature-values rule gives them.

historical-forms turns on the font's hist feature, as in Chrome. The functions take names an @font-feature-values rule for the font's family sets: stylistic() turns on salt, styleset() ss01 to ss20, character-variant() cv01 to cv99 with its value, swash() swsh and cswh, ornaments() ornm and annotation() nalt, each at the number its name stands for. A name no rule sets turns nothing on, as in Chrome.

import pdf from 'daeepdf'

const html = `<style>
  @font-face { font-family: Inter; src: url('/fonts/inter-var.ttf'); }
  @font-feature-values Inter { @styleset { clear: 2; } }
  body { font: 12pt Inter; }
  .code { font-variant-alternates: styleset(clear); }
</style>
<p class="code">Il1 O0</p>`
const file = await pdf.render(html)
// The capital I, small l and 1 print in Inter's disambiguating forms (ss02).
font-variant-position

Superscript and subscript forms, from the font's sups and subs features.

super turns on sups and sub turns on subs, after every other feature. A character the font has no such form for prints at its normal size and place, as in Chrome's print: nothing is synthesized. For raised or lowered text in any font, use vertical-align with a smaller font-size.

font-feature-settings

OpenType features by tag, applied after those the other font properties turn on.

daeepdf hands the list to daegun's shaper as written, as in "tnum", "ss01" 1 or "liga" 0, after kerning, ligatures, caps and the font-variant-* forms, so it overrides them, and before letter spacing's ligatures-off and font-variant-position, the order Chrome applies them in. A feature the font lacks does nothing. It applies in lines, first letters, list markers and vertical text, and under a filter or mask.

font-variation-settings

Sets a variable font's axes directly, after everything else that sets them.

daeepdf draws each run at the point in the font's design space Chrome's print uses: the weight, stretch, slant and optical size the other properties give, then the @font-face rule's own font-variation-settings, then the element's, a later value for an axis winning. Values are clamped to the font's axes, and an axis it doesn't have is ignored. Each point the document uses embeds an instance of its own.

import pdf from 'daeepdf'

const file = await pdf.render(`<style>
  @font-face { font-family: Inter; src: url('/fonts/inter-var.ttf'); font-weight: 100 900; }
  p { font: 12pt Inter; font-variation-settings: 'wght' 250; }
</style>
<p>Thin text</p>`)
// One subset of Inter, instanced at wght 250
font-kerning

Whether the font's kerning applies.

auto and normal keep the font's kern feature on, as Chrome's print does, and none turns it off, so "AVATAR" sets wider. Glyphs land where Chrome's print puts them either way.

font-optical-sizing

Whether a variable font's optical size axis follows the text's size.

Under auto, the default, daeepdf sets the font's opsz axis to the glyph size in CSS px, as Chrome's print does: 12pt text is drawn at opsz 16, clamped to the axis' range, 14 to 32 in Inter. none leaves the axis at the font's default, and font-variation-settings can set it either way. Each optical size the document uses embeds an instance of its own.

import pdf from 'daeepdf'

const file = await pdf.render(`<style>
  @font-face { font-family: Inter; src: url('/fonts/inter-var.ttf'); }
  p { font: 24pt Inter; }
</style>
<p>Display</p>
<p style="font-optical-sizing: none">Default</p>`)
// Two subsets of Inter: one at opsz 32 for 24pt (32px) text, one at the font's default
font-synthesis-weight

Whether daeepdf may make a bold from a face too light for the weight asked for.

Under auto, the default, text at 600 or more in a face whose weight stops below 600 is drawn bold, its glyphs stroked an em/32 wide in their own color, as Chrome's print does. none prints it at the face's own weight. A variable font that reaches the weight needs no synthesis.

font-synthesis-style

Whether daeepdf may slant a face that has no italic of its own.

Under auto, the default, text asking for italic, or an oblique of 14° or more, in a face that can't reach that slant is sheared by 0.25, as Chrome's print slants it. none prints it upright, as in Chrome.

font-synthesis-small-caps

Whether daeepdf may make small capitals from a font's capitals.

Under auto, the default, font-variant-caps in a font without the feature for it is drawn as capitals at 70% of the size, as font-variant-caps says. none prints the text as written, lowercase at full size, as in Chrome.

src

The @font-face descriptor naming a font's file, which daeepdf fetches and embeds.

daeepdf reads the src of each @font-face rule in the template's own <style> blocks and takes one url() from it: the first whose format() says truetype, opentype or collection, or whose path ends in .ttf, .otf or .ttc, else the first url() listed. local() entries are passed over. So one list can serve a WOFF2 to the browser and a TTF to daeepdf.

The file is fetched in the browser, so it must be served over HTTP or HTTPS, and arrive within loadTimeout. daeepdf tells the format from the file's own bytes: TTF, OTF and the first font of a TTC embed, CFF2 included. A file that fails to fetch or arrives too late, one over 64 MB (font-file), and a WOFF, a WOFF2 or any other format aren't embedded, each with a 'font-not-loaded' warning saying why. Text in that family then takes the next declared family in its list, or is left out with 'font-not-declared', or prints in fallbackFont.

import pdf from 'daeepdf'

const file = await pdf.render(`<style>
  @font-face {
    font-family: Inter;
    src: url('/fonts/inter-var.woff2') format('woff2'), url('/fonts/inter-var.ttf') format('truetype');
  }
  p { font: 12pt Inter; }
</style>
<p>From the TTF</p>`)
file.warnings // []: daeepdf took the TTF and never asked for the WOFF2

const bad = await pdf.render(`<style>
  @font-face { font-family: Logo; src: url('/images/logo.png'); }
</style>
<p style="font-family: Logo">Left out</p>`)
bad.warnings.map((w) => w.code) // ['font-not-loaded', 'font-not-declared']

Lists and generated content

List markers, the content of ::before, ::after and ::marker, and the counters and quotes they draw on. daeepdf counts and draws these itself, by CSS Lists 3 and CSS Counter Styles 3 as Chrome implements them, in the template's declared fonts. Their text goes into the PDF's text, so a copied list keeps its numbers.

list-style-type

The marker before each list item, which daeepdf draws: a shape, the item's number in a counter style, or a string.

disc, circle, square, disclosure-open and disclosure-closed are drawn as shapes, sized from the marker font's ascent as Chrome draws them, so a font without • doesn't matter. Every other predefined style of CSS Counter Styles 3 writes the number, from decimal and lower-roman to armenian, hebrew, cjk-decimal and japanese-formal, as does a style from the template's own @counter-style rules, with its prefix and suffix. A quoted string is drawn as written, and none draws nothing.

Numbers come from the list-item counter in document order, so start, reversed, value and nested lists number as in Chrome. A value a style can't write, a Roman numeral past 3999, goes to its fallback, decimal in the end, and a name no style has, upper-greek among them, is decimal, as in Chrome.

The marker is text in the marker's font, falling back per character, its digits tabular. In tagged output a list states its numbering: Disc, Circle, Square, Decimal, the Roman and alphabetic styles, else Ordered or Unordered.

import pdf from 'daeepdf'

const file = await pdf.render(`<style>
  @font-face { font-family: Inter; src: url('/fonts/inter-var.ttf'); }
  body { font: 12pt Inter; }
</style>
<ol start="3" style="list-style-type: lower-roman"><li>Scope</li><li>Terms</li></ol>
<ul style="list-style-type: '– '"><li>Draft</li></ul>`)
// The markers are text: 'iii.', 'iv.' and '–'
list-style-position

Whether the marker hangs outside the item's box or starts its first line.

outside, the default, hangs the marker before the item's border box on its first line, after it in a right-to-left list, whatever the item's padding, indent or alignment, as Chrome draws it. inside sets it at the start of the first line's content, wherever that line is aligned. Either way it sits on the first line's baseline.

list-style-image

An image in place of the marker.

A url() image, image-set() included, prints at its own size with its bottom on the first line's baseline, 7px before the item. A gradient, which has no size of its own, is a square half the marker font's ascent wide. An image that doesn't load leaves the list-style-type marker in its place, as in Chrome, and ::marker content other than normal wins over it.

content

What ::before, ::after and ::marker hold, which daeepdf lays out and prints as real text and images.

daeepdf stands a real box carrying the pseudo-element's computed style in its place, so its content lays out, wraps and prints like any other text: strings, their CSS escapes decoded, counter() and counters() in any counter style, attr(), the quote keywords that quotes fills, and images, url() and gradients, sized as Chrome sizes them. On ::marker it replaces the marker, and none removes it.

A list holding a term daeepdf can't resolve is dropped whole, rather than printing raw CSS. Alt text after a /, as in content: url(icon.svg) / "Warning", makes the content a tagged Figure with that alt text; an empty one marks it decorative. Its text needs a declared font, like any text.

import pdf from 'daeepdf'

const file = await pdf.render(`<style>
  @font-face { font-family: Inter; src: url('/fonts/inter-var.ttf'); }
  body { font: 12pt Inter; }
  ol { list-style: none; counter-reset: item; }
  li { counter-increment: item; }
  li::before { content: counters(item, ".") ") "; }
  a::after { content: " (" attr(href) ")"; }
</style>
<ol><li>Terms<ol><li>Payment</li></ol></li></ol>
<p><a href="https://example.com">Example</a></p>`)
// The PDF's text reads '1) Terms', '1.1) Payment' and 'Example (https://example.com)'
quotes

The marks open-quote and close-quote insert, and those a <q> prints.

A list of string pairs, the outer pair first, each level of quotes in the document taking the next pair. auto, the default, takes Chrome's marks for the language of the nearest lang, a <q>'s parent's: “ ” and ‘ ’ for English and for any language Chrome doesn't name, „ “ for German, « » for French, 「 」 for Japanese and so on. none prints no marks, and no-open-quote and no-close-quote change the level without one.

import pdf from 'daeepdf'

const file = await pdf.render(`<style>
  @font-face { font-family: Inter; src: url('/fonts/inter-var.ttf'); }
  p { font: 12pt Inter; quotes: auto; }
</style>
<p lang="de">Er <q>sagte</q> nichts.</p>`)
// German marks: 'Er „sagte“ nichts.'
counter-reset

Starts a new instance of a counter, at 0 or the value given.

The instance is in scope for the element, its descendants and its following siblings, and one an earlier sibling made is replaced rather than nested, as CSS Lists 3 says. Counters hold 32-bit values, as in Chrome.

A list, <ol>, <ul> or <menu>, resets list-item for its items unless the author's counter-reset names list-item. contain: style scopes counters as Chrome does, and a table's repeated header and footer rows don't count.

counter-increment

Adds 1, or the step given, to a counter's innermost instance.

It applies after counter-reset and before counter-set on the same element or pseudo-element, and a pseudo-element's increment counts for content after it. With no instance in scope it makes one, as if reset to 0 first. A list item steps list-item by 1, or by −1 in a reversed list, unless the author's counter-increment names list-item.

counter-set

Sets a counter's innermost instance to a value.

It applies after counter-reset and counter-increment on the same element, so counter-increment: sec with counter-set: sec 9 leaves 9, as in Chrome. With no instance in scope it makes one. On a list item, counter-set: list-item sets the item's number, as its value attribute does.

import pdf from 'daeepdf'

const file = await pdf.render(`<style>
  @font-face { font-family: Inter; src: url('/fonts/inter-var.ttf'); }
  body { font: 12pt Inter; counter-reset: sec; }
  h2 { font-size: 12pt; counter-increment: sec; }
  h2::before { content: "§" counter(sec, upper-roman) " "; }
  .annex { counter-set: sec 9; }
</style>
<h2>Scope</h2>
<h2 class="annex">Annex</h2>`)
// The headings print '§I Scope' and '§IX Annex'

Pages, columns and tables

Chrome lays the template out on one long sheet, and daeepdf's own pagination then moves what each page's end would cut, as Chrome's print moves it: a line whose line box crosses the end, an image, a box that avoids breaks, a table row that can't split there. Forced breaks, avoid before, after or inside a box, orphans and widows steer it. Columns and tables are laid out by Chrome; daeepdf draws column rules itself, resolves a collapsed table's borders, and repeats a table's header and footer rows on each page it reaches.

break-before

Starts a new page before the box with page, left, right, recto or verso; avoid keeps it with the box before.

daeepdf's pagination puts a forced break where Chrome's print puts it: the box starts the next page, its top margin kept. All five values break once. Neither daeepdf nor Chrome's print adds a blank page to land a box on a left or right page, and a break before the document's first box adds no blank page either. The legacy page-break-before: always computes to page and works the same.

It takes effect only between block-level boxes in flow, as in Chrome: not on an inline or inline-block box, a float, an absolutely positioned box or display: contents. A break on a table cell falls at its row, and one on any item of a row flex container, a line of a wrapping one or a grid row falls before that whole row, the first row's before the container, as Chrome's print breaks it. A column flex container's items break one by one. column breaks a column of a multi-column box, which Chrome's layout does itself, and doesn't start a page.

avoid and avoid-page keep the box on the page of the box before it. When a page's end falls between them, the break moves back to the latest place on that page that avoids none, as in Chrome's print: between the last lines of the box before, when orphans and widows both hold there, else before that box, which goes on with this one. A first child's value counts for its parent, and a table row takes it too. The legacy page-break-before: avoid is the same.

import pdf from 'daeepdf'

const html = `<style>
  @font-face { font-family: Inter; src: url('/fonts/inter-var.ttf'); }
  body { font: 12pt Inter; }
  h1 { break-before: page; }
</style>
<h1>Chapter 1</h1><p>It begins.</p>
<h1>Chapter 2</h1><p>It goes on.</p>`
const file = await pdf.render(html)
file.pages // 2: the first chapter opens page 1, with no blank page before it
break-after

Starts a new page after the box with page, left, right, recto or verso; avoid keeps it with the box after.

The next box starts a new page, as with break-before on it, and the same rules apply: block-level boxes in flow only, and one page for all five values. A break after the document's last box adds no blank page, and an empty element, an <hr> say, still breaks. A break after a box's last child reaches the box after its parent, through display: contents too. On a row flex container's or a grid's item it falls after the item's whole row, the last row's after the container.

avoid and avoid-page keep the box on the page of the box after it, as break-before: avoid describes: a heading that a page's end would leave at the foot of a page goes on to the next with its paragraph, as the example shows, and a run of headings goes together. A last child's value counts for its parent.

import pdf from 'daeepdf'

const html = `<style>
  @font-face { font-family: Inter; src: url('/fonts/inter-var.ttf'); }
  body { font: 12pt/1.5 Inter; }
  .spacer { height: 800pt; }
  h2 { font: bold 12pt/1.5 Inter; margin: 0; break-after: avoid; }
</style>
<div class="spacer"></div>
<h2>Delivery terms</h2>
<p>Goods ship within 5 working days of payment, by tracked post, to the address on the order.</p>`
const file = await pdf.render(html)
// The paragraph doesn't fit below the heading, so the heading starts page 2 with it.
break-inside

avoid and avoid-page move a box that a page's end would cut to the next page, whole.

A box that avoids breaks inside and crosses a page's end starts the next page instead, as in Chrome's print. It works on any block-level box, and on a table row, which otherwise splits at the page's end as Chrome splits it. avoid-column and avoid-region don't keep a box off a page's end. A forced break inside such a box still splits it there.

A box too tall for a page still has to split. As in Chrome's print, it first moves to the top of the next page, unless it starts its page already, and splits from there.

import pdf from 'daeepdf'

const html = `<style>
  @font-face { font-family: Inter; src: url('/fonts/inter-var.ttf'); }
  body { font: 12pt/1.5 Inter; }
  .spacer { height: 760pt; }
  .card { break-inside: avoid; border: 1pt solid #999; padding: 8pt; }
</style>
<div class="spacer"></div>
<div class="card"><b>Order 1042</b><br>2 x Notebook, A5<br>1 x Fountain pen<br>Total: 34.00 EUR</div>`
const file = await pdf.render(html)
// The card would straddle the page's end, so it starts page 2, whole.
orphans

The fewest lines of a block's text that stay at the foot of a page before a break, 2 by default.

When a page's end would leave fewer lines above it, the whole run of text moves to the next page, with its block when the run starts the block, as Chrome's print moves it. With a page's end two lines into an 80-word paragraph, orphans: 3 moved the paragraph whole and the default split it after 27 words, on the same pages as Chrome's print.

Lines are counted per run of a block's own text: a nested block starts a new run, and an inline image or inline-block is one line. It applies in table cells and list items as in any block, and a row whose cell can't keep its first lines above a page's end moves whole. orphans: 1 lets a single line stay.

widows

The fewest lines of a block's text that carry over to the top of the next page, 2 by default.

When a page's end would leave fewer lines below it, the break moves up so that many go over together, as long as orphans lines still stay behind, as in Chrome's print. With a page's end five lines into a seven-line paragraph, widows: 3 moved the break up a line, so four lines stayed and three went over, on the same pages as Chrome's print.

It counts lines as orphans does, per run of a block's own text.

column-count

Read for the column rules and the page breaks: a box fills its columns to a page's end and goes on below.

Chrome lays the columns out and daeepdf prints each line where it landed. daeepdf reads column-count and column-width itself to find the used number of columns, which places the column rules (see column-rule-style).

A multi-column box crossing a page's end fills its columns one after another up to the end, and the rest goes on at the top of the next page, balanced there if the box ends there, as Chrome's print fragments it. A numbered list in columns counts on across the break, and the box's border, padding and margin are cut at it, as box-decoration-break: slice cuts them. A column-span: all element breaks the box into column sets as Chrome's do. A vertical box on a horizontal page isn't split into its columns: it goes whole, as any box whose writing mode differs from its parent's does (see writing-mode).

column-width

Read with column-count for the used number of columns, which places the column rules.

Chrome fits as many columns at least this wide as the box holds, and daeepdf works the count out the same way, as CSS Multi-column defines it, to place a rule in each gap. A box with column-width breaks across pages as one with column-count does (see column-count).

column-gap

Read to center each column rule in its gap; the layout itself is Chrome's.

normal is 1em, as in Chrome, and a percentage is of the box's content width. daeepdf reads the gap only for a multi-column box's rules; a flex or grid gap reaches the PDF through the layout.

column-rule-width

Draws column rules this wide, as vectors; 0 draws none.

A rule is drawn in each gap between two columns that hold content, centered in the gap and as tall as the box's content box, as Chrome draws it, and a box asking for more columns than its content fills draws none past the last. A double rule under 3px draws solid, as in Chrome.

In a vertical writing mode the columns stack down the page, and each rule runs across it between two of them, as in Chrome's print.

column-rule-style

Draws column rules in any border style: solid, dashed, dotted, double, groove, ridge, inset or outset.

Dashes and dots follow Chrome's pattern, fitted so a rule starts and ends on a dash. A rule draws its 3D styles as a collapsed table's border does, as CSS says: inset as ridge and outset as groove, in Chrome's shades. none and hidden draw no rule.

column-rule-color

The rules' color, translucent ones included.

Its alpha is kept as the rule's opacity in the PDF, and the 3D styles take their light and dark shades from it as Chrome computes them. A transparent color draws nothing.

border-collapse

collapse makes daeepdf resolve the table's borders itself and draw one per edge of its grid.

In a collapsed table, the table, its rows, row groups, columns and cells draw none of their own borders. Each edge of the grid draws one, the winner among the parts meeting there as CSS 2.1 resolves it: hidden wins, then the widest, then the style ranked higher (double, solid, dashed, dotted, ridge, outset, groove, inset), then the cell before its row, row group, column, column group and table. Each is centered on its grid line and painted above the parts' backgrounds, as Chrome paints it, right-to-left tables and 3D styles included.

On the pages a table continues onto, the borders stay those resolved on page 1, a border the break cuts split in Chrome's halves, and a repeated header or footer row draws its borders again. A collapsed table and its cells take no border-image. In the default separate mode, each cell draws its own border box, border-spacing apart.

With a caption, the table's background and border cover its grid only, the caption outside them, as Chrome's print paints them (see caption-side).

border-spacing

Read by the layout, and by daeepdf's pagination for the space a break leaves between rows.

Chrome spaces the cells and daeepdf draws them where they land. Its pagination reads the vertical spacing for the rows it moves at a page's end, the room a repeated footer takes, and a hidden row's space. In a collapsed table it is 0.

A <thead> repeated on a later page starts at the page's top, as in Chrome's print, the spacing a page's end falls in dropped, whatever the spacing. To get there daeepdf splits the row group at the break, as an empty group adds no spacing, so a selector such as tbody + tbody can match the rows after a break.

caption-side

Read by the layout, and by daeepdf's pagination to know whether a caption sits above the table's rows.

Chrome places the caption above or below the table, and daeepdf prints it there. A bottom caption follows the last row, on the table's last page. The pagination reads the side for where the table starts: a forced break before a table's first row moves the whole table unless a caption sits above the row, and a collapsed table's repeated header leaves room for the table's top border from below a top caption.

The table's border and background go around its rows alone, the caption outside them at either side, as Chrome's print paints them, separated or collapsed.

Transforms and effects

A 2D transform, opacity, a blend mode and a clip-path shape are vector operations in the PDF, so what they apply to stays text, paths and sharp images. A filter or a mask has no PDF operator: the element is drawn as one image at 216 dpi, as Chrome draws it, with its text written invisibly over the image so it can still be selected and searched, and its links and form fields live above it. A 3D transform has no flat form, so the element prints where it would untransformed, with an 'unsupported-css' warning.

transform

Draws a 2D transform as a matrix in the PDF, about transform-origin; a 3D one prints untransformed.

A 2D transform, rotate(), scale(), skew(), translate() or matrix(), prints as Chrome draws it, and so does a 3D function whose result is flat, such as translate3d(30px, 0, 0) or translateZ(0). The element and all it holds are drawn untransformed and placed by one matrix, so text stays text, vectors stay vectors and images stay sharp. A link's or form field's area becomes the box around its transformed area, as a PDF annotation can't turn.

A transform whose matrix isn't flat, from rotateX(), rotateY(), perspective() or a matrix3d() with depth, has no 2D form. daeepdf prints the element where it would be untransformed, its own 2D part left out too, and warns with 'unsupported-css' once per export, where Chrome's print draws the projection.

It applies to block-level and atomic inline boxes, not to an inline box, as in Chrome. A transformed box starts a stacking context and holds its position: fixed descendants, which print once inside it instead of on every page. The pivot and translate() percentages use the box transform-box names, the border box by default.

Under a rotation the text is still text in the file, in its order. Some extractors, poppler's among them, break a line that isn't level into pieces, as the example shows.

import pdf from 'daeepdf'

const html = `<style>
  @font-face { font-family: Inter; src: url('/fonts/inter-var.ttf'); }
  body { font: 12pt Inter; }
  .stamp { display: inline-block; margin: 40pt; transform: rotate(-12deg); border: 2pt solid #c00; }
</style>
<p class="stamp">Paid in full</p>`
const file = await pdf.render(html)
// The words are still text, turned and in order; poppler's text breaks the turned line apart.
translate

Moves the element, before rotate, scale and transform apply, as CSS orders them.

One or two lengths or percentages, of the border box's width and height, print as Chrome draws them. A third, z value other than 0 makes it 3D: the element prints untransformed, its x and y moves left out too, with an 'unsupported-css' warning (see transform). It applies where transform does.

rotate

Turns the element about transform-origin, after translate and before scale and transform.

An angle, or a turn about the z axis written as z 30deg or 0 0 1 30deg, which Chrome computes to the same angle, prints as Chrome draws it. A turn about the x or y axis, or another axis, is 3D: the element prints untransformed with an 'unsupported-css' warning (see transform).

scale

Scales the element about transform-origin, after translate and rotate and before transform.

One number or percentage scales both axes, two scale each, and both print as Chrome draws them; text scales as glyphs, not as an image. A third value other than 1 is 3D, so the element prints untransformed with an 'unsupported-css' warning (see transform).

transform-origin

The pivot of transform, rotate and scale, placed from the reference box's top left corner.

daeepdf reads the origin Chrome computes, in px, and places it from the reference box's top left corner, so keywords, lengths and percentages print as Chrome draws them, 0 0 and right bottom included. A z value is left out, as no depth is drawn.

On an HTML box under transform-box: content-box or fill-box the origin is placed from the content box instead, as in Chrome (see transform-box). In an inline <svg>, a shape's origin is folded into its matrix as its transform-box places it.

transform-box

The box a transform's origin and percentages resolve against, on HTML boxes and SVG shapes alike.

In an inline <svg>, a CSS transform on a shape is written into the shape's own matrix with its transform-origin, measured from the user space's origin for view-box, the default, or from the shape's fill bounding box for the other values. The shape stays a vector path, as Chrome draws it.

On an HTML box, content-box and fill-box resolve the pivot and translate percentages against the content box, and border-box, the default, stroke-box and view-box against the border box, as Chrome's print turns it.

transform-style

Read only for which box holds position: fixed descendants: one with preserve-3d holds them.

daeepdf draws no depth, so preserve-3d changes nothing in how the box or its children print, and a child's 3D transform prints untransformed with an 'unsupported-css' warning (see transform). As in Chrome's print, preserve-3d makes the box hold its fixed descendants, which then print once, inside it, instead of on every page.

perspective

Read only for stacking and fixed descendants; the 3D transforms it gives depth to print untransformed.

perspective sets how a child's 3D transform is projected, and daeepdf draws no 3D transforms: the child prints where it would untransformed, with an 'unsupported-css' warning, where Chrome's print draws it in perspective. perspective-origin isn't read.

On its own the property starts a stacking context and holds position: fixed descendants, as in Chrome's print, and daeepdf reads it for those.

import pdf from 'daeepdf'

const html = `<style>
  @font-face { font-family: Inter; src: url('/fonts/inter-var.ttf'); }
  body { font: 12pt Inter; }
  .stage { perspective: 600px; }
  .card { transform: rotateY(25deg); border: 1pt solid; padding: 12pt; }
</style>
<div class="stage"><div class="card">Front of the card</div></div>`
const file = await pdf.render(html)
file.warnings.map((w) => w.code) // ['unsupported-css']: the card prints flat, untransformed
opacity

Fades the element and all it holds as one layer, a transparency group in the PDF, as Chrome's print does.

An element with opacity below 1 is drawn as an isolated transparency group, faded as a whole, as Chrome composites it: where its contents overlap, only the top one shows, and its text keeps its own color over its background before the fade. Nested opacities each fade their own group. The text inside stays text, tagged in the group, and its links and fields stay live above it.

Under a filter or a mask the element is drawn as one image, which takes the opacity whole, as in Chrome. In an SVG drawn as vectors, a group's opacity is multiplied into its shapes.

opacity: 0 leaves the element out of the PDF, its text, links and form fields with it, as Chrome's print does; its counters still count and its ids are still link targets. color: transparent is another thing: the text is invisible but stays in the PDF's text (see color).

import pdf from 'daeepdf'

const html = `<style>
  @font-face { font-family: Inter; src: url('/fonts/inter-var.ttf'); }
  body { font: 12pt Inter; }
  .faded { opacity: 0; }
  .hidden { visibility: hidden; }
</style>
<p class="faded">Draft: price to be agreed</p>
<p class="hidden">Internal: cost 12.40</p>`
const file = await pdf.render(html)
// Neither line shows, and neither one's text is in the PDF
mix-blend-mode

Blends the element with what lies under it in its stacking context, in all 15 of the PDF's modes.

multiply, screen, overlay, darken, lighten, color-dodge, color-burn, hard-light, soft-light, difference, exclusion, hue, saturation, color and luminosity are blend modes in the PDF too, so the element stays vectors and text. plus-lighter prints as normal, as Chrome's print draws it.

A stacking context with a blending element inside is drawn as an isolated transparency group, so the blend mixes only with what that context draws, as CSS defines. The blending element is a group of its own, blended as one finished layer, as in Chrome's print: children that overlap inside it don't blend with each other.

Under a filter or a mask, the canvas draws the same blends. In an SVG drawn as vectors, a shape's blend works the same way, and an SVG element that isolates it, by isolation, opacity or a blend of its own, is drawn as one group.

filter

Draws the element as one image through the filter, at 216 dpi, its text written invisibly over it.

A PDF has no filters, so daeepdf draws the element on a canvas as it would without one, then runs the filter over it, as Chrome draws it: blur(), brightness(), contrast(), drop-shadow(), grayscale(), hue-rotate(), invert(), opacity(), saturate() and sepia(), chained in order. The image covers the element and all it paints past its box, grown by a blur's or shadow's reach or a <filter>'s region, at 3 pixels per point (216 dpi), scaled down past 16 megapixels.

The text is in the image as pixels, and also written invisibly over it, so it can be selected, searched and read aloud, and a blur() hides nothing from anyone reading the file, as the example shows; with accessible: false it is pixels only. Links and form fields stay live above the image.

filter: url(#id) naming an SVG <filter> in the page runs the image through it, by Chrome's own SVG filters, its region and lengths laid on the element's border box in CSS px, as Chrome lays them, and the list can mix url() with the functions. A url() naming no <filter> is passed over and the rest of the list applies, as in Chrome's print. A primitive in objectBoundingBox units measures the image's box rather than the element's.

With a mask too, the element is filtered first and then masked, and a clip-path cuts the result. A filter holds the element's position: fixed descendants, as in Chrome. On an element inside an <svg>, a filter sends the whole SVG to the image path (see the SVG area).

import pdf from 'daeepdf'

const html = `<style>
  @font-face { font-family: Inter; src: url('/fonts/inter-var.ttf'); }
  body { font: 12pt Inter; }
  .blurred { filter: blur(4px); }
</style>
<p class="blurred">Card number 4111 1111 1111 1111</p>`
const file = await pdf.render(html)
// The number prints blurred, as an image, and is still in the PDF's text.
clip-path

Clips the element to a shape, a box, an SVG <clipPath> or a shape() path, as a vector clip.

inset(), circle(), ellipse(), polygon(), with evenodd too, and path() print as Chrome clips them, and so do rect() and xywh(), which Chrome computes to inset(). The shape is laid out on the border box, or on the box written beside it: margin-box, padding-box, content-box, and on an HTML box fill-box, stroke-box and view-box, which mean the border box. It cuts the element's own box, shadow and all it holds, and what it hides wholly is left out of the PDF, links and form fields included.

url(#id) naming an SVG <clipPath> in the page clips to its shapes, laid out in CSS px from the border box's corner, or on the border box itself with clipPathUnits="objectBoundingBox"; their transforms, <use> and a lone shape's clip-rule are read, and text in it leaves the element unclipped. A box on its own, such as padding-box, clips to that box, its corners curved as the border radius makes them. shape() is read command by command, arc, curve and smooth included. Any value makes a stacking context. On an <svg> or an element inside one, a value daeepdf doesn't draw itself is left in the SVG, which then goes to the image path, where Chrome draws it.

Over several pages, each page's piece of the element is clipped on its own, as Chrome's print clips it. A shape repeated on the pages it spans copies at most 1,000,000 path segments per export, and later copies clip to their bounding box, with a 'limit-reached' warning.

mask

The shorthand: daeepdf reads the mask longhands it sets, and url() naming an SVG <mask> masks by it.

On an HTML box, mask sets mask-image, mask-position, mask-size, mask-repeat, mask-composite and the rest, and daeepdf reads those, so a mask of gradients and image files prints as they say.

mask: url(#id) naming an SVG <mask> element masks the element by it, as Chrome's print does: the <mask> is drawn over the border box, its content in user space or objectBoundingBox units, its styles and what it references with it. An id that names no <mask> masks nothing. Its text is written invisibly where it stood, as for any masked element.

On an element inside an <svg>, a mask sends the whole SVG to the image path, where Chrome draws it.

import pdf from 'daeepdf'

const html = `<style>
  @font-face { font-family: Inter; src: url('/fonts/inter-var.ttf'); }
  body { font: 12pt Inter; }
  .soft { mask: url(#fade); }
</style>
<svg width="0" height="0">
  <mask id="fade" maskContentUnits="objectBoundingBox"><rect width="1" height="1" fill="white"/></mask>
</svg>
<p class="soft">Masked by an SVG mask</p>
<p>Plain text</p>`
const file = await pdf.render(html)
file.warnings // []: the paragraph prints through the <mask>, which shows all of it
// Its text is in the PDF, written over the masked image.
mask-image

Masks the element by its layers' alpha, drawing it as one image at 216 dpi, its text written invisibly over it.

Each layer is a gradient, linear, radial or conic, repeating or not, a url() image, an SVG one included, or an image-set(), of which daeepdf takes the option of highest resolution. Layers are laid out over the border box as backgrounds are, by mask-size, mask-position and mask-repeat, and combined by mask-composite; the first 32 are drawn. The element is drawn as it would be without a mask on a canvas at 3 pixels per point, kept where the mask is opaque, and cut to the border box, as Chrome draws it.

As under a filter, the text is also written invisibly over the image, and links and form fields stay live above it. A filter and a mask together are filtered first, then masked.

A layer masks by its alpha, or by its luminance under mask-mode: luminance (see mask-mode). mask-origin and mask-clip aren't read: layers are placed and cut at the border box, their default.

A layer that doesn't load, a missing file or a cross-origin image served without CORS headers, adds nothing, with an 'image-skipped' warning. A mask none of whose layers paints leaves the element unmasked, as Chrome's print shows it.

mask-size

Sizes each mask layer's tile, as background-size sizes a background's.

auto, contain, cover, lengths and percentages of the border box, one per layer, are read as Chrome computes them. An SVG image with only a viewBox takes its ratio, and a tile of no size adds nothing.

mask-position

Places each mask layer's first tile in the border box, as background-position places a background's.

Keywords, lengths, percentages and the four-value form resolve against the border box less the tile, so center centers it, as in Chrome. Layers are placed in the border box whatever mask-origin says.

mask-repeat

Tiles each mask layer: repeat, repeat-x, repeat-y, no-repeat, space or round, as Chrome tiles it.

Tiles are laid out as a background's are (see background-repeat), and any number of them is drawn as one pattern fill per layer. With no-repeat, the box outside the one tile is masked out.

mask-composite

Combines each mask layer with the layers below it, as Chrome's print does: add, subtract, intersect or exclude.

Layers combine from the bottom up, each with the result of those below it, inside its own tiles only, as Chrome's print composites them: add lays the layer over them, subtract keeps it where they're clear and intersect where they're opaque. Outside the layer's tiles the layers below are left as they are, so a small circle subtracted from a layer covering the box prints the box with a hole.

exclude prints as add, as Chrome's print draws it (its PDF backend has no exclusive or); on screen Chrome shows only where exactly one of the two is opaque.

-webkit-mask-image

The prefixed mask-image, one property with it in Chrome, which daeepdf reads the same way.

Chrome keeps -webkit-mask-image and mask-image as one property, so either name sets what daeepdf reads, and the two print alike.

-webkit-mask-size

The prefixed mask-size, one property with it in Chrome, which daeepdf reads the same way.

Chrome keeps -webkit-mask-size and mask-size as one property, so either name sets what daeepdf reads, and the two print alike.

-webkit-mask-position

The prefixed mask-position, one property with it in Chrome, which daeepdf reads the same way.

Chrome keeps -webkit-mask-position and mask-position as one property, so either name sets what daeepdf reads, and the two print alike.

-webkit-mask-repeat

The prefixed mask-repeat, one property with it in Chrome, which daeepdf reads the same way.

Chrome keeps -webkit-mask-repeat and mask-repeat as one property, so either name sets what daeepdf reads, and the two print alike.

-webkit-mask-composite

The prefixed mask-composite, its old WebKit keywords included, which print as Chrome's print draws them.

Chrome keeps -webkit-mask-composite and mask-composite as one property, so either name sets what daeepdf reads, and the two print alike for add, subtract, intersect and exclude.

Chrome also takes the old WebKit keywords here, and mask-composite computes to them. Each prints as Chrome's print composites it inside the layer's tiles: source-in keeps the layer where those below are opaque, source-out and destination-out cut it out of them, clear clears its tiles, and xor and plus-lighter draw as source-over.

Images and forms

object-fit and object-position place an <img>'s picture in its content box as Chrome places it, for a raster image and for an SVG file drawn as vectors alike. appearance is read for one thing: whether a form control keeps the native look daeepdf draws for it. The controls themselves become form fields in the PDF (see fillable).

object-fit

Fits an <img>'s picture into its content box as Chrome fits it: fill, contain, cover, none or scale-down.

The picture is sized from its natural size against the content box, inside any padding and border, and cut to the content box where it overflows, the corners following border-radius. Every value prints as Chrome's print draws it, for a raster image and an SVG file alike; an SVG is drawn as vectors in the box it's fitted to where daeepdf can draw it whole (see the SVG area).

object-position

Places the fitted picture in its content box, at its center by default, as Chrome places it.

Keywords, lengths, percentages and the four-value form, such as right 10px bottom, resolve against the room the box leaves around the picture, so 100% 100% puts it in the bottom right corner, and with cover or none the picture is cut on the sides it overflows. It moves nothing with fill, which leaves no room.

appearance

none turns off the native look daeepdf draws for a form control, its check mark too, as Chrome's print does.

Chrome draws an <input>, <button>, <select> or <textarea> with a native look until you give it a border or a background, and daeepdf draws its own likeness of it: a 1px gray border with 2px corners, and a gray square or circle for a checkbox or radio button. appearance: none turns that off, so the control prints its own CSS box only, as Chrome draws it. -webkit-appearance is the same property in Chrome.

The controls are still form fields. A checked checkbox or radio button with its native look prints daeepdf's own check mark, a stroke in the control's text color, with fillable: false too, where Chrome's print draws its blue one. Under appearance: none the field draws nothing of its own, so a custom checkbox, one that fills itself when checked, prints as its CSS paints it; its value is still the form's.

SVG

An inline <svg> or an SVG image goes into the PDF as vector paths when daeepdf can draw all of it, and otherwise as one image at 216 dpi that Chrome draws, the image path. Shapes, their geometry, fills, strokes and plain gradients are drawn as vectors; text, markers, clip paths, filters and masks send the whole SVG to the image path, where its text is pixels. Each entry says which. In an inline <svg>, what the page's stylesheet sets counts: daeepdf writes each element's computed values onto a copy of the SVG before it converts it.

fill

Fills a shape as a vector: a color, currentColor, none or a plain gradient; other paint sends the SVG to the image path.

A color in any CSS form, translucent ones included, or currentColor, resolved against the shape's own color, fills the shape as a vector path. url(#id) naming a <linearGradient> or <radialGradient> is a vector shading when the gradient has two stops or more of its own, works in objectBoundingBox units, pads past its ends and takes nothing through href. A gradient in userSpaceOnUse units, one that repeats or reflects, one built through href as design tools export it, a radial one turned against the page, or a <pattern> sends the whole SVG to the image path. A <line> has no fill.

In an inline <svg>, a fill set by the page's stylesheet counts, and an icon filled with currentColor takes its color from the page, as in Chrome.

fill-opacity

Multiplies a shape's fill alpha, as a vector fill's opacity.

A number or a percentage, clamped to 0 to 1, multiplies the fill color's own alpha and the opacity of the shape and its groups, and the result is the fill's opacity in the PDF. On a gradient fill it fades the whole shading.

fill-rule

nonzero or evenodd, the PDF's two fill rules, for a vector fill.

A shape whose path crosses itself, or a path with a hole such as a ring, fills as Chrome fills it under either rule. The rule of a clip-path: polygon() or path() on an HTML box is written in the shape instead.

stroke

Strokes a shape as a vector in a color, currentColor or none; a gradient stroke sends the SVG to the image path.

A color, translucent or not, or currentColor draws a vector stroke, with the width, dashes, caps and joins the other stroke- properties give it. A stroke of no width draws nothing. A stroke with a gradient or a pattern sends the whole SVG to the image path, where Chrome draws it.

stroke-width

The stroke's width in user units, scaled with the shape, for a vector stroke.

Numbers and px, in, cm, mm, Q, pt and pc lengths are read, a percentage is of the viewport's normalized diagonal, and 0 draws no stroke. In an SVG file, a width in em, vw or another relative unit, or a calc(), sends the SVG to the image path; in an inline <svg>, Chrome has already resolved it to px.

The width scales with the shape's transforms and the viewBox, as Chrome scales it. Under a scale that differs by axis, such as a viewBox stretched with preserveAspectRatio="none" or a skewX(), the stroke stretches with the shape, wider along the stretched axis, its dashes too: daeepdf draws it in the shape's own units under its transform, as Chrome does.

stroke-opacity

Multiplies a stroke's alpha, kept apart from the fill's in the PDF.

A number or a percentage, clamped to 0 to 1, multiplies the stroke color's own alpha and the opacity of the shape and its groups. A shape whose fill and stroke differ in opacity draws each at its own, as Chrome draws it.

stroke-dasharray

Dashes a vector stroke, its lengths in user units scaled with the shape.

A list of numbers and lengths, separated by spaces or commas, sets the dashes and gaps, scaled as the width is. none, or a list of zeros, draws a solid stroke, and a negative length makes the list invalid, so the inherited one stays, as in Chrome. A circle's or ellipse's dashes start at 3 o'clock and run clockwise, as SVG draws them.

A shape with a pathLength, or in an SVG file a list holding a word, a relative unit or calc(), sends the SVG to the image path, where Chrome draws the dashes.

stroke-dashoffset

Shifts where a vector stroke's dash pattern starts, in user units scaled with the shape.

A number or a length is read as stroke-width reads one, and in an SVG file a relative unit or a calc() sends the SVG to the image path.

stroke-linecap

butt, round or square caps on a vector stroke, the PDF's own.

They print as Chrome draws them, on the ends of open paths and of each dash.

stroke-linejoin

miter, round or bevel joins on a vector stroke, the PDF's own.

They print as Chrome draws them; a miter join past stroke-miterlimit is beveled.

stroke-miterlimit

How long a miter join may grow before it is beveled, 4 by default, written into a vector stroke.

A number of at least 1, a multiple of the stroke's width, as in SVG and in the PDF. A value under 1, or one with a unit, keeps the inherited limit.

paint-order

Puts a stroke under its fill, as Chrome paints it, on SVG shapes and on stroked HTML text.

With the stroke before the fill, as in paint-order: stroke, the stroke paints first and the fill over it, so a wide stroke shows only its outer half. An SVG drawn as vectors draws the two as separate paths in that order, in an inline <svg> and an SVG file alike, and the value inherits, so a group's order reaches its shapes. On the image path, an SVG with text or markers, Chrome draws it.

HTML text with -webkit-text-stroke draws its stroke from the glyphs' outlines, under the text, which stays text. In vertical text, or where a font's outlines can't be read, the stroke stays over the fill.

vector-effect

non-scaling-stroke keeps a stroke's width and dashes in CSS px, whatever the shape's scale.

The stroke is drawn as wide as its stroke-width in CSS px of the page, its dashes too, through any viewBox and transform, as a vector stroke, and as wide on the image path and in an SVG mask. none, the default, scales them with the shape.

stop-color

A gradient stop's color, read for a vector shading; currentColor takes the stop's own color.

Set as an attribute, in a style attribute or, in an inline <svg>, by the page's stylesheet, it is read for each <stop> of a gradient daeepdf draws as a vector (see fill), in any CSS color form. A stop whose offset is below the one before it takes that one's, as SVG says. An SVG gradient mixes its colors straight, not premultiplied, as Chrome mixes them.

stop-opacity

Scales a gradient stop's alpha, for a vector shading.

A number or a percentage multiplies the alpha of stop-color, so transparent stays black at 0 alpha and a stop at 0.3 fades the shading toward it, as Chrome draws it.

clip-rule

Read only on the image path: a <clipPath> sends its SVG there, where Chrome applies the rule.

clip-rule applies to the shapes inside a <clipPath>, and any <clipPath> in an SVG sends the whole SVG to the image path at 216 dpi, so it prints as Chrome draws it, as pixels. In an inline <svg>, a value the page's stylesheet sets is written onto the copy Chrome draws.

The rule of a clip-path: polygon() or path() on an HTML box is written in the shape instead.

marker-start

Read only on the image path: an SVG with markers goes in as an image, where Chrome draws them.

Draws a marker at the first vertex of a path, line, polyline or polygon. A PDF path has no markers, so any <marker> in an SVG, or one it references from elsewhere in the page, which daeepdf copies in, sends the whole SVG to the image path at 216 dpi, and the markers print as Chrome draws them, as pixels. A reference to an id that doesn't exist draws no marker and leaves the SVG as vectors.

marker-mid

Read only on the image path: an SVG with markers goes in as an image, where Chrome draws them.

Draws a marker at each vertex between the first and the last. A PDF path has no markers, so any <marker> in an SVG, or one it references from elsewhere in the page, which daeepdf copies in, sends the whole SVG to the image path at 216 dpi, and the markers print as Chrome draws them, as pixels. A reference to an id that doesn't exist draws no marker and leaves the SVG as vectors.

marker-end

Read only on the image path: an SVG with markers goes in as an image, where Chrome draws them.

Draws a marker at the last vertex of a path, line, polyline or polygon. A PDF path has no markers, so any <marker> in an SVG, or one it references from elsewhere in the page, which daeepdf copies in, sends the whole SVG to the image path at 216 dpi, and the markers print as Chrome draws them, as pixels. A reference to an id that doesn't exist draws no marker and leaves the SVG as vectors.

d

A <path>'s path data, from the attribute or the CSS d property, drawn as a vector path.

The CSS property takes path("..."), from a stylesheet in an inline <svg> or a style attribute in an SVG file, and wins over the attribute; none draws nothing. Path data is read as Chrome reads it, up to its first error, and the attribute takes path data alone, so d="path(...)" draws nothing, as in Chrome.

x

The left of a <rect>, and the x offset of what a <use> draws, read for a vector path.

A number, a px, in, cm, mm, Q, pt or pc length, or a percentage of the viewport's width, from the attribute or CSS. In an inline <svg> a value the page's stylesheet sets is resolved and written onto daeepdf's copy, and in an SVG file a relative unit such as em sends the SVG to the image path. An <image>, a nested <svg> and a <foreignObject> go to the image path anyway, where Chrome places them.

y

The top of a <rect>, and the y offset of what a <use> draws, read for a vector path.

Read as x is, a percentage of the viewport's height. An <image>, a nested <svg> and a <foreignObject> go to the image path anyway, where Chrome places them.

cx

The x of a <circle>'s or <ellipse>'s center, read for a vector path.

Read as x is, from the attribute or CSS, a percentage of the viewport's width.

cy

The y of a <circle>'s or <ellipse>'s center, read for a vector path.

Read as y is, from the attribute or CSS, a percentage of the viewport's height.

r

A <circle>'s radius, read for a vector path; 0 draws nothing.

Read as x is, from the attribute or CSS; a percentage is of the viewport's normalized diagonal, its diagonal over the square root of 2.

rx

An <ellipse>'s x radius, or a <rect>'s corner radius along x, read for a vector path.

Read as x is. On a <rect>, an absent or auto radius takes ry's, and each is cut to half the side; on an <ellipse>, 0 draws nothing.

ry

An <ellipse>'s y radius, or a <rect>'s corner radius along y, read for a vector path.

Read as y is. On a <rect>, an absent or auto radius takes rx's, and each is cut to half the side; on an <ellipse>, 0 draws nothing.

text-anchor

Read only on the image path: SVG text always goes in as an image, where Chrome aligns it.

start, middle and end print as Chrome aligns them, since daeepdf doesn't convert SVG text to vectors or to PDF text: any <text>, <tspan> or <textPath> sends the whole SVG to the image path at 216 dpi, drawn by Chrome in the template's own fonts. The text is pixels there, so it can't be selected or searched and isn't in the PDF's text, where Chrome's print keeps it as text.

In an inline <svg>, a value the page's stylesheet sets is written onto the copy Chrome draws.

import pdf from 'daeepdf'

const html = `<style>
  @font-face { font-family: Inter; src: url('/fonts/inter-var.ttf'); }
  body { font: 12pt Inter; }
</style>
<svg width="200" height="60" viewBox="0 0 200 60">
  <text x="100" y="35" text-anchor="middle" font-family="Inter" font-size="16">Quarterly sales</text>
</svg>
<p>Below the chart</p>`
const file = await pdf.render(html)
// The SVG prints as an image: its label shows, but isn't in the PDF's text.
dominant-baseline

Read only on the image path: SVG text always goes in as an image, where Chrome sets its baseline.

It prints as Chrome sets it, since daeepdf doesn't convert SVG text to vectors or to PDF text: any <text>, <tspan> or <textPath> sends the whole SVG to the image path at 216 dpi, drawn by Chrome in the template's own fonts. The text is pixels there, so it can't be selected or searched and isn't in the PDF's text, where Chrome's print keeps it as text.

alignment-baseline

Read only on the image path: SVG text always goes in as an image, where Chrome aligns it.

It prints as Chrome aligns it, since daeepdf doesn't convert SVG text to vectors or to PDF text: any <text>, <tspan> or <textPath> sends the whole SVG to the image path at 216 dpi, drawn by Chrome in the template's own fonts. The text is pixels there, so it can't be selected or searched and isn't in the PDF's text, where Chrome's print keeps it as text.

baseline-shift

Read only on the image path: SVG text always goes in as an image, where Chrome shifts it.

sub, super and lengths print as Chrome shifts them, since daeepdf doesn't convert SVG text to vectors or to PDF text: any <text>, <tspan> or <textPath> sends the whole SVG to the image path at 216 dpi, drawn by Chrome in the template's own fonts. The text is pixels there, so it can't be selected or searched and isn't in the PDF's text, where Chrome's print keeps it as text.

flood-color

Read only on the image path: a <filter> sends its SVG there, where Chrome floods with it.

It colors <feFlood> and <feDropShadow>, and any <filter> in an SVG sends the whole SVG to the image path at 216 dpi, so it prints as Chrome draws it, as pixels. In an inline <svg>, a value the page's stylesheet sets is written onto the copy Chrome draws.

flood-opacity

Read only on the image path: a <filter> sends its SVG there, where Chrome applies it.

It fades <feFlood> and <feDropShadow>, and any <filter> in an SVG sends the whole SVG to the image path at 216 dpi, so it prints as Chrome draws it, as pixels. In an inline <svg>, a value the page's stylesheet sets is written onto the copy Chrome draws.

lighting-color

Read only on the image path: a <filter> sends its SVG there, where Chrome lights with it.

It colors <feDiffuseLighting> and <feSpecularLighting>, and any <filter> in an SVG sends the whole SVG to the image path at 216 dpi, so it prints as Chrome draws it, as pixels. In an inline <svg>, a value the page's stylesheet sets is written onto the copy Chrome draws.

Type to search.