List of usage examples for com.itextpdf.text.pdf PdfContentByte clip
public void clip()
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(); }