Clip
IPDFDocument4 :: Page Operations :: Graphics

See Also Example
Collapse All

This method sets the current path as a clipping boundary using a non-zero winding number rule.

Syntax

HRESULT Clip ()
Return value
If successful, this method returns S_OK. If it fails, this method should return one of the error values.

Remarks

This method installs the current path as the boundary for clipping subsequent drawings. The use of the clip operator may require some care, because clip operator do not use the current path. Also note that there is no practical way of removing a clipping path, except by using SaveGraphicsState before clipping. This methods uses a non zero winding number rule for defining the "path inside".

Example

How to Draw Text in a Clipped Region

Delphi
[copy to clipboard]
{ PDF object is supposed to be created }
{ create clip region as circle }
PDF.DrawCircle(70, 70, 50);
PDF.DrawCircle(90, 90, 40);
PDF.Clip;
{ now region is clipped, draw some text }
for i := 1 to 25 do
    PDF.ShowTextAt(10, 10*i, 'text text text text text text text text text');
PDF.SaveToFile('test.pdf', true);
C/C++
[copy to clipboard]
// PDF object is supposed to be created
// create clip region as circle
PDF->DrawCircle(70, 70, 50);
PDF->DrawCircle(90, 90, 40);
PDF->Clip();
// now region is clipped, draw some text
for (int i = 1; i < 25; i++)
    PDF->ShowTextAt(10, 10*i, "text text text text text text text text text");
PDF->SaveToFile("test.pdf", true);
C#
[copy to clipboard]
// PDF object is supposed to be created
// create clip region as circle
PDF.DrawCircle(70, 70, 50);
PDF.DrawCircle(90, 90, 40);
PDF.Clip();
// now region is clipped, draw some text
for (int i = 1; i < 25; i++)
    PDF.ShowTextAt(10, 10*i, "text text text text text text text text text");
PDF.SaveToFile("test.pdf", true);
Visual Basic
[copy to clipboard]
' PDF object is supposed to be created
' create clip region as circle
PDF.DrawCircle 70, 70, 50
PDF.DrawCircle 90, 90, 40
PDF.Clip
' now region is clipped, draw some text
For i = 1 To 25
    PDF.ShowTextAt 10, 10*i, "text text text text text text text text text"
Next
PDF.SaveToFile "test.pdf", true

See Also

Reference