API referenceGraphics

pdfDrawHTMLMatrix

Draw the SDK's limited HTML subset (see [HTML Text, Arc Text & Callout Conversion](../V06_Text/E04_HTMLTextAndArcText.md) for the exact

C
int32_t __stdcall pdfDrawHTMLMatrixA(PPDF IPDF, double A, double B, double C, double D, double E, double F, double Width, double Size, int32_t Align, const char* HTML);
int32_t __stdcall pdfDrawHTMLMatrixW(PPDF IPDF, double A, double B, double C, double D, double E, double F, double Width, double Size, int32_t Align, const wchar_t* HTML);
int32_t __stdcall pdfDrawHTMLBoxMatrixA(PPDF IPDF, double A, double B, double C, double D, double E, double F, double Width, double Height, double Size, int32_t Align, const char* HTML);
int32_t __stdcall pdfDrawHTMLBoxMatrixW(PPDF IPDF, double A, double B, double C, double D, double E, double F, double Width, double Height, double Size, int32_t Align, const wchar_t* HTML);
Delphi
function pdfDrawHTMLMatrixA(const IPDF: PPDF; A, B, C, D, E, F, Width, Size: Double; Align: Integer; HTML: PAnsiChar): Integer; stdcall;
function pdfDrawHTMLMatrixW(const IPDF: PPDF; A, B, C, D, E, F, Width, Size: Double; Align: Integer; HTML: PWideChar): Integer; stdcall;
function pdfDrawHTMLBoxMatrixA(const IPDF: PPDF; A, B, C, D, E, F, Width, Height, Size: Double; Align: Integer; HTML: PAnsiChar): Integer; stdcall;
function pdfDrawHTMLBoxMatrixW(const IPDF: PPDF; A, B, C, D, E, F, Width, Height, Size: Double; Align: Integer; HTML: PWideChar): Integer; stdcall;

The same entry points are also exported under the alias names pdfDrawHTMLTextMatrix / pdfDrawHTMLTextMatrixA / pdfDrawHTMLTextMatrixW and pdfDrawHTMLTextBoxMatrix / pdfDrawHTMLTextBoxMatrixA / pdfDrawHTMLTextBoxMatrixW (compatibility spelling); each alias calls the identical implementation.

Purpose. Draw the SDK's limited HTML subset (see HTML Text, Arc Text & Callout Conversion for the exact supported tag set) laid out in local coordinates, then painted through an arbitrary 2×3 affine transform (A..F, the same [a b c d e f] convention as pdfSetMatrix) — unlike pdfDrawHTMLText (HTML Text, Arc Text & Callout Conversion), which only positions text at a fixed origin with no rotation/skew support.

Description. Both call the shared RenderHtml layout/paint engine with an explicit TCTM built from A..F, rather than relying on the document's ambient content-stream CTM the way pdfPlaceTemplByMatrix does — the matrix here is a direct per-call parameter, not something set up beforehand via pdfSetMatrix/pdfRotateCoords. pdfDrawHTMLMatrix wraps text at Width with unlimited height (no vertical clip); pdfDrawHTMLBoxMatrix additionally clips to Height, matching the box-vs-unbounded distinction between pdfDrawHTMLText's own non-matrix siblings. A variants transcode the ANSI HTML string to WideString via the system default codepage and delegate to W.

Parameters.

ParameterDescription
IPDFDocument handle.
A, B, C, DScale/rotation/skew terms of the transform applied to the laid-out HTML.
E, FTranslation terms (the drawing's origin in the current coordinate system).
WidthWrap width, in local (pre-transform) units.
Height*(BoxMatrix only)* Vertical clip height, in local units.
SizeBase font size.
AlignHorizontal alignment within Width (same convention as pdfDrawHTMLText).
HTMLMarkup string (limited tag subset — see HTML Text, Arc Text & Callout Conversion).

Return value. The number of lines rendered on success; -1 if IPDF is invalid or layout otherwise failed.

See also. pdfDrawHTMLText (the non-matrix sibling), pdfSetMatrix.

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
public static extern int pdfDrawHTMLMatrixW(IntPtr IPDF, double A, double B, double C, double D, double E, double F, double Width, double Size, int Align, IntPtr HTML);
public static extern int pdfDrawHTMLMatrix(IntPtr IPDF, double A, double B, double C, double D, double E, double F, double Width, double Size, int Align, IntPtr HTML);
public static extern int pdfDrawHTMLMatrixA(IntPtr IPDF, double A, double B, double C, double D, double E, double F, double Width, double Size, int Align, IntPtr HTML);
public static extern int pdfDrawHTMLTextMatrixW(IntPtr IPDF, double A, double B, double C, double D, double E, double F, double Width, double Size, int Align, IntPtr HTML);
public static extern int pdfDrawHTMLTextMatrix(IntPtr IPDF, double A, double B, double C, double D, double E, double F, double Width, double Size, int Align, IntPtr HTML);
public static extern int pdfDrawHTMLTextMatrixA(IntPtr IPDF, double A, double B, double C, double D, double E, double F, double Width, double Size, int Align, IntPtr HTML);
Area
Graphics
Category

Vector Graphics

Exported names

pdfDrawHTMLMatrixW pdfDrawHTMLMatrix pdfDrawHTMLMatrixA pdfDrawHTMLTextMatrixW pdfDrawHTMLTextMatrix pdfDrawHTMLTextMatrixA

String variants

The …A form takes UTF-8, …W takes UTF-16; a bare name aliases the ANSI form.

See working code

Worked examples — complete programs in ten languages.