I have a PDF document that I'd like to show the named destinations for. I'm using Poppler to do so. What I need is a list of the named destination in the document, including the names and the locations. For now, I am considering only XYZ
destinations.
Let's use the LaTeX hyperbar manual as an example PDF. From pdfinfo -dests hyperbar.pdf
, we can see there are some XYZ
named destinations in this document:
Page Destination Name
1 [ XYZ 145 716 null ] "Doc-Start"
1 [ XYZ 71 502 null ] "HD.1"
1 [ XYZ 144 754 null ] "page.1"
....
Let's take HD.1
as an example. This named destination can be looked up from the PopplerDocument
as expected, including the position. However, the named_dest
field is NULL
:
PopplerDoc* poppler_doc = poppler_document_new_from_file("hyperbar.pdf", NULL, NULL);
PopplerDest* dest = poppler_document_find_dest (poppler_doc, "HD.1");
printf("pos: p %d L %f T %f\n", dest->page_num, dest->left, dest->top);
printf("name: %s\n", dest->named_dest);
produces:
pos: p 1 L 71.004000 T 502.496000
name: (null)
According to the Poppler documentation, the PopplerDest.named_dest
field is only set when the destination is a POPPLER_DEST_NAMED
, which this is not.
Iterating all the destinations in the document returned via poppler_document_create_dests_tree()
is the same - named_dest
is always NULL.
So, my question is: considering that pdfinfo
is able to report the names of the destinations, even for XYZ
destinations, can I get these names from a PDF file using Poppler?