I've been working on a pdf redaction tool and found this very slick code. It does nearly everything which is needed and so quickly.
The trouble is I need to redact all but the last four or the found string. I have tinkered w/custom cleanup strategy, the autocleanup, etc.. I'm missing something.
What are some options to use the following, and redact only a portion of the found text?
Thanks in advance for your input,
`try (PdfDocument pdf = new PdfDocument(new PdfReader(SRC), new PdfWriter(new_File(SRC, "redact"))))
{
final ICleanupStrategy cleanupStrategy = new RegexBasedCleanupStrategy(Pattern.compile("Alice", Pattern.CASE_INSENSITIVE)).setRedactionColor(ColorConstants.PINK);
PdfCleaner.autoSweepCleanUp(pdf, cleanupStrategy);
}`
I have tinkered w/custom cleanup strategy, the autocleanup, etc.. I'm missing something. I've reviewed documentation here, unable to connect all the dots: