We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

RedactionAnnotation captures adjacent letters

RedactionAnnotation captures adjacent letters.
How can this be solved?

Listing of our replacement program:

Document pdf = new Document(dataDir + "inputPDF.pdf");

TextFragmentAbsorber textFragmentAbsorber = new TextFragmentAbsorber("uu");
textFragmentAbsorber.TextReplaceOptions.ReplaceAdjustmentAction = TextReplaceOptions.ReplaceAdjustment.None;
pdf.Pages.Accept(textFragmentAbsorber);

TextFragment textFragment = textFragmentAbsorber.TextFragments[1];

RedactionAnnotation ra = new RedactionAnnotation(textFragment.Page, textFragment.Rectangle);
textFragment.Page.Annotations.Add(ra);
ra.Redact();

textFragment = textFragmentAbsorber.TextFragments[2];

char space = ' ';
double rectangleWeight = textFragment.Rectangle.Width;
textFragment.Text = space.ToString();
textFragment.Text = new string(space, (int)(rectangleWeight / textFragment.Rectangle.Width) + 1);
textFragment.TextState.BackgroundColor = Color.Black;

pdf.Save(dataDir + "redacted.pdf");

Source file in the attachment. Also in the attachment is obtained and the desired result.

inputPDF.pdf (12.9 KB)

@coderandom1

Thank you for contacting support.

We have worked with the data shared by you and have been able to reproduce the issue in our environment. A ticket with ID PDFNET-46207 has been logged in our issue management system for further investigation and resolution. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is resolved.

We are sorry for the inconvenience.