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 colours, gaps and table-cell vertical alignment; an explicit zero dimension remains specified

Table-cell vertical alignment

Table cells accept the supported vertical-align keywords top, middle and bottom without regard to ASCII letter case, so MIDDLE and MiDdLe have the same meaning as middle

Focused Linux x86_64 verification for table-cell keyword case (Tests/Linux/TableVerticalAlignment/README.en-us.md) ran the same 14 models with FPC 3.3.1-20818-ga205e76e12-dirty, completing 300 native checks, 5736 independent reader checks and 28 saved/reloaded PDFs from the released 2.993.14 source snapshot; this finite record does not establish full Linux ABI, general CSS or security acceptance

The layout applies the winning declaration after the existing source-order and !important cascade; keyword case does not change which declaration wins

Top aligns the cell content to the top of its row, middle distributes the remaining row height equally above and below it, and bottom places the remaining height above it

This keyword-case correction retains the existing finite table layout profile and does not add baseline alignment, numeric or percentage vertical alignment, invalid-declaration retention or general browser table sizing

Numeric margin and padding shorthands expand one to four values in place into independently cascaded physical edges, preserving source order and !important priority; invalid complete values retain prior declarations, and negative margins remain valid whilst negative padding is ignored as a whole

All four edge percentages use the available containing width, including vertical edges, whilst em uses the selected element font size and existing zero and unit conversions remain unchanged; see numeric box-edge rules and limits

Lengths accept points, pixels, ems, inches, centimetres, millimetres, 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

Version 2.989.12 supports flex-flow with one direction, one wrapping value, or both in either order; omitted components reset to row and nowrap, and invalid declarations preserve both prior longhands under their existing cascade and important priority

Version 2.992.7 supports bare-keyword place-items, place-self and place-content in native Flex layout alongside the retained Grid profile, with complete two-axis validation, omitted-value copying and independent longhand source order and important priority

Companion Flex longhands handle normal/stretch, logical start/end under reversal and main-axis left/right; justify-items/self remain inert on the Flex main axis

Version 2.992.8 adds explicit safe/unsafe overflow prefixes with property-specific validation and complete place-* groups of up to four tokens; safe uses final margin-box overflow and relative flex-start, including reversed axes

Auto-height nowrap Flex rows use their final min/max-constrained content height for item alignment, whilst Grid replaced-image normal behaviour and existing unspecified overflow behaviour are retained

Version 2.992.9 aligns overflowing space-around and space-evenly Flex groups against relative flex-start after final sizing, margins and gaps; positive spacing, positive single-item centring, between, cross-line and Grid distribution retain their existing behaviour

See Grid and Flex alignment shorthands and overflow alignment for the finite grammar; baseline, CSS-wide alignment, RTL, vertical writing modes and automatic scroll-area safety remain outside this addition

Unsized unwrapped flex rows retain their equal-share behaviour; 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 whilst the final Widget form clips to its own geometry; the standalone layout-only helpers retain logical text metrics and require unrotated inner geometry

Preferred image dimensions

Image width and height hints are resolved before the winning CSS declaration on each axis; a winning width:auto or height:auto suppresses only the corresponding HTML width or height hint, under the existing source order and !important priority

When both preferred axes are definite, their dimensions are independent before the existing available-width fit clamp; when only one axis is definite, the other uses the image's physical intrinsic aspect ratio, and when both are auto the intrinsic dimensions are used

A positive HTML height is a definite cross size for Grid and Flex item sizing, so cross-axis stretch does not replace it; a winning CSS height:auto clears that hint and allows the existing stretch path to assign the height

HTML and CSS percentage heights use the available containing width at box resolution in this finite layout profile; intrinsic width measurement consumes that resolved height rather than reinterpreting a percentage against its internal measurement width

An explicit outer flow height can remain larger than the fitted image paint: a 2:1 image with width:auto;height:150pt and 200 points of available width paints at 200 by 100 points whilst retaining 150 points of flow height

Zero-sized images and constraints

Explicit CSS image content dimensions may be zero; one definite zero axis with an unconstrained auto axis resolves both to zero, whilst two definite axes retain their independent dimensions, such as zero width and 20 points of height

Minimum and maximum content dimensions are applied before deciding whether image paint is empty; width:0;height:auto;min-width:10pt resolves a 2:1 image to 10 by 5 points, whilst width:0;height:auto;min-height:10pt retains zero width and 10 points of height

When both axes are auto, compatible minimum and maximum constraints preserve the intrinsic ratio; conflicting constraints use their limiting corner, so a 2:1 image with min-width:60pt;max-height:20pt resolves to 60 by 20 points before the retained available-width fit

An image with either final paint dimension equal to zero emits no raster Image resource or image paint command; its box background, borders, padding and logical flow remain, and an unassigned auto image box uses the resolved image width for inline placement

Layout-assigned Grid and Flex axes retain exact zero values through sizing and wrapping; positive internal Form bounds do not add an epsilon to logical dimensions, neighbouring text advances or following flow

Empty paint still validates supplied image bytes and observes encoded-resource, decoded-pixel, operation, workspace and cancellation limits; malformed resources and over-budget requests retain the existing failure and same-handle retry contract

Layout-assigned axes and the existing available-width fit remain in effect; indefinite percentage heights, table auto-layout and general browser image sizing remain outside this finite profile

Zero-valued HTML dimension hints are outside this CSS-zero profile

Opaque CSS colours and canonical imports

Version 2.994.2 adds the complete 148 opaque CSS names, single-colour background cascade handling, layout-colour feature queries and complete internal glyph ink bounds; see native rich-text colours and canonical imports for the supported value grammar, declaration priority, outer Widget clipping and the stage-specific named-family import contract

Finite numeric border declarations

A complete border declaration containing one numeric width, solid and one supported uniform colour accepts those three components in any order; the colour grammar retains the existing named colours, #RGB and #RRGGBB forms

The width expands into four independent physical edge declarations and the colour uses the existing single border-color slot; supported shorthand and longhand declarations follow source order and !important priority independently, whilst unknown, duplicate or excess components in a complete global shorthand leave prior values intact

Numeric border-width expands one to four values using top, right, bottom and left mapping; individual border-top-width, border-right-width, border-bottom-width and border-left-width declarations retain independent priority, and invalid values preserve previous edges

Width-only borders retain their existing visible behaviour; numeric-first two-component forms with solid or a supported colour retain their legacy width-only interpretation, so border-color:blue;border:2pt red keeps the prior blue colour whilst setting the width to two points

A bare border:none or border:hidden retains its legacy zero-width alias behaviour: it updates all four width slots with the declaration priority without changing the uniform colour; a later permitted numeric width can restore the existing visible border behaviour without introducing persistent border-style state

Per-side border shorthands retain their numeric-first width interpretation without changing the uniform global colour; this finite addition does not introduce omitted CSS initial-value resets, keyword widths, currentColor, border-style suppression, patterned borders or different colours on individual edges

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 authorise network access or an implicit file read

Field state and failure behaviour

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 whilst preserving alignment, logical text order, visible overflow and transactional resource limits