I know there are issues with relying on this alone for redaction. We are not doing that, this is just one part of a larger process. This question is about unit testing, not our operating procedure.
Here's how we are adding the boxes
- Code: Select all
private static void HideText(PdfPageBase page, string text, TextFindParameter searchFindParameter)
{
var textFindCollection = page.FindText(text, searchFindParameter);
if (textFindCollection is null)
{
return;
}
foreach (var textFind in textFindCollection.Finds)
{
page.Canvas.DrawRectangle(PdfBrushes.Black, textFind.Bounds);
}
}
My question is: How do I get the shapes in the page, specifically the rectangle just drawn, after this?
The only populated collection in page after this PageLayers, but I've not found anything of use in there. ExtractImages returns nothing, which is not surprising as these are Shapes.
I imagine I need to cast something as something else to be able to get to the Shapes, but I cannot find out what. I found an example that went through Section Tables, but I cannot find a Tables collection anywhere.