I am working with iText7 c# library to highlight the text and add annotations when mouse hover on the highlighted text.
I would like to annotate a rectangular area/highlighted text on my PDF. i.e. I would like to hover the mouse anywhere within the given rectangle area and have the annotation pop up.
It seems that a Text annotation only appears when hovering in the upper left corner of the annotation Rectangle. I tried using the combination of Rectangle and Text Annotation but that only seems to pop up when I'm hovering over the top left corner not the interior.
Can you tell me how to have the annotation appear when I hover anywhere within the given Rectangle?
I tried with changing the Rectangle size but, no luck..
FYI, I was able to achieve the same functionality with Pdfsharp
iText7 Output
The Annotation pops up only when we mouse hover on the borders
The output PDF link is here
Thank you in advance
Your pdfSharpOutput.pdf
has set the IC (interior color) but not the C ((border) color).
Your iText7Output.pdf
has not set the IC (interior color) but the C ((border) color).
Apparently Adobe Acrobat only displays that hover text for areas for which a color has been defined. (This behavior is arbitrary, it is not in any way prescribed by the standard. Thus, it may change in any new release of Acrobat.)
To get the same behavior with iText as with PdfSharp, you should set the interior color of the iText PdfSquareAnnotation
using one of its setInteriorColor
overloads.