Adding the latest version of the spire.pdf dlls did not have an effect.
Some of the time, when I find text to highlight and call find.ApplyHighLight(), it highlights exactly where I would expect, that is around the found text. Other times, it highlights what looks to be half a line above the found text. The following two examples come from the same document:
This one hits the target.
I tried drawing rectangles around the found text and got the same kind of results.
This is my code
- Code: Select all
var found = page.FindText(pattern, Spire.Pdf.General.Find.TextFindParameter.Regex);
if (found?.Finds?.Length > 0)
{
foreach (PdfTextFind find in found.Finds)
{
// DrawRect(page, find);
find.ApplyHighLight();
}
}
It looks like, in the first case, there is some kind of padding in the paragraph formatting of the area the text was found in such that I need to go a few pixels lower.
Is there anyway I can programmatically find this offset?