Constrained Streaming Layout
HotPDF can stage each completed page in file-backed storage, apply paragraph page-break constraints, expose bounded layout diagnostics, mark semantic paragraphs and pagination artefacts, and resolve paragraph base direction before emitting mixed-direction text
Immediate page flushing
Set ImmediateFlushLayout before BeginDoc for reports whose page count is not known in advance
When a page closes, its final compressed or uncompressed content stream moves from memory to an owned temporary-file stream whilst the PDF object remains available for normal cross-reference and resource finalisation
ImmediateFlushedPageCount and ImmediateFlushedBytes report the amount of staged content, and temporary files are deleted when their owning streams are released
Paragraph pagination
ParagraphIndex := PDF.CreateParagraph(0, jtLeft, 36, 36, 36, 36);
PDF.ConfigureParagraphPagination(ParagraphIndex, True, 2, 2);
PDF.ConfigureParagraphDirection(ParagraphIndex, pdAuto);
PDF.BeginParagraph(ParagraphIndex);
PDF.CurrentParagraph.ShowUnicodeText(BodyText);
PDF.EndParagraph;
KeepWithNextmoves a paragraph when it would consume the final line that should remain for following contentMinOrphanLinesprevents too few opening lines from being left at the bottom of a pageMinWidowLinesadvances a break when too few closing lines would remain on the next page- Automatic continuation preserves the source page width, height, font, margins, and paragraph settings
- When
ParaAutoAddPageis false, overflow stops on the current page and produces anldkOverflowdiagnostic
Layout diagnostics
THPDFLayoutDiagnostic records the THPDFLayoutDiagnosticKind, source and related page indexes, affected rectangle, line count, and an English reason for each retained decision
THPDFLayoutDiagnosticArray is returned by GetLayoutDiagnostics, whilst GetLayoutDiagnostic supports indexed access without allocating a copy
LayoutDiagnosticLimit bounds retained records and LayoutDiagnosticDroppedCount reports decisions discarded after that limit
ldkAutomaticPageBreakreports an ordinary continuationldkKeepWithNext,ldkOrphanControl, andldkWidowControlidentify the constraint that moved a breakldkOverflowidentifies content stopped by disabled automatic paginationldkImmediateFlushidentifies a closed page moved to file-backed storage
Paragraph direction
THPDFParagraphDirection provides pdAuto, pdLeftToRight, and pdRightToLeft
DetectParagraphDirection applies first-strong-character resolution across BMP and supplementary-plane RTL scripts, so neutral prefixes and secondary directional runs do not choose the wrong base direction
Use ConfigureParagraphDirection for a persistent paragraph setting or the THPDFPara.Direction property for the active paragraph
PDF/UA paragraph semantics
Root := PDF.AddStructureElement('Document', nil);
Paragraph := PDF.BeginTaggedParagraph(Root, 'en-US', 'Accessible text');
PDF.CurrentPage.TextOut(36, 72, 0, WideString('Accessible text'));
PDF.EndTaggedParagraph;
PDF.BeginPaginationArtifact(pasHeader);
PDF.CurrentPage.TextOut(36, 20, 0, WideString('Running header'));
PDF.EndPaginationArtifact;
BeginTaggedParagraph emits a standard /P marked-content sequence with an allocated MCID, page parent-tree wiring, and optional /Lang and /ActualText values
THPDFPaginationArtifactSubtype provides pasHeader, pasFooter, pasWatermark, and pasPageNumber, emitted as /Artifact content with /Type /Pagination and the matching standard subtype