Remove of change text in enclosed PDF

Hi! Wonder if you can help. Need to remove the whole section in orange of the enclosed PDF. Either remove or change the text. Doesn’t seem to be PdfTextContent as shown in another article. Tried using page.Content.Elements.All(page.Transform).GetEnumerator() and check each one but I wasn’t able. Any hints on how remove/change it? Thanks!
Sample PDF

Hi Barb,

Unfortunately, those are not text elements or image elements.
That text is made of path elements, so try using this:

var page = document.Pages[0];
var enumerator = page.Content.Elements.All(page.Transform).GetEnumerator();
var pathElementsToDelete = new List<PdfPathContent>();

while (enumerator.MoveNext())
    if (enumerator.Current.ElementType == PdfContentElementType.Path)
        var pathElement = (PdfPathContent)enumerator.Current;
        var bounds = pathElement.Bounds;
        enumerator.Transform.Transform(ref bounds);

        if (bounds.Top > 490 && bounds.Top < 560)

pathElementsToDelete.ForEach(e => e.Collection.Remove(e));

There is only one text element inside that orange area, it’s one for the link’s text (e.g. “equipo de soporte”).
To remove it you could do a similar iteration for the PdfTextContent like I did for PdfPathContent.
Or with the current latest version, you could do this:

page.Content.Text.Find(new Regex(@"equipo\s+de\s+soporte")).First().Redact();

Last, here is how to remove the link itself:

var link = page.Annotations.OfType<PdfLinkAnnotation>().First();

I hope this helps, let me know if you need anything else.


Thanks Mario! That helped a lot. Thought I could delete the whole box (and its content) with just one pass but I see what you did there., Thanks!