I am getting "Coordinate outside allowed range java.lang.IllegalStateException" exception while applying redaction in pdf document.
i have tried with various coordinate but every time same exception showing.Could you please help us why i am getting this exception only for specific document.
Exception Trace: Reason : Coordinate outside allowed range java.lang.IllegalStateException: Coordinate outside allowed range at com.itextpdf.text.pdf.parser.clipper.ClipperBase.rangeTest(ClipperBase.java:120) at com.itextpdf.text.pdf.parser.clipper.ClipperBase.rangeTest(ClipperBase.java:122) at com.itextpdf.text.pdf.parser.clipper.ClipperBase.addPath(ClipperBase.java:194) at com.itextpdf.text.pdf.pdfcleanup.PdfCleanUpRegionFilter.addPath(PdfCleanUpRegionFilter.java:418) at com.itextpdf.text.pdf.pdfcleanup.PdfCleanUpRegionFilter.filterFillPath(PdfCleanUpRegionFilter.java:173) at com.itextpdf.text.pdf.pdfcleanup.PdfCleanUpRenderListener.filterCurrentPath(PdfCleanUpRenderListener.java:368) at com.itextpdf.text.pdf.pdfcleanup.PdfCleanUpRenderListener.renderPath(PdfCleanUpRenderListener.java:207) at com.itextpdf.text.pdf.parser.PdfContentStreamProcessor.paintPath(PdfContentStreamProcessor.java:377)
Used itextpdf-5.5.9 and itext-xtra-5.5.9
Sample code :
PdfReader reader = new PdfReader(src);
PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(targetPdf));
stamper.setRotateContents(false);
List<PdfCleanUpLocation> cleanUpLocations = new ArrayList<PdfCleanUpLocation>();
Rectangle rectangle = new Rectangle(400, 600, 500, 650);
cleanUpLocations.add(new PdfCleanUpLocation(1, rectangle, BaseColor.BLACK));
PdfCleanUpProcessor cleaner = new PdfCleanUpProcessor(cleanUpLocations, stamper);
cleaner.cleanUp();
stamper.close();
reader.close();