DocumentViewer 的 DocumentMap/目录,以及通过名称或链接号调用 XPS 文档的超链接
我有带有标题书签的 XPS 文件。如果您在 Word 中打开源文档并转到“查看”->“文档结构图”,您会在左侧看到所有书签。是否有可能在 DocumentViewer 中获得相同的功能,就像在某种 PDF 阅读器中使用 PDF 文档一样?
此外,RequestNavigateEventHandler 显示 XPS 文档中的每个超链接/书签都有一个特定的 Uri,类似于“C:\my path\to\file.xps#PG_N_LNK_X”,其中 X 是链接的唯一编号,N 是链接的唯一编号。页码。我想找出一种通过标题调用书签的方法。例如,如果我有一个名为“主屏幕”的部分,位于 XPS 文件的第 8 页,则该书签的 Uri 将以类似 #PG_8_LNK_3 的形式结尾。我可以从书签标题中获取该 Uri 吗?
I have XPS files with header bookmarks. If you open the source document in Word and go to view->Document Map, you see all of the bookmarks on the left. Is it possible to get this same functionality in DocumentViewer, like you would get with a PDF document in some sort of PDF reader?
Also, the RequestNavigateEventHandler shows that each hyperlink/bookmark in an XPS document has a specific Uri which is something like "C:\my path\to\file.xps#PG_N_LNK_X" where X is a unique number for the link and N is the page number. I would like to figure out a way to call a bookmark by its heading. For example, if I had a section called "Main Screen" which was on page 8 of the XPS File, the Uri for that bookmark would end something like #PG_8_LNK_3. Is it possible for me to get that Uri from the Bookmark Heading?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
对于那些想知道的人来说,XPS 文档只是 ZIP 文件。解压缩 zip 并解析 XML 文件 \Documents\1\DocStructure.Struct 以获取大纲条目。
For those wondering, XPS documents are simply ZIP files. Extract the zip and parse the XML file \Documents\1\DocStructure.Struct for the outline entries.
看一下:
如何在指定书签中打开 XPS
最后一个答案中的方法“GetBookmarks”从 XPS 文件中提取书签。方法“GotoBookmarkElement”导航到书签。
可以通过设置 Frame.Source 属性来更快地导航到书签:
Uri 构造函数的输入字符串如下所示:
对于位于以下位置的文件:
Take a look at:
How to open a XPS in a specified bookmarks
The method "GetBookmarks" in the last answer extracts the bookmarks from the XPS-File. The method "GotoBookmarkElement" navigates to the bookmark.
A faster way to navigate to the bookmark could be done by setting the Frame.Source property:
The input string for the Uri-Constructor look´s like:
for a file which is located in: