DrawHTMLPagesAtomic

HTML, CSS, print layout

Description

Atomically paginate HTML using explicit page rules and portable resource-keyed continuations, rolling back all document changes on errors or incomplete pagination

Syntax

Delphi

Function TPDFlib.DrawHTMLPagesAtomic(Const HTMLText: WideString; MaxPages: Integer= 100; RequireComplete: Integer= 1): WideString;

Parameters

HTMLTextThe HTML source or portable continuation token to paginate; limited to 8388608 UTF-16 code units
MaxPagesThe maximum number of pages to allocate in this call, from 1 to 1000
RequireCompleteWhen non-zero (the default), exceeding MaxPages with unplaced content also rolls back the entire pagination call and restores the document to its pre-call snapshot. When 0, valid partial batches commit placed pages and return a portable continuation token while still rolling back on hard layout, margin, continuation or missing-resource errors

Return values

Returns an empty string when all content fits within the page budget. On rollback or partial stop, returns the unplaced input (or a portable continuation token when RequireComplete is 0) and records details in LastErrorCode and GetLastHTMLImportDiagnostics.

Remarks

Captures a pre-call document snapshot before writing any page and restores the selected document, page count and content streams automatically if layout validation, continuation parsing, registered resource resolution, margin rendering or page-budget enforcement fails

Portable continuation envelopes identify fonts and images by registered key rather than live heap pointers, allowing resumable pagination across separate library instances and processes while explicitly rejecting missing registered font families, missing registered image keys or corrupt tokens

See also

DrawHTMLPages, GetLastHTMLImportDiagnostics