Skip to content

Add support for multi-line text search

which is available in Poppler since version 21.03.0

For that we create a new EvFindRectangle type to hold more match information apart from coordinates, and use it all across Evince including pdf backend (ev-poppler.cc) and djvu backend (djvu-document.c) which are the only backends implementing the EvDocumentFindInterface.

To not break API compatibility, we added a new EvDocumentFindInterface function which returns GList of this new EvFindRectangle type:

   GList *(* find_text_extended) (EvDocumentFind *document_find,
                                  EvPage         *page,
                                  const gchar    *text,
                                  EvFindOptions   options);

and changed Evince to use this new function instead of find_text_with_options().

Some info about how this new search feature works:

  • Ignores hyphen character while matching when:

    1. it's the last character of the line.
    2. its corresponding matching character in the search term is not an hyphen too.
  • Any whitespace characters in the search term will be allowed to match on the logic position where the lines split (i.e. what would normally be the newline character in a text file, but PDF text does not include newline characters between lines).

  • It won't match on text spanning more than two lines, i.e. it only matches text spanning from end of one line to start of next line.

Part of issue #333 (closed)

Closes #333 (closed)

Edited by Nelson Ben

Merge request reports