[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with Search Results of PDFDocument-Class


Am 01.09.24 um 06:35 schrieb BB:
I guess you realise that the co-ordinate realms of the DocumentViewer and the pdf RectF are completely different. I guess we need to determine a range based on the topmost-leftmost character and the bottommost-rightmost character position (as the last line may not be as wide) for both realms and work out a conversion from there.

I don't think that this will solve the problem. One of my dirty coordinate conversions  ...

Paint.Rectangle(aRectF[i].x + aRectF[i].x / Width * 10, height - 12 - aRectF[i].y * (height + 10) / Height, aRectF[i].w, aRectF[i].h * Height / Width * 0.7)

works pretty well on the sample PDF included in the demo app, which is based on text only. But then I tried a PDF document out of the real world with header, footer, pictures etc. and found that the RectF arrays delivered by the PDFDocument-Class are completely unusable. Even the number of search hits per page were wrong in one case (5 instead of 6). To my regret I can't share the PDF as proof.

It may also help to understand how DocumentViewer renders a pdf document. Which I dont.
I suggest to put the focus on the PDFDocument-class first and hope that someone can tell us how to use the search results and why the number of search hits can be wrong.

Best Regards, Claus


Follow-Ups:
Re: Problem with Search Results of PDFDocument-ClassClaus Dietrich <claus.dietrich@xxxxxxxxxx>
References:
Re: Problem with Search Results of PDFDocument-ClassBB <adamnt42@xxxxxxxxx>