When I redact the “PDF” word in the vertical text the following word overlapping with the other text. What could be the reason?
Aspose.PDF .NET 20.01 version
Input file: Text-searchable.pdf (7.9 KB)
Output file: redacted-Text-searchable.pdf (14.7 KB)
Code snippet:
Document tempDocument = new Document(sourcePath);
foreach (Page actualPage in tempDocument.Pages)
{
TextFragmentAbsorber textFragmentAbsorber = new TextFragmentAbsorber("PDF");
textFragmentAbsorber.TextSearchOptions.IsRegularExpressionUsed = true;
actualPage.Accept(textFragmentAbsorber);
TextFragmentCollection textFragmentCollection = textFragmentAbsorber.TextFragments;
foreach (TextFragment textFragment in textFragmentCollection)
{
Rectangle rect = textFragment.Rectangle;
RedactionAnnotation annot = new RedactionAnnotation(actualPage, new Rectangle(rect.LLX + 1.0, rect.LLY, rect.URX - 1.0, rect.URY))
{
FillColor = Aspose.Pdf.Color.Black,
};
actualPage.Annotations.Add(annot);
annot.Redact();
}
}
Thanks,
Gabor