Redact area in PDF using Java and Aspose.PDF - Redaction Annotation has borders

Hello,
When adding a RedactionAnnotation, a dotted/dashed low resolution border appears around the redaction. This makes the document unusable.

I’ve tried both approaches provided in the samples in git - with or without facades.

@abhizone

Would you please share a sample code snippet with us along with screenshot of the problem in the PDF. We will test the scenario in our environment and address it accordingly.

1 Like

Scenario:
We convert a TIFF file to PDF, then add redactions (and other annotations as needed), then convert the PDF to TIFF again using ASPOSE APIs at each stage.

Issue:
When we save the PDF with redactions, some redactions randomly show a partial black border.
The borders are not always visible unless we zoom to 100% or higher.

Upon converting the PDF to TIFF the border becomes more apparent and renders the document unusable.

**Code to add redaction. I similarly added multiple redactions, at different locations. **
double llx = 100.0;
double lly = 100.0;
double urx = 200.0;
double ury = 200.0;

com.aspose.pdf.Document pdfDocument = new com.aspose.pdf.Document(“C:\Development\annotations\aspose_sample.pdf”);
PdfAnnotationEditor editor = new com.aspose.pdf.facades.PdfAnnotationEditor();
editor.bindPdf(pdfDocument);
// redact required area // hardcoded white
editor.redactArea(1, new com.aspose.pdf.Rectangle(llx, lly, urx, ury), java.awt.Color.white); editor.save(“C:\Development\annotations\aspose_sample_redacted.pdf”);

Code to convert to TIFF:

com.aspose.pdf.Document redactedPdf = new com.aspose.pdf.Document(“C:\Development\annotations\aspose_sample_redacted.pdf”); ByteArrayOutputStream tiffStream = new ByteArrayOutputStream();
//create PdfConverter object and open PDF file
PdfConverter pdfConverter = new PdfConverter();
pdfConverter.bindPdf(redactedPdf);
//set resolution
pdfConverter.setResolution(new Resolution(300));
//start conversion process
pdfConverter.doConvert();
//save the PDF as TIFF with specified compression type
pdfConverter.saveAsTIFF(tiffStream, CompressionType.CCITT4);

FileOutputStream tiffFile = new FileOutputStream(“C:\devePDF with redactions.pdf (540.2 KB)
Screenshot with redactions.PNG (159.0 KB)
Aspose Issue.zip (550.2 KB)
lopment\annotations\aspose_redacted_tiff.tif”); tiffStream.writeTo(tiffFile);
// close the converter
pdfConverter.close();
// return the file stream

Attached Zip file with following items:
Screenshot of redactions drawn on TIFF file:
Sample PDF before redactions saved:
Sample PDF after redactions saved:
Sample Tiff after redactions saved:

I also tried the alternative approach for redactions using RedactionAnnotation, instead of the facades approach. In the alternative approach, the border ALWAYS appears, even if I set the border color as Color.Empty.

Please advise if I am missing anything in generating the redactions.

Please also advise if there is a different way to get dedicated quicker support for our issue.

@abhizone

We could not find original PDF in your shared files. Only a TIFF image was there with no redactions. Would you please share the original source PDF file as well.

PDF with redactions.pdf (540.2 KB)

Please advise about the expedited support optionsTiff-PDF-Converted.pdf (84.8 KB)

@abhizone

We used the following code snippet with Aspose.PDF for Java 20.11.1 to add a redaction annotation and did not notice the blurred border issue.

Document doc = new Document(dataDir + "Tiff-PDF-Converted.pdf");
Rectangle rect = new Rectangle(100, 100, 200, 200);
RedactionAnnotation annot = new RedactionAnnotation(doc.getPages().get_Item(1), rect);
annot.setFillColor(Color.getWhite());
annot.setColor(Color.getWhite());
doc.getPages().get_Item(1).getAnnotations().add(annot);
annot.redact();
doc.save(dataDir + "Redaction_out.pdf");

Redaction_out.pdf (656.3 KB)

Would you please check the attached output generated at our end and let us know in case you notice any issue in it.

Would you please share which of your issues you want to be expedited? OR in what aspects you want to be advised about the priority support?

Would you please check the attached output generated at our end and let us know in case you notice any issue in it.

Please see the bottom left of the document. I see three sides of the square redaction that was drawn.

Would you please share which of your issues you want to be expedited? OR in what aspects you want to be advised about the priority support?
The PDF should not show the borders/outline of the redaction annotation. This is the issue I’d like to be prioritized.

@abhizone

Please check the attached screenshot that how a border is not showing when we opened the output PDF in Adobe Reader. redactionarea.png (105.6 KB)

You can sure expedite the issue by reporting it to the paid support forum. However, we did not notice this issue on our side and that is why it is not yet logged in our issue tracking system. Would you please share in which version of Adobe Reader you are viewing the document and border around the redaction annotation?

Please check the attached screenshot that how a border is not showing when we opened the output PDF in Adobe Reader.

I’ve recorded a video and posted for your reference. My Adobe Reader version is 20.013.

@abhizone

We were now able to notice the issue at our side too when we zoomed the page to 75%. Therefore, an issue as PDFJAVA-40011 has been logged in our issue tracking system for the sake of correction. We will further look into its details and keep you posted with the status of its correction. Please give us some time.

We apologize for the inconvenience.

PS: You can always create a ticket with the reference of issue ID in priority support forums in order to get it escalated if it is urgent for you.

1 Like

The issues you have found earlier (filed as PDFJAVA-40011) have been fixed in Aspose.PDF for Java 21.6.