如何使用Java中的PDFBox获取PDF文件中的所有书签 [英] How to get all bookmarks in PDF file using PDFBox in Java

查看:962
本文介绍了如何使用Java中的PDFBox获取PDF文件中的所有书签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Apache PDFbox的新手.我想使用Java中的PDFBox库提取PDF文件中的所有书签.知道如何提取它们吗?

I am newbie in Apache PDFbox. I want to extract all bookmarks in PDF file using PDFBox library in Java. Any idea how to extract them?

推荐答案

来自

(...)

public void printBookmark(PDOutlineNode bookmark, String indentation) throws IOException
{
    PDOutlineItem current = bookmark.getFirstChild();
    while (current != null)
    {
        System.out.println(indentation + current.getTitle());
        printBookmark(current, indentation + "    ");
        current = current.getNextSibling();
    }
}

这篇关于如何使用Java中的PDFBox获取PDF文件中的所有书签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆