HTML5 Paged-Media Import

THPDFHTMLImporter.RenderHTML5 converts tolerant HTML5 markup and print CSS into paginated PDF content while preserving the compact legacy RenderHTML path

CSS lengths and the importer's Margin, BaseFontSize, ListIndent, and BlockSpacing are in points, so both renderers produce the same page whatever THotPDF.Resolution is set to; your own drawing before and after the import keeps using 1/Resolution inch

Declaration

function RenderHTML5(
  const HTML: WideString;
  const AuthorStyleSheet: WideString = ''
): Boolean;

function HPDFRenderHTML5Document(
  Doc: THotPDF;
  const HTML: WideString;
  const AuthorStyleSheet: WideString = '';
  MarginPt: Single = 72;
  const FontName: AnsiString = 'Arial';
  FontSize: Single = 12
): Boolean;

Profile contract

HTML5ProfileVersion returns 1 and HTML5ProfileMilestones reports parser and cascade, paged layout, tables and forms, and bounded resources

Inline form controls and labeled select options

Supported input, button, select and textarea controls can occupy atomic inline boxes among paragraph text, using their resolved dimensions and the existing bottom-edge text-baseline placement; CreateAcroForms still selects real PDF fields or flattened appearances

Soft wrapping can occur around atomic controls under the containing normal, pre-wrap and pre-line policies, while nowrap and pre keep those boundaries unbroken. The applicable policy comes from the nearest common containing element, including boundaries next to styled text without source spaces

An explicit zero width or height retains the other axis's inline advance or line-box contribution but emits no control paint or PDF field. Hidden inputs remain absent, and automatic dimensions retain their existing sizing fallbacks

Inline automatic widths conservatively allow for the final rounded widget height when the active appearance provider derives caption size from that height; this can reserve extra space. Block controls retain measurement from their actual paginated rounded height, and explicit dimensions retain their existing contract

Supported single-choice select controls use a nonempty decoded label attribute for display and natural width, with an empty or absent label falling back to the option's decoded HTML-aware text. An absent value uses that option text independently of the displayed label, while value="" remains empty; a present selected attribute identifies the chosen option even when its value is empty

Generated choices retain the selected label's option index as well as its export value, so equal exports do not erase selection identity. Natural select width uses visible labels with the active appearance path's existing font and spacing rules

This finite atomic-control profile does not add general browser intrinsic sizing, multiline select layout, content-driven field sizing or hard-wrap submission rewriting

Caption-driven button width

Automatic widths for button, submit and reset inputs and for button elements use the supported displayed caption's measured advance plus six points for the existing horizontal text insets when the active appearance path can supply those measurements

Flattened controls and native UNIX button appearances replace TAB, CR and LF with spaces for display and include the computed letter and word spacing in both measurement and painting; the stored caption metadata retains its original value

Windows AcroForm buttons use the standard Helvetica metrics and height-derived size of their product-generated appearance only when appearance generation is enabled; when the caller disables that generation, automatic width retains the legacy estimate without assuming which font a viewer may select

Explicit positive CSS widths and allocated parallel slots remain authoritative, while default heights, empty or unavailable-metric fallback widths, ordinary text inputs, select controls and textarea row and column sizing retain their existing contracts

HTML character references

HTML text and textarea RCDATA support all 2231 entries in the HTML named-character reference catalog, including its 106 legacy spellings without a semicolon, case-sensitive longest matches and references that expand to two Unicode scalars

Attribute values use the attribute-context ambiguity rule: a legacy spelling without a semicolon remains literal when followed by an ASCII letter, digit or equals sign. Decimal and hexadecimal numeric references support supplementary characters, replacement for null, surrogate and out-of-range values, and the HTML C1 compatibility mappings

References are decoded once in the appropriate text or attribute context. Decoded form values and missing-image alternatives remain literal text, including markup-looking characters

Character decoding does not add glyphs to a font or replace the existing form appearance providers. The finite inline-control profile shares those limits; hard-wrap submission rewriting, broader HTML parsing and complex shaping remain separate capabilities

Literal textarea content and multiline fields

A textarea body is read as RCDATA until its matching end tag: tag-looking and comment-looking text remains literal, and supported character references are decoded once without reparsing the resulting text as markup

Raw CRLF and CR are normalized before reference decoding, and one immediately following LF token is omitted after the start tag; the resulting control value uses LF line endings while retaining interior spaces, tabs and literal markup characters

With CreateAcroForms disabled, the flattened control paints literal multiline text inside its fixed clip, using three-point horizontal and two-point vertical text insets, the selected font's advances and the computed line height; preserved tabs advance to eight nominal space stops without painting a TAB glyph

With CreateAcroForms enabled, the control stores its value in /V and /DV, sets ffMultiline and generates a real normal appearance when appearance generation is enabled. Windows authored multiline appearances preserve spaces and use eight-space tab stops measured with Helvetica advances; native UNIX canvas fields use the supplied font provider's actual space advance

Textarea row and column sizing

When the corresponding CSS dimension is automatic, cols supplies the preferred character width and rows supplies the visible line count; missing, zero or invalid values use 20 columns and 2 rows

The automatic width is cols * meanAdvance + 6 points, where meanAdvance is the mean of the selected font's actual bare advances for the 62 characters A-Z, a-z and 0-9, without added letter or word spacing. The automatic height is rows * usedLineHeight + 4 points, retaining the existing three-point horizontal and two-point vertical text insets

The final font and computed line height determine these dimensions. A winning CSS width or height independently replaces that axis's attribute sizing, including zero; a zero-area control paints no box or text and creates no PDF field while retaining its surrounding flow

Ordinary and supported parallel control paths share the same height calculation; a parallel control's allocated width continues to follow the existing slot policy. This finite sizing contract does not add general Flex/Grid intrinsic sizing or browser scrollbar geometry

The supported inline and block control paths retain current form and font limits; general browser intrinsic layout, field-sizing: content and wrap="hard" submission rewriting remain separate work

Legacy FONT attributes and author CSS

The supported font element's face, size and color attributes provide initial presentation hints before author stylesheets and inline declarations, so an applicable author declaration can override the corresponding attribute through the normal and !important cascade

Attribute-only text retains the existing family, color fallback and size-length conversion; the size attribute does not gain a new HTML numeric-size mapping. Relative author font sizes still use the captured parent font size, and local font-relative lengths, text spacing and line height use the final computed font

font-style accepts normal, italic and the plain oblique keyword, which selects the existing italic font path for both measurement and painting through the stylesheet, inline, inheritance and !important cascade; a later normal resets either keyword, and angled oblique syntax such as oblique 12deg remains outside this profile

List markers, ordinals and nested content

Lists support inherited list-style-type: disc, circle, square, decimal, decimal-leading-zero and none, per-item overrides and explicit inherit, using the normal cascade and !important priority; unordered and ordered containers default to disc and decimal respectively

A none item keeps its list ordinal but paints no marker and reserves no marker width. Each nesting level adds the importer's ListIndent independently of author margins, so margin: 0 does not clear that importer setting

Ordered lists honor start, the presence of reversed and each owned item's value; integer attributes accept leading ASCII whitespace, an optional sign and a decimal digit prefix. Ordinals use exact signed decimal arithmetic, including values beyond 32-bit limits, within the existing layout-operation budget

Only rendered items whose computed display is list-item own an ordinal. A display: none item neither increments nor resets it; a display: block item renders its body without a marker or ordinal. The hidden attribute is recognized by presence, including an empty value, and the normal author cascade can override its default display

Nested lists retain independent counters and separate lines, while surrounding inline content and ordinary paragraphs preserve DOM order. An empty item occupies one line-height; when an item's first content is a nested list, image or other separate block, the parent marker first occupies its own line

Markers use the owning item's font, color and content-left position even when the first paragraph has different insets or a different font. Later body segments retain the original marker-width indentation without repeating the marker; nested marker columns advance by ListIndent

Supported item borders, backgrounds, padding and explicit minimum heights cover compound content and its page fragments. Item and container page breaks retain the current counter and restore enclosing layout offsets

Alphabetic and Roman markers

lower-alpha and upper-alpha number positive ordinals with positional letters, including z to aa and AZ to BA; lower-latin and upper-latin are their respective aliases

lower-roman and upper-roman use subtractive Roman notation for 1 through 3999; values outside that range, and nonpositive alphabetic ordinals, display the original decimal value

decimal-leading-zero pads the ordinal's magnitude to two digits: zero renders 00, single digits render 01 through 09, a negative ordinal keeps its sign as in -05, and ordinals of three or more digits stay unpadded as in 123

Formatting preserves exact ordinal strings beyond Int64, so start, reversed and per-item value continue counting without truncation; normal inheritance, overrides, !important and strict CSS admission apply to all six styles within the existing layout-operation budget

The predefined aliases and ranges follow CSS Counter Styles Level 3; image markers, general CSS counter declarations and browser-wide list layout remain outside this ordinary-list profile, and lists in parallel containers retain the documented vertical-flow fallback

White-space policies and preformatted text

white-space supports normal, nowrap, pre, pre-wrap, pre-line and explicit inherit through the normal and !important cascade; the property inherits, and the pre element starts with the preformatted policy before author CSS overrides

PolicySpaces and tabsSource line breaksSoft wrapping
normalCollapseCollapse with ordinary whitespaceEnabled
nowrapCollapseCollapse with ordinary whitespaceDisabled
prePreservePreserveDisabled
pre-wrapPreserve inside lines, visually collapse at line endsPreserveEnabled after whitespace sequences
pre-lineCollapsePreserveEnabled

HTML parsing omits one immediately following newline after a pre start tag; CRLF and CR source breaks are normalized, consecutive preserved breaks retain intervening empty lines, and a terminal break does not by itself add another empty line

An inherited nonnegative finite numeric tab-size sets the tab advance in nominal spaces of the containing block's font, defaulting to 8; a preserved tab advances to the next stop at multiples of that pitch measured from the content origin, first-line indentation contributes to the current position, and a larger inline font does not change the tab grid

tab-size: 0 collapses every tab advance onto the current position; length values are outside this profile, and an invalid declaration diagnoses and leaves the prior valid value in effect

Tabs retain measured spacing without painting a TAB glyph, while interior spaces remain actual text; collapsing continues across inline boundaries, and a font or color change does not create an extra break opportunity inside a word

The pre-wrap line-end choice follows the visual-collapse allowance in CSS 2.2 white-space processing; preserved interior spaces remain exact, and preformatted text and tabs are excluded from added justification spacing

Ordinary blocks, table cells and parallel text leaves share the same measured plan; table cells preserve local inline policies and reuse their measured lines for painting, while existing line-height, baseline and anonymous whitespace-only Flex/Grid item rules remain in effect

Wrapping retains the existing supported discretionary-hyphen and ideograph opportunities, and an unbreakable oversized word can still overflow; this does not add full UAX14 breaking, complex shaping, intrinsic-content sizing or new column and track layout

Measured paragraphs and direction

Paragraphs wrap using the current font's measured advances, including font changes, bold and italic runs, letter spacing, word spacing, explicit line breaks, and East Asian character boundaries; alignment and decoration apply separately to each resulting line

direction: ltr, direction: rtl, and the HTML dir attribute select paragraph direction; dir="auto" uses the first strong character's Unicode direction

On Windows, bidirectional script runs are resolved with Uniscribe and reordered across style boundaries, while the existing PDF text engine handles glyph shaping within each run; the document's direction, viewer preferences, and saved page text state are restored after the line

Inline direction overrides, bdi, and bdo currently use paragraph ordering and produce an hdkLayoutFallback diagnostic; unicode-bidi is outside this profile, and script shaping still follows the document's shaping configuration

Computed line heights and inline baselines

line-height supports normal, nonnegative unitless numbers, supported lengths and percentages through the normal and !important cascade; em lengths and percentage declarations use the element's final computed font size, regardless of declaration order

normal uses this importer's 1.2 font-size factor; inherited normal and unitless values scale with the descendant font size, while inherited computed lengths remain fixed, including explicit inherit

Each line combines its parent strut with the ascent, descent and signed half-leading of its inline boxes, including empty or whitespace-only inline boxes on a line with content and styled br elements; zero and small line heights can overlap glyphs without being replaced by a minimum 1.2em step

A plain line containing only empty inline metrics does not create an extra paragraph line; list items that explicitly require an empty marker line keep their line box. Markers share the first body line's baseline while retaining the owning item's font

Table measurement and painting reuse the same planned line boxes, and supported parallel text children use the same baseline-aware planner. Broader vertical alignment, browser-wide CSS layout, advanced shaping and general dynamic XFA remain outside this finite change

Font-relative box lengths and the final font size

Local em lengths for margins, padding, width, height, border width and Flex/Grid gaps use the element's final computed font size after normal and !important declarations, regardless of whether those lengths appear before or after font-size

Shorthand and longhand declarations retain their original cascade order, including border with border-color and border-width, and gap with its row and column overrides; a relative font-size continues to use the captured parent font size rather than compounding previous local values

Existing default values, percentage bases, supported length grammar and non-inherited box properties are unchanged; Grid track lengths and HTML image dimensions keep their existing layout-time conversion paths

Default border color and shorthand resets

A supported border without an explicit color uses the element's final computed text color after the normal and !important cascade, including text color declared after the border

A border shorthand that omits its color resets a preceding border color to this default at that point in the cascade; for example, blue text with border-color: red; border: 2pt solid produces a blue border

The case-insensitive currentColor keyword is accepted by border-color and by the border shorthand color slot, selecting the same deferred text-color tracking with declaration order, explicit color overrides and !important priority preserved

The uniform border shorthand parses its components in any order, accepting one width, one solid or none/hidden style and one color; a functional color such as rgb(0, 0, 255) keeps its internal whitespace as one component, duplicate or unrecognized components diagnose and leave the previous valid declaration intact including under StrictCSS, and none/hidden resets the width to zero so no border paints

Recognized explicit border colors retain their normal shorthand, longhand and priority rules, so an important border-color still overrides a later normal shorthand with an explicit color; dashed, double and per-side borders remain outside this uniform-border profile

Font-relative letter and word spacing

Local letter-spacing and word-spacing lengths in em use the element's final computed font size after the stylesheet and inline cascade, so moving a spacing declaration before or after font-size does not change the resulting length

Implicit inheritance and explicit inherit retain the parent's computed spacing as a fixed absolute length, even when the child's font size changes; a local child em length instead uses that child's final font size, and a later inherit restores the captured parent value rather than a preceding local length

Normal and !important declarations retain their existing cascade priority, normal resets additional spacing to zero, and positive, zero and negative lengths feed the same measured wrapping and painted text-state paths

This change fixes computed spacing within the existing scalar letter and word spacing profile; it does not add percentage spacing, broader browser justification or complex shaping behavior

Underline, overline and combined text decoration

text-decoration accepts none alone or a whitespace-separated combination of underline, overline and line-through in any order; keywords are case insensitive and each kind may occur only once

Mixing none with another kind, repeating a kind or using an unknown token produces an unsupported-value diagnostic and leaves the preceding valid declaration in effect; StrictCSS raises the existing unsupported-CSS exception instead

Each selected kind creates its own introducing-element record with the owner's color, font family, font style, size and measured ascent; a descendant's none adds no local decoration and cannot remove ancestor-introduced lines, following CSS 2.2 section 16.3.1 propagation

A parent's 12-point red decoration keeps its geometry over a 24-point child, while a child's local combination adds separate origins; distinct origins of the same kind remain distinct painted records, and default u and s or strike decorations enter before the author cascade so an author none can suppress those local defaults

Propagation reaches ordinary in-flow descendants and stops at atomic inline contents; the admitted inline-block display value holds that boundary, while the atomic descendant's own local combination is retained

Overline follows the introducing font's ascent edge relative to the shared line baseline and owner baseline offset; underline and line-through retain their fixed product offsets, and all three use stroke width max(0.5, size / 18), owner color and actual text-advance coverage across wrapping, br splits and justified segments

Relative positioning, floating layout, CSS table propagation conformance, additional decoration properties and complex shaping remain outside this finite change

Inherited paragraph indentation

In ordinary left-to-right paragraph flow, text-indent lengths inherit through block descendants and affect only the first formatted line; following lines return to the paragraph content edge

An explicit text-indent: inherit restores the parent's computed indentation at its place in the normal or !important cascade, including after a different local length; a child's own declaration can override an inherited value without inheriting the parent's declaration priority

Positive, zero, fractional and negative lengths use the same inherited-value path; existing length conversion and containing-width handling remain in effect

Table cells retain their planned text lines for both row measurement and painting, including the first-line indentation, inline font styles and explicit breaks; row spans and repeated headers use those measured heights, and hyphenation is planned once per cell while line-layout callbacks still observe each painted line

Font-relative indentation and the final font size

A local text-indent length in em uses the element's final computed font size after stylesheet and inline declarations at normal and !important priority, so moving the declaration before or after font-size does not change its value

Implicit inheritance and explicit text-indent: inherit retain the parent's computed indentation as a fixed length; a descendant's own em declaration instead uses that descendant's final font size. Existing first-line wrapping and painting consume the same computed length

This timing repair is limited to text-indent; existing rem and percentage-base policies remain unchanged, and it does not change the calculation of other font-relative CSS properties

Paragraph fragmentation

widows and orphans are inherited positive integers, both defaulting to 2; pagination uses the measured line boxes rather than an estimated number of characters

The importer moves a paragraph or adjusts its split to leave the requested minimum number of lines before and after a page break; break-inside: avoid keeps a paragraph together when it fits on a fresh page

When a page cannot hold the requested constraint, rendering makes progress by relaxing the constraint and recording hdkPaginationConstraint; each page fragment receives its own background and border

Optional hyphenation

hyphens: none suppresses discretionary breaks, and the default hyphens: manual uses U+00AD or ­; a visible hyphen is emitted only when the selected break is used

hyphens: auto additionally calls OnHyphenate with the word and inherited HTML lang value; without a callback it retains manual breaks and reports a layout fallback, because no language dictionary is bundled

Break positions count UTF-16 code units from the start of the word; invalid, out-of-range, surrogate-splitting, and basic combining-mark-splitting positions are ignored

THPDFHTMLHyphenationEvent = procedure(
  Sender: TObject;
  const WordText, Language: WideString;
  var BreakPositions: TArray<Integer>
) of object;

Bounded flex and grid boxes

display: flex supports row, row-reverse, column, and column-reverse; row children use explicit widths or share the remaining width, and positive flex-grow values weight additional space

Rows and bounded columns support justify-content start, end, flex-start, flex-end, center, space-between, space-around, and space-evenly, plus start, end, center, and stretch cross-axis alignment

Columns distribute the available inner height after reserving child margins and row gaps; column-reverse reverses item order and the flex-start/flex-end edges, while start/end retain their logical vertical edges and RTL changes horizontal alignment only

Column stretch fills automatic widths and preserves explicit widths; other cross-axis alignments use measured text, image and form-control widths, with recursive block and flex sizing matched to the existing lane allocator, and place the entire child margin box at the selected edge or center

Top-level and nested columns share the same plan; a top-level column that fits on one page moves as a complete box before painting when the current page has insufficient space, retaining its requested height before following content

Explicit descendant page breaks, oversized column content and unsupported intrinsic sizing, including automatic-width Grid children under non-stretch column alignment, retain a diagnostic natural-flow fallback; this extension does not add column wrapping, flex shrink or a general intrinsic Grid solver

display: grid supports positive fixed-length and fr column tracks, including bounded repeat(n, tracks) with up to 64 columns; cells are placed in source order, filling one row at a time

grid-column: span N and grid-column-end: span N allow a child to occupy consecutive tracks and their intervening gaps; an item that does not fit the current row moves to the next row, and spans larger than the track count produce a layout fallback

flex-wrap: wrap starts another line when the next item's explicit width and gap do not fit; each line independently applies flex-grow and justify-content, while row-reverse and RTL reverse positions within each line without moving items between lines

flex-flow accepts one direction keyword, one wrapping keyword (wrap or nowrap), or both in either order; omitted components reset to row and nowrap, and shorthand and longhand declarations follow the existing declaration order and !important priority

Duplicate direction or wrapping keywords, unknown keywords and wrap-reverse reject the entire shorthand without changing either previous value; the importer reports an unsupported-value diagnostic and strict CSS mode raises EHPDFHTMLUnsupportedCSS

gap accepts one or two values, each a length or the normal keyword that resolves to zero used gap, with independent row-gap and column-gap overrides; parallel rows stay on one page and are checked before painting

Parallel children support text blocks with inline styling, recursively nested ordinary block containers with padding, borders and backgrounds, nested flex and grid containers, images, and static or native form controls

Image dimensions and intrinsic ratio

Images use callback-supplied or data URI bytes; when only width or height is requested, the other dimension is derived from the image's intrinsic ratio in ordinary flow and supported parallel layouts, subject to the existing parallel width limit

When both dimensions are requested, they remain independent rather than being forced to the intrinsic ratio; with neither requested, natural dimensions use 0.75 points per decoded pixel before any existing parallel width limit

Ordinary flow adds no width cap. Parallel layouts retain their allocated-width policy: an automatic height follows the final limited width, while a requested height stays unchanged if the derived automatic width is capped, so that constrained height-only case can change the displayed ratio

Each DOM node caches its decoded image and any additional transparency data, so preflight and fallback reuse them without consuming another resource request

PNG images preserve their decoded RGB colors and independent transparency, including partial alpha, transparent sample keys and palette entries with different alpha values even when their colors are identical; opaque and transparent images retain the same row order over list-item backgrounds

All child boxes are measured before any parallel row is painted, so unsupported or oversized content falls back to vertical page flow without repeating previously painted rows; nested planning is bounded to 64 levels and consumes the existing layout-operation budget

Wrapping children without an explicit width occupy one complete line; tables and lists inside parallel children, flex basis and shrink, wrap-reverse, intrinsic track sizing, grid row tracks and row spans, and explicit grid placement remain outside this profile and produce observable diagnostics

The native rich-text appearance profile also supports flex-flow and Grid bare-keyword place-items, place-self and place-content shorthands for loaded rich-text field preparation; that separate appearance engine has its own flex and Grid contract, while this paged-media importer follows the bounded profile described above

Missing-image alternative text

When an image resource is unavailable, a nonempty alt attribute contributes literal text to the importer's measured text flow; HTML character references are decoded once, and markup-looking characters in the decoded value remain text rather than creating HTML elements

Alternative text uses the image element's computed font, size, color and line height, including inherited styles, and follows the normal text whitespace and wrapping rules; an absent, empty or ASCII-whitespace-only alternative contributes no text, and display: none contributes no alternative text or image resource request

In bounded Flex and Grid children, the same measured alternative lines determine the planned height and painted flow, including supported padding, borders, margins and explicit height constraints, so wrapped alternatives reserve space before following content is placed

An available image suppresses its alternative text, and planning and painting reuse the existing per-node image cache; existing supported mixed child-box layouts retain available images with missing-image alternatives, while paragraphs containing only nested images retain their existing inline-image limitation

Unsupported CSS diagnostics

Diagnostics exposes records containing Kind, Subject, Value, and MessageText; OnDiagnostic receives the same information during rendering

Unknown properties, unsupported values, unsupported selectors, and unsupported at-rules are ignored with a diagnostic, including declarations in otherwise unused stylesheet rules; pseudo selectors are skipped rather than treated as ordinary type selectors

StrictCSS, disabled by default, raises EHPDFHTMLUnsupportedCSS on a diagnostic; prior content may already have been emitted, so callers requiring all-or-nothing import should use a separate document

MaxDiagnostics defaults to 256 and bounds retained records; DiagnosticCount and callback delivery remain observable after the storage limit is reached, and a nonpositive limit disables record storage

Bounded resources

External stylesheets, images, and @font-face fonts referenced by the document are disabled unless OnResource supplies their bytes, so no document-referenced resource is fetched from a file or network connection implicitly

Resolving a text font family that is neither embedded nor already registered is a separate renderer font lookup: on Linux it may consult Fontconfig and read the matched host font file, which is font selection rather than document resource loading and stays outside OnResource resolution

@font-face supports one url(...) source, optional format('truetype') or format('opentype'), a family alias, normal or italic style, and normal, bold, 400, or 700 weight; font-display accepts the standard policies because offline import loads resources synchronously

Fonts must be embeddable TrueType or OpenType sfnt resources with an ASCII Windows family name of at most 31 characters; WOFF, font collections, local(...), variable descriptors, and source lists produce diagnostics

Accepted fonts are registered privately in process memory on Windows and remain owned by the document until it is destroyed, so freeing the importer before EndDoc does not invalidate deferred font embedding

data: resources and callback results share MaxResources, MaxResourceBytes, and MaxTotalResourceBytes limits; base64 data: payloads decode through HPDFDecodeBase64 from HPDFTypes after the alphabet is normalized

MaxDecodedImageBytes defaults to 128 MiB and independently bounds the decoded image cache using a four-byte-per-pixel picture estimate plus any separately cached PNG transparency samples; BMP and PNG dimensions are checked before decoding, and every accepted picture is checked before it is retained

MaxDOMNodes, MaxCSSRules, and MaxLayoutOperations independently bound parsing, cascade construction, and layout work

THPDFHTMLResourceEvent = procedure(
  Sender: TObject;
  const URI: WideString;
  ResourceKind: THPDFHTMLResourceKind;
  var Data: TBytes;
  var ContentType: string;
  var Handled: Boolean
) of object;

Statistics

THPDFHTMLImportStatistics reports the profile version, parsed nodes, CSS rules, layout operations, page breaks, tables, form controls, resource requests, accepted and rejected loads, accepted resource bytes, measured text lines, hyphenated lines, diagnostics, flex containers, and grid containers

OnLineLayout receives the line's zero-based page and paragraph line indices, origin, measured width and height, logical text, direction, and hyphenation flag after the actual PDF text has been emitted

Every RenderHTML5 call resets the statistics record, and budget violations raise EHPDFHTMLImportBudget

Example

Importer := THPDFHTMLImporter.Create(Doc);
try
  Importer.CreateAcroForms := True;
  Importer.MaxResources := 16;
  Importer.RenderHTML5(
    '<style>@page { margin: 36pt } ' +
    'table { width: 100% }</style>' +
    '<h1>Invoice</h1>' +
    '<table><tr><td>Total</td><td>42</td></tr></table>' +
    '<input name="approved" type="checkbox">'
  );
finally
  Importer.Free;
end;

See also: THPDFPage.TextOutHTML, Declarative Layout DOM, AcroForm Support