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

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Tue Aug 30 13:23:39 UTC 2016


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

--- Comment #26 from Adrian Johnson <ajohnson at redneon.com> ---
I've been working on a patch for CairoOutputDev that requires access to a list
of named destinations. The core patches would be helpful. Looking at the
patches:

0001 - Looks good. Although I suggest renaming "constructLinkDest" to
"createLinkDest".

0002, 0003 - I don't think we need separate functions for Name Trees and Dests
Dict access. I suggest have one set of functions for accessing names eg:

int numDests();
GooString *getDestsName(int i);
LinkDest *getDestsLink(int i);

Internally, the functions should combine the Name Tree dests and dict dests
into one list.

0005 - I know that Jose suggested returning a GHashTable. Since the main
purpose of a hash table is mapping keys to values, and the
poppler_document_find_dest() function already does this, maybe the names could
be returned by either:

1) A list of just the names. The user can use poppler_document_find_dest() to
get the dests.

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.

Also, poppler_document_get_dests() creates the hash table each time it is
called. It maybe better to cache the hash table or use a function name like
poppler_document_build_dests_hashtable() since "get" implies fast access.

+ key = g_bytes_new (catalog->getDestsName (i),
+                                  strlen (catalog->getDestsName (i)));

You are using g_bytes because the name can contain \0 but you are using strlen
here. Also the getDestName() in Catalog will need to return a GooString, not
char *.

Although it is not clear to me whether destination names can actually contain
\0. PDF32000 section 12.3.2.3 states "The keys in the name tree may be
treated as text strings for display purposes".

-- 
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/20160830/cb5fcd81/attachment.html>


More information about the Poppler-bugs mailing list