We’re building a TTS feature into our reader but I’ve encountered strange behavior while highlighting text as it is spoken.
I’m using the follow code to capture the word coordinates and render the highlight as the words are spoken.
for (TextExtractor.Line line = textExtractor.GetFirstLine(); line.IsValid(); line = line.GetNextLine())
for (TextExtractor.Word word = line.GetFirstWord(); word.IsValid(); word = word.GetNextWord())
var modifiedWord = word.GetString();
var box = word.GetQuad();
var rect = new Rect();
rect.x1 = quads;
rect.y1 = quads;
rect.x2 = quads;
rect.y2 = quads;
Highlight = pdftron.PDF.Annots.Highlight.Create(_currentPdfDocument.GetSDFDoc(), Annot.Type.e_Underline, rect);
if (Highlight == null)
Highlight.SetColor(new ColorPt(0, 0, 0), 3);
As the text is speaking I am able to render most of the highlights. However when zoomed into the page, so that the entire page is not completely visible, it stops rendering my highlights at about 80% of the way down the page. When the entire page is visible, all highlights are rendered correctly. It happens in more than one book. I’ve validated that the coordinates are valid by selecting the highlight and comparing the results with the GetQuad() call above. It just simply stops rendering.
My counterpart working on the iOS client does not experience this issue.
Any thoughts or help you could provide would be very helpful!