PDFium Delphi Component Docs

InsertClipPath method

Component: TPdf  ·  Unit: PDFium
Clip everything drawn on the current page to a rectangle

Syntax

procedure InsertClipPath(Left, Bottom, Right, Top: Single);

Left, BottomSingle. Lower-left corner of the clip rectangle in PDF page units (points, origin at the bottom-left of the page)
Right, TopSingle. Upper-right corner of the clip rectangle in PDF page units

Description

Adds a rectangular clip path to the page. Content outside the rectangle stops being painted, though it stays in the file - clipping hides content, it does not delete it. Use RemoveObject when the content itself must go

The rectangle is given in PDF user space, where y grows upward from the bottom of the page, so Bottom is numerically smaller than Top

The clip path is created and destroyed inside the call; the page keeps only the resulting clip state. On a PDFium build without clip-path creation the call returns without changing the page

Example

// keep only the top half of an A4 page
Pdf.InsertClipPath(0, 421, 595, 842);
Pdf.UpdatePage;

See Also

PageObjectClipPath, GetPageBox, UpdatePage