Hi, I’ve run into a problem that when I edit redact, sometimes the text that comes right behind them can shift to the left, where the redact was made.
ShiftedTextAfterRedaction.pdf (14.0 KB)
I’ve attached a file with which the problem can be reproduced with the following code:
@Test
void shiftedTextAfterRedaction() throws IOException {
var pdfInputStream = new ClassPathResource("pdf/ShiftedTextAfterRedaction.pdf").getInputStream();
Document document = new Document(pdfInputStream);
Annotation annotation = document.getPages().get_Item(1).getAnnotations().get_Item(2);
if (annotation instanceof RedactionAnnotation) {
com.aspose.pdf.Redaction.redactText(annotation.getPage(), annotation.getRect());
annotation.flatten();
}
document.save("result.pdf");
}
image.png (11.6 KB)
After applying the redact. Some of the text after it is shifted to the left.
I found a similar problem, not sure if the cause is the same. Is there any workaround for this or what could be causing the problem?