PDFium Delphi Component Docs

TransformPageContent method

Component: TPdf  ·  Unit: PDFium
Apply a transform matrix to every content object on the current page, with a clip rectangle

Syntax

procedure TransformPageContent(const Matrix: FS_MATRIX; const Clip: TPdfRectangle);

MatrixFS_MATRIX. Transform applied to the page content, in PDF matrix order
ClipTPdfRectangle. Clip rectangle in PDF page units applied together with the transform

Description

Transforms the page as a whole rather than one object at a time, which is what straightening a scan, scaling artwork to a new page size or mirroring a page needs

Annotations are not content and do not move with it. Apply the same matrix via TransformPageAnnotations when they should follow

The cached text page is discarded and the page is reloaded, so extracted text positions reflect the new geometry immediately

Example

var M: FS_MATRIX;
var Clip: TPdfRectangle;
M.a := 0.5; M.b := 0; M.c := 0; M.d := 0.5; M.e := 0; M.f := 0;
Clip := Pdf.GetPageBox(pbMediaBox);
Pdf.TransformPageContent(M, Clip);
Pdf.TransformPageAnnotations(M);

See Also

TransformPageAnnotations, TransformPageObject, GetPageBox, DetectPageSkew