我正在使用itext 7.1.8
,我需要更改编校颜色,但是当我尝试这样做时,颜色不会改变。
我的代码如下所示:
PdfReader reader = new PdfReader(new FileInputStream(pdfDoc));
PdfWriter writer = new PdfWriter(new FileOutputStream("ResultFile.pdf"));
PdfDocument doc = new PdfDocument(reader, writer);
final PdfPage page = doc.getFirstPage();
final float[] borderColorBlack = { 0, 0, 0 };
PdfAnnotation redact = new PdfRedactAnnotation(new Rectangle(1, 1, 37, 20))
.setTitle(new PdfString(""))
.setColor(new float[] {0, 0, 0})
.setFlag(PdfAnnotation.TOGGLE_NO_VIEW)
.put(PdfName.Subj, PdfName.Redact)
.put(PdfName.OC, new PdfArray(borderColorBlack));
page.addAnnotation(redact);
PdfCleanUpTool cleaner = new PdfCleanUpTool(doc, true);
cleaner.cleanUp();
doc.close();
如何更改编校颜色区域?