如何用poppler提取pdf索引/目录? [英] how to extract pdf index/table-of-contents with poppler?
本文介绍了如何用poppler提取pdf索引/目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我看到像okular和evince这样的pdf查看器能够很好地显示pdf文档(书)的索引,并链接到每个段落。
他们怎么能这样做?他们使用poppler库,我怎么能用poppler提取那个索引,或者一般?
I see that pdf-viewers like okular and evince are able to display the index of a pdf document (book) very well, with link to every paragraph. How can they do so? They use poppler library, how could I do extract that index with poppler, or in general?
推荐答案
它只停在第一级(递归需要更深入)
it just stops at first level (recursion needed to go more deeply)
toc=document->toc();
QDomElement docElem = toc->documentElement();
QDomNode n = docElem.firstChild();
while(!n.isNull()) {
QDomElement e = n.toElement(); // try to convert the node to an element.
if(!e.isNull()) {
qDebug("elem %s\n",qPrintable(e.tagName())); // the node really is an element.
}
n = n.nextSibling();
}
这篇关于如何用poppler提取pdf索引/目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文