[Poppler-bugs] [Bug 97262] Enumerate PDF named destinations

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Sat Sep 17 09:48:35 UTC 2016


https://bugs.freedesktop.org/show_bug.cgi?id=97262

--- Comment #48 from Carlos Garcia Campos <carlosgc at gnome.org> ---
(In reply to Adrian Johnson from comment #35)
> (In reply to Masamichi Hosoda from comment #31)
> > > Internally, the functions should combine the Name Tree dests and dict dests
> > > into one list.
> > 
> > Name Tree is recorded in Catalog::destNameTree.
> > It has GooString for its name.
> > So getDestName() can return the pointer of GooString.
> > The return value should not be deleted.
> > 
> > Dests Dict is recoded in Catalog::dests.
> > However, it does not have GooString for its name.
> > It has only char* for its name.
> > So getDestName() have to construct GooString from char*.
> > The return value should be deleted.
> 
> Ok leave it as two separate sets of functions.
> 
> In the longer term I would like to read all the names into a map or hash.
> The current implementation that reads the nameTree (which should already be
> sorted except for when it isn't) then runs qsort on it is not ideal. But
> that can be the topic of another bug.
> 
> > > 1) A list of just the names. The user can use poppler_document_find_dest()
> > > to get the dests.
> > 
> > Is is something like
> > GList *poppler_document_build_dests_namelist()
> > ?
> > It returns the pointer of GList which contains GBytes for destination name.
> > If you would like it, I'll create a patch.
> > 
> > However, unfortunately, if the name contains \0,
> > poppler_document_find_dest() cannot find it.
> 
> If you escape the \0 as per comment 33 it should work.
> 
> > 
> > > or
> > > 2) A binary tree of names and dests. This has the advantage that iterating
> > > the names is in alphabetical order instead of the the random order of the
> > > hash table.
> > 
> > I'd like this.
> 
> Carlos, do you have an opinion on whether to return a GList of names or
> binary tree of names/LinkDests?

I guess we could return a GTree, but I'm not sure I understand exactly what we
want. Do we need the list to be in a specific order? Do they have an order in
the PDF document that we should respect or alphabetical is what want?

> > Almost UTF-16 strings contains \0.
> 
> Isn't the glib API UTF-8 based?

Yes, which means that strings passed to public api methods are expected to be
UTF-8 and string returned by public api methods should also be UTF-8.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/poppler-bugs/attachments/20160917/17bb89ad/attachment.html>


More information about the Poppler-bugs mailing list