Appendix A: Supported HTML tags

Description

The HTML renderer accepts a bounded subset for rich text, structured blocks, tables, and explicitly mapped images

Structure and inline formatting

<p>, <br>Paragraphs and hard line breaks, including legacy paragraph alignment and spacing attributes
<h1> through <h6>Bold block headings with decreasing default sizes
<div>, <section>, <article>, <header>, <footer>, <main>Block containers
<blockquote>Indented block content
<ul>, <ol>, <li>Nested unordered and ordered lists
<b>, <strong>, <i>, <em>Bold and italic text
<sup>, <sub>, <u>Superscript, subscript, underline, double underline, strikeout, and overline
<font>, <span>Legacy font, colour, background, outline, text rendering mode, and rounded background attributes
<a href="...">HTTP, HTTPS, and file hyperlinks

CSS cascade

Rules may appear in <style> elements or inline style attributes

Rules inside @media blocks whose query selects print (print, all, or a query without a media type) and inside @supports blocks apply; @media screen and other at-rules such as @page and @font-face are skipped, and the rules after them still apply. The same applies to <style> elements in SVG

Selectors support tag, class, ID, tag.class, whitespace descendant, > child, + adjacent-sibling, and ~ general-sibling combinators, as well as the :first-child, :last-child, :only-child, and :nth-child() pseudo-classes; attribute presence and value selectors are supported, whilst dynamic pseudo-classes such as :hover never match

Matching declarations use CSS specificity and source order, inline declarations take priority, and !important is honoured within the supported subset

Supported properties include the text, background, font, decoration, alignment, line-height, margin, padding, border, width, height, display and vertical-alignment properties listed below, plus the Flexbox, Grid and footnote properties in their respective sections

page-break-before, page-break-after, break-before and break-after set to always or page end a DrawHTMLTextBox box at that element and return the rest as the continuation; text drawn without a box height ignores them

margin takes one to four values and all four physical longhands; left and right margins reduce the available content width. text-indent moves the first line of a block, letter-spacing adds space after each character and takes part in line breaking, and border-style or the border shorthand may draw the border dashed or dotted

font-family takes a comma-separated list and uses the first family it can draw: a family registered by passing its name as the FontSet argument of SetHTMLNormalFont, SetHTMLBoldFont, SetHTMLItalicFont and SetHTMLBoldItalicFont, then the generic families serif, sans-serif and monospace (also Times New Roman, Arial, Helvetica and Courier New), which map to the standard Times, Helvetica and Courier faces. font-weight, font-style, <b> and <i> then move between the faces of that family; a family without the face asked for keeps its current one

list-style-type and list-style accept none, disc, circle, square, decimal, lower-alpha, upper-alpha, lower-roman and upper-roman, and an <ol type> attribute selects the same numbering; circle and square markers need a Unicode font

Lengths accept pt, px at 0.75 points per pixel, in, cm, mm, pc, q (quarter millimetres), em, rem, ex, ch, percentages, and legacy unitless point values; rem uses the root font size, whilst ex and ch use a documented half-em approximation; font sizes also accept the keyword scale from xx-small through xx-large and the relative larger/smaller scale (1.2 times the parent size)

Static selectors and text values

:not(), :is(), and :where() accept comma-separated compound selectors, including nested supported functions; combinators inside these function arguments are outside this profile

:is() and :not() use the most specific argument, whilst :where() contributes zero specificity

:root selects the first document element and :empty excludes elements with child elements or text, including whitespace

:lang(en) matches an inherited HTML lang value and its hyphenated variants; :lang(*) matches any nonempty language

:link/:any-link match anchors with href; :checked matches ticked checkbox/radio inputs and selected options

:disabled/:enabled apply to supported form controls and honour disabled fieldsets and option groups; :required/:optional reflect the explicit required attribute on inputs, selects, and text areas, without evaluating form validity

The font shorthand accepts optional style and weight followed by size, optional /line-height, and a family list; it resets omitted style, weight, and line height

Text properties accept inherit, initial, and unset within the supported subset; font-weight:lighter selects the normal face of the current family

currentColor resolves foreground, background, and border references against the current inherited foreground colour

Use numeric or percentage RGB channels in comma-separated rgb() colours. HTML text, supported backgrounds, and borders retain alpha from #RGBA, #RRGGBBAA, and CSS colour functions. Fully transparent colours preserve layout without painting. PDF/A-1, PDF/X-1a, and PDF/X-3 output renders partially transparent colours as opaque

text-transform:uppercase, lowercase, capitalize, and none affect rendered text and measurements; capitalisation recognises whitespace and common word-separating punctuation and can continue across inline elements

Calculated lengths and block boxes

calc() supports nested addition, subtraction, scalar multiplication, and scalar division; min(), max(), and clamp() combine compatible lengths

Length parsing rejects mixed dimensions, division by zero, nonfinite results, expressions longer than 4096 bytes, and nesting beyond 32 levels

Ordinary block containers honour one-to-four-value padding and all four padding longhands with normal cascade priority; asymmetric padding survives finite-frame continuations

margin-block/margin-inline, padding-block/padding-inline, and their start/end longhands map to physical edges in the renderer’s horizontal, left-to-right box model

Visibility and semantic inline tags

display:none removes the complete subtree from layout; the HTML hidden attribute also suppresses its subtree

Document metadata in head and title, script content, and template content are not rendered; style elements are still collected for the cascade

del defaults to strikeout, ins to underline, and mark to a yellow background; author CSS can override these defaults

Flexbox

display:flex and display:inline-flex support flex-direction, flex-wrap, flex, flex-grow, flex-shrink, flex-basis, justify-content, align-items, align-self, align-content, gap, row-gap and column-gap

Row containers distribute positive and negative free space per flex line, wrapped rows are measured independently, and column containers distribute an explicit or content-derived height

CSS Grid

display:grid and display:inline-grid support grid-template-columns, grid-template-rows, fixed, percentage and fr tracks, simple repeat() and minmax(), grid-column, grid-row, start and end properties, spans, gaps, row or column auto-placement, and per-item alignment

One container accepts at most 256 direct items and 64 rows or columns; nested content uses the same HTML renderer and layout cache

Footnotes

<footnote>, <aside style="float:footnote">, and <aside role="doc-footnote"> create numbered notes

Finite text boxes reserve the note area at the bottom before laying out later body lines; a reference and note that do not fit together continue to the next frame, and the continuation state preserves numbering

Tables

<table>, <tr>, <td>, and <th> render measured rows with backgrounds, padding, borders, text styles, and colspan up to 64 columns

Columns with a width attribute or CSS width keep it. The remaining columns share the rest of the table width by content, following the CSS automatic table layout: each column's narrowest width (its longest word) and its unwrapped width are measured, short columns stay narrow, and long text gets the remaining room before it wraps; cells spanning several columns widen the columns they cover when their content needs more

rowspan up to 256 rows reserves the covered cells and grows the spanned rows to fit the cell content; colspan covers up to 64 columns

Header cells default to bold text with a light background. Rows of a <thead>, or a first row made only of <th> cells, repeat at the top of each continuation, and a row continues as one atomic unit in the next HTML text box

Adjacent cell borders share their edges. When the table sets border-spacing and does not set border-collapse:collapse, cells are separated by that spacing

A table nested in a cell is laid out within that cell's width with the same rules

Tables also support per-side border widths, styles, and colours (border-top, border-right, border-bottom, border-left), table-layout:fixed column sizing, <caption> (including caption-side:top and caption-side:bottom), and <colgroup> / <col> column width and background specifications

Paginated output retains table column proportions and leading headers across pages, keeps fitting rowspan groups together, and continues oversized rows or spanning groups with bounded cell content; see DrawHTMLPages for the supported fragmentation profile and limits

Images

<img src="name"> draws an image previously bound with SetHTMLImage

The renderer supports width, height, margin, padding, border, background, and left, centre, or right alignment; one missing dimension preserves the natural aspect ratio, and omitted dimensions use 0.75 points per source pixel

Image sources never trigger network or file access, measurement does not register resources, and repeated use reuses the bound image XObject

Bounds and recovery

One HTML input accepts at most 2048 stylesheet rules, 256 bytes per selector, 4096 bytes per declaration block, 4096 table rows, and 4096 table cells

Unknown properties, selectors, tags, and attributes are ignored while surrounding text is preserved; character references are decoded and malformed nesting is closed conservatively

Example

var
  LogoID: Integer;
begin
  LogoID := PDF.AddImageFromFile('logo.png', 0);
  PDF.SetHTMLImage('brand-logo', LogoID);
  PDF.DrawHTMLTextBox(50, 750, 420, 180,
    '<style>.report h2 { color:#204080; } table { border:1pt solid #808080; }</style>' +
    '<section class="report"><h2>Quarterly report</h2>' +
    '<img src="brand-logo" width="72pt">' +
    '<table><tr><th>Region</th><th>Total</th></tr>' +
    '<tr><td>North</td><td>125</td></tr></table></section>');
end;