[poppler] New API

Kristian Høgsberg krh at bitplanet.net
Sat Mar 26 22:02:44 PST 2005


Jonathan Blandford wrote:
> Hi,
> 
> I converted evince over to using the new glib API locally on my machine.

Cool, did the zoom crasher bug go away?

> It seems to work fine for simple viewing.  I want to add API for
> thumbnailing and for the indexing.  The thumbnailing seems
> straightforward enough, something like:
> 
> GdkPixbuf *poppler_page_get_thumbnail(PopplerPage *page);
 >
> should suffice.  It will return a pixbuf iff a prerendered one exists.

That's exactly the API I've been implementing.  I've attached my 
work-in-progress patch; it compiles but I still need to test it before 
committing it.  I plan on doing that tomorrow.  The patch also add an 
API that I think will be sufficient for searching:

gboolean   poppler_page_find_text        (PopplerPage  *page,
                                           const  char  *text,
                                           GArray      **results);


returns FALSE if no matches were found or TRUE if at least one match was 
found in the page.  If results is not NULL and at least one match was 
found, *results will be set to a newly allocated GArray of 
PopplerRectangles corresponding to the matches.  I'm not sure that this 
is the API we want, there's a couple of questions:

  - do we want a case sensitivity flag? I guess so... even if case 
sensitive searching doesn't make sense to me, it's probably one of those 
decisions the application should make.

  - wouldn't it be better if poppler highlighted the selection by 
drawing the selection using inverse text in standard theme colors?

> As for the indexing, there are a couple ways I could do it.  I could go
> for the really easy approach and do:
> 
> GtkTreeModel *poppler_document_get_index (PopplerDocument *doc);
> 
> Which would return a GtkTreeStore filled with Links, etc.  While
> really useful for evince, it's not particularly generic.  The
> alternative is to provide a mechanism to generate the tree.

You mean some kind of callback based mechanism?  That could work, I 
think.  Te GtkTreeModel approach is probably too much of a special case. 
   Do you have a suggestion as to what a callback API could look like?

cheers,
Kristian


More information about the poppler mailing list