Redaction using itext 5 for a scanned pdf -
i trying redact data scanned pdf using itext 5 somehow it's not working out me. able create redaction not able apply it. tried given examples works until creating redaction
string filename = "scanned.pdf"; string dest = "output_scannedpdf.pdf"; pdfreader reader = new pdfreader(src + filename); int page = 1; rectangle rect = new rectangle(500, 50, 200, 300); pdfstamper stamper = new pdfstamper(reader, new fileoutputstream(dest + dest)); pdfannotation annotation = new pdfannotation(stamper.getwriter(), rect); annotation.put(pdfname.subtype, new pdfname("redact")); annotation.settitle("my author"); annotation.put(new pdfname("subj"), new pdfname("redact")); float[] fillcolor = { 0, 0, 0 }; annotation.put(new pdfname("ic"), new pdfarray(fillcolor)); float[] fillcolorred = { 1, 0, 0 }; annotation.put(new pdfname("oc"), new pdfarray(fillcolorred)); stamper.addannotation(annotation, page); // manipulatepdf(dest, dest1); pdfcleanupprocessor cleaner = new pdfcleanupprocessor(stamper); cleaner.cleanup(); stamper.close(); reader.close(); i'm getting null pointer exception in extractlocationsfromredactannots() method pdfname annotsubtype = annotdict.getasname(pdfname.subtype);
Comments
Post a Comment