Example usage for com.itextpdf.text.pdf PdfContentByte clip

List of usage examples for com.itextpdf.text.pdf PdfContentByte clip

Introduction

In this page you can find the example usage for com.itextpdf.text.pdf PdfContentByte clip.

Prototype


public void clip() 

Source Link

Document

Modify the current clipping path by intersecting it with the current path, using the nonzero winding number rule to determine which regions lie inside the clipping path.

Usage

From source file:mkl.testarea.itext5.pdfcleanup.StrictPdfCleanUpProcessor.java

License:Open Source License

private void insertFormXObj(PdfContentByte canvas, PdfDictionary pageDict, PdfStream formXObj,
        List<Rectangle> clippingRects, Rectangle annotRect) throws IOException {
    PdfName xobjName = generateNameForXObj(pageDict);
    canvas.saveState();/*from  w  w  w .j  a va 2  s . c  om*/

    for (Rectangle rect : clippingRects) {
        canvas.rectangle(rect.getLeft(), rect.getBottom(), rect.getWidth(), rect.getHeight());
    }

    canvas.clip();
    canvas.newPath();

    canvas.addFormXObj(formXObj, xobjName, 1, 0, 0, 1, annotRect.getLeft(), annotRect.getBottom());

    canvas.restoreState();
}