Remove text from PDF

Hi Mario

My task is:

  1. Load PDF file
  2. Find text “Hello”
  3. Remove this text
  4. Save to PDF again

I am trying the next:

var page = document.Pages[0];
var textElement = page.Content.FindText("HELLO").OfType<PdfTextContent>().Reverse();
textElement.Collection.Remove(textElement);

Hi,

Try this:

var page = document.Pages[0];
foreach (var text in page.Content.GetText().Find("HELLO"))
    text.Redact();

Does this work for you?

Regards,
Mario