[poppler] Printing support in poppler-qt

Krzysztof Kowalczyk kkowalczyk at gmail.com
Tue Sep 5 02:05:23 PDT 2006


On 9/5/06, Stefan Kebekus <kebekus at kde.org> wrote:
> 2) the list of links returned by page->links() is always empty.

Page::link() directly calls PDFDoc that returns cached links object
(see PDFDoc::links()). Those links are only generated if
PDFDoc::displayPageSlice() has already been called for that page with
doLinks=true (see PDFDoc::displayPageSlice()). Also, PDFDoc::links()
will only work the first time, since it gives the caller ownership of
the object and doesn't re-generate it.

Most likely Page::link() depends on something that isn't guaranteed.
It's easy to always get your own copy of links. I use this function:

static Links *GetLinksForPage(PDFDoc *doc, int pageNo)
{
    Object obj;
    Catalog *catalog = doc->getCatalog();
    Page *page = catalog->getPage(pageNo);
    Links *links = new Links(page->getAnnots(&obj), catalog->getBaseURI());
    obj.free();
    return links;
}

so you could probably just replace:
  Links *xpdfLinks = data->doc->data->doc.takeLinks();
whith
  Links *xpdfLinks = GetLinksForPage(data->doc->data->doc, <the right page no>)

-- kjk
Sumatra - PDF viewer for windows
http://blog.kowalczyk.info/software/sumatrapdf/


More information about the poppler mailing list