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

Re: Problem with Search Results of PDFDocument-Class



On 1/9/24 2:07 am, Claus Dietrich wrote:

Hi

I am working on PDF-based help-viewer. When I tried to implement a search function I found that the number of hits for each page are correct, but the locations, which are returned for each page as RectF array, have nothing to do with the reality.

All attempts to transform the RectF results to something usable failed. Is there anything special I need to consider or do we have a bug here?

I attached the current state of the project. Just start it, click on the search button and enter the search expression (i.e. 'ipsum') and press Enter. The locations of hits are marked as red rectangle.

With best regards

Claus


Strange! I was working on that exact same thing over the last couple of days.

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.

It may also help to understand how DocumentViewer renders a pdf document. Which I dont.

b


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