Native rich text layout

Build AcroForm text appearances from an XHTML tree, explicit font families and image resources without a browser or desktop session

Use THPDFHeadlessDocument.SetRichTextFieldXHTMLWithFamilies to update a loaded field, or HPDFBuildHeadlessRichLayoutAppearance to build an appearance bundle directly

Layout profile

The native engine supports inline text, block flow, tables with row and column spans, bounded grid column and row sizing with numeric item spans and row-major sparse or dense placement, constrained wrapping flex rows and columns, reversed main and wrapping cross axes, stable visual ordering and explicit Grid track/item and flex-line alignment

Box styling includes explicit content dimensions, minimum and maximum width and height, margins, padding, borders, background colors, gaps and table-cell vertical alignment; an explicit zero dimension remains specified

Lengths accept points, pixels, ems, inches, centimeters, millimeters, picas and percentages where the property has an available-size basis; one CSS pixel is 0.75 PDF points

See grid and flex sizing for definite tracks, fractional space, bounded minmax() and repeat(), flex shorthand and constrained axes, Grid track and item alignment, flex-line content alignment, row and column wrap-reverse and recursive intrinsic measurement

Unsized unwrapped flex rows retain their equal-share behavior; this finite form-appearance profile does not implement general browser layout

Text shaping, font selection and Unicode extraction use the native rich text appearance path; supply fonts for every requested family and style

Inner rich forms preserve visible paint overflow while the final Widget form clips to its own geometry; the standalone layout-only helpers retain logical text metrics and require unrotated inner geometry

Resources

Supply PNG or JPEG image bytes through THPDFHeadlessRichLayoutOptions.Images, with a nonempty URI and a matching content type when specified; embedded PNG and JPEG data URIs are also accepted

The document entry point resolves resource URIs against DecodeOptions.DocumentURI, rejects duplicate resolved URIs and applies an aggregate encoded-resource byte limit before decoding the tree

Resource declarations provide bytes explicitly; an image URI does not authorize network access or an implicit file read

Field state and failure behavior

The document entry point stores the supplied XHTML in /RV, derives the plain field value and prepares actual Widget appearances through the existing field transaction

Password, file-select and comb flags are incompatible with this entry point; existing field permissions, signature policy, geometry and object limits still apply

Use one shared cancellation token for the document, decoder, layout and appearance options; different non-nil tokens are rejected before layout

Call SaveToFile after updating the loaded document to publish its prepared changes

See layout limits and Linux form-data operations

Version 2.988.0: Native Grid named lines and implicit columns support directional named spans, leading and trailing implicit tracks, and row- or column-major sparse/dense placement while preserving alignment, logical text order, visible overflow and transactional resource limits