API referenceGraphics

pdfSetMatrix

Apply an arbitrary transform to the current coordinate system.

C
BOOL32 __stdcall pdfSetMatrix(PPDF IPDF, TCTM* Matrix);
Delphi
function pdfSetMatrix(const IPDF: PPDF; var Matrix: TCTM): LongBool; stdcall;

Purpose. Apply an arbitrary transform to the current coordinate system.

Description. Despite its "Set" name suggesting it replaces the CTM outright, this function concatenates Matrix onto whatever transformation is already active — internally it calls the exact same ConcatMatrix used to implement the PDF cm operator, which both writes the cm operator and updates FCTM via ComposeCTM. To achieve a true "replace the CTM from scratch" effect, a caller must first read the inverse of the current matrix (via pdfGetMatrix and manual inversion — no inverse helper is exposed in this ABI) and concatenate that before applying the desired absolute matrix.

Parameters.

ParameterDescription
IPDFDocument handle.
MatrixThe [a b c d x y] matrix to concatenate onto the current transform.

Return value. True on success; False if there is no current content stream (works for an open template, not just an open page — contrast with pdfGetMatrix's stricter open-page requirement).

Remarks. Functionally, pdfSetMatrix(M) is exactly equivalent to writing the cm operator with M's six values directly — there is no "set absolute" primitive in this ABI.

See also. pdfGetMatrix, pdfMultiplyMatrix.

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
[return: MarshalAs(UnmanagedType.Bool)]
Area
Graphics
Category

Setters

Exported names

pdfSetMatrix

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.