如何以编程方式阅读PDF书签

编程入门 行业动态 更新时间:2024-10-09 09:19:30
本文介绍了如何以编程方式阅读PDF书签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我使用PDF转换器访问PDF中的图形数据。一切工作正常,除了我没有得到一个书签的列表。是否有可以读取PDF书签的命令行应用程序或C#组件?我发现iText和SharpPDF库,我目前正在通过他们。

I'm using a PDF converter to access the graphical data within a PDF. Everything works fine, except that I don't get a list of the bookmarks. Is there a command-line app or a C# component that can read a PDF's bookmarks? I found the iText and SharpPDF libraries and I'm currently looking through them. Have you ever done such a thing?

推荐答案

尝试以下代码

PdfReader pdfReader = new PdfReader(filename); IList<Dictionary<string, object>> bookmarks = SimpleBookmark.GetBookmark(pdfReader); for(int i=0;i<bookmarks.Count;i++) { MessageBox.Show(bookmarks[i].Values.ToArray().GetValue(0).ToString()); if (bookmarks[i].Count > 3) { MessageBox.Show(bookmarks[i].ToList().Count.ToString()); } }

注意:不要忘记添加iTextSharp DLL您的专案。

Note: Don't forget to add iTextSharp DLL to your project.

更多推荐

如何以编程方式阅读PDF书签

本文发布于:2023-11-09 07:53:17,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1571790.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:书签   方式   PDF

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!