[poppler] pdf file whose index has no link
Vincent Torri
vtorri at univ-evry.fr
Mon Apr 17 12:53:32 PDT 2006
>
> I don't have time to go through the entire PDF to figure out which
> object it is. But if you can tell me which, then I can easily look at it to
> determine why you get the results you do.
what do you mean by "object" ?
> This is good - you get each item's action, which can be one of the
> many (12?) standard types of Actions (or custom) allowed in a PDF.
in Link.h, I see 7 kind of actions (LinkActionKind enum). Maybe they are
not all implemented.
>> LinkDest *dest = ((LinkGoTo *)item->action)->getDest ();
>
> This assumes that ALL actions are GoTo actions with destinations.
> BAD ASSUMPTION. For example, enclosed are two PDFs which have bookmarks
> with VERY different types of actions.
well, before defining dest, I test the action with :
if (item->action->getKind () != actionGoTo) *******
the complete code is :
int
epdf_index_item_page_get (Epdf_Document *document, Epdf_Index_Item *item)
{
if (!item || !item->action || !item->action->isOk ())
return -1;
if (item->action->getKind () != actionGoTo)
return -1;
LinkDest *dest = ((LinkGoTo *)item->action)->getDest ();
if (!dest || !dest->isOk ())
return -1;
if (dest->isPageRef ())
return document->pdfdoc->findPage (dest->getPageRef ().num,
dest->getPageRef ().gen) - 1;
return dest->getPageNum () - 1;
}
Vincent
More information about the poppler
mailing list