How can I provide a color to the area (rectangle) for which I removed text?
The coordinates of the Rectangle start at the lower left corner while the coordinates of the FloatingBox which I use to color the area ( and is some cases add some additional text) start at the upper left corner.
I can match the y-coordinate of the FloatingBox by deducting the Y-coordinate of the rectangle from the page height.
This works fine for one type of pdf’s but when I use another pdf with a slightly decreased height it suddenly does not match anymore.
Is there a way to link a FloatingBox to a rectangle or add text to a Rectange and give it a color?
You can redact a region of the PDF page, and then add color to this area with FillColor property of the RedactionAnnotation class. Please refer to this code example: Redact certain page region with RedactionAnnotation
However, please send the complete details of the scenario, including source PDF and code. We will investigate and share our findings with you.
Thank you for the sample code. I’m now able to color all the rectangles with the PdfAnnotationEditor . ( adding annotations does fit in my solution).
The only issue I still have is adding text to a specific Region/Rectangle.
When I add a color by using the PdfAnnotationEditor the color is put on top of the text which removes the text.
I found what the initial problem was/is when using the FloatingBox: When the pdf has no white border on top I can place the FloatingBox exactly where I want by setting the margins = 0.
But when there is a white space on top then setting the margins to zero does not help as the base of the FloatingBox is the first plotted pixel …
How do I define the top position of the first plot on a Page?