PDFPAGE_Clip
IPDFDocument3 :: PDF page methods

See Also Example
Collapse All

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

Syntax

HRESULT PDFPAGE_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 operators 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 PDFPAGE_GStateRestore before clipping. This methods uses a non-zero winding number rule for defining the "path inside".

Equivalent in new interface: IPDFDocument4::Clip.

Example

How to Draw Text in a Clipped Region

Delphi
[copy to clipboard]
{ PDF object is supposed to be created }
PDF.BeginDoc;
{ create clip region as circle         }
PDF.PDFPAGE_Circle(80, 95, 70);
PDF.PDFPAGE_Clip;
{ now region is clipped, draw a text   }
PDF.PDFPAGE_SetActiveFont('Verdana', false, false, false, false, 12.0, 0);
for i := 1 To 10 do
begin
    PDF.PDFPAGE_TextOut(10, 15*i, 0.0, 'text text text text text');
end;
PDF.EndDoc;
C/C++
[copy to clipboard]
// PDF object is supposed to be created
PDF->BeginDoc();
// create clip region as circle
PDF->PDFPAGE_Circle(80, 95, 70);
PDF->PDFPAGE_Clip();
// now region is clipped, draw a text
PDF->PDFPAGE_SetActiveFont("Verdana", false, false, false, false, 12.0, 0);
for (int i = 0; i < 10; i++)
{
    PDF->PDFPAGE_TextOut(10, 15*i, 0.0, "text text text text text");
}
PDF->EndDoc();
C#
[copy to clipboard]
// PDF object is supposed to be created
PDF.BeginDoc();
// create clip region as circle
PDF.PDFPAGE_Circle(80, 95, 70);
PDF.PDFPAGE_Clip();
// now region is clipped, draw a text
PDF.PDFPAGE_SetActiveFont("Verdana", false, false, false, false, 12.0, 0);
for (int i = 0; i < 10; i++)
{
    PDF.PDFPAGE_TextOut(10, 15*i, 0.0, "text text text text text");
}
PDF.EndDoc();
Visual Basic
[copy to clipboard]
' PDF object is supposed to be created
PDF.BeginDoc
' create clip region as circle
PDF.PDFPAGE_Circle 80, 95, 70
PDF.PDFPAGE_Clip
' now region is clipped, draw a text
PDF.PDFPAGE_SetActiveFont "Verdana", False, False, False, False, 12.0, 0
For i = 1 To 10
    PDF.PDFPAGE_TextOut 10, 15*i, 0.0, "text text text text text"
Next
PDF.EndDoc

See Also

Reference