DrawHTMLStory

HTML text, page layout, pagination

Description

Flows one styled HTML story from left to right through equal-width columns on the selected page and then through newly generated pages

Syntax

Delphi

Function TPDFlib.DrawHTMLStory(Left, Top, Width, Height: Double; Columns: Integer; Gutter: Double; MaxPages: Integer; Const HTMLText: WideString): WideString;

DLL

const wchar_t* DLDrawHTMLStory(int InstanceID, double Left, double Top, double Width, double Height, int Columns, double Gutter, int MaxPages, const wchar_t* HTMLText);

ActiveX

Function PDFlib::DrawHTMLStory(Left As Double, Top As Double, Width As Double, Height As Double, Columns As Long, Gutter As Double, MaxPages As Long, HTMLText As String) As String

Parameters

Left, TopThe upper-left origin of the complete column region in the current coordinate system
Width, HeightPositive dimensions of the complete region on every page
ColumnsColumn count from 1 through 64
GutterNon-negative spacing between adjacent columns; the combined gutters must be less than Width
MaxPagesMaximum number of pages to use in this call from 1 through 10000, including the selected page
HTMLTextInitial HTML or the continuation string returned by an earlier story or text-box call

Return values

Returns an empty string when the complete story is placed, or a continuation string containing all unplaced content and its active HTML/CSS state when MaxPages is reached

Invalid input returns HTMLText unchanged with LastErrorCode 121; a page-creation failure or two consecutive frames without layout progress returns the remaining story with error 524

Remarks

Columns are filled in reading order from left to right before a new page is created

Generated pages copy the effective width and height of the selected start page, while the current measurement unit, origin, HTML font mappings, image bindings, inline styles, stylesheet cascade, nested style stack, Flexbox and Grid containers, tables, links, structured blocks, and footnote numbering continue through the same renderer

Use <footnote> or <aside style="float:footnote"> after the related body text; accepted notes receive a superscript marker, reserve a separated area at the bottom of the current frame, and reduce the body height before subsequent line breaking

If a note and its reference cannot fit together, both remain in the continuation string for the next column or page

The method uses cached measure-and-replay plans for each frame and does not concatenate page content into a single unbounded layout buffer

When a finite page limit returns remaining content, create or select the desired continuation page and pass the returned string to another call

See also

DrawHTMLTextBox, DrawTextFlowColumns, Appendix A: Supported HTML tags