bookmarksxpsdocumentdocumentviewer

DocumentMap/Table of Contents for DocumentViewer, and calling a hyperlink by name or link number for XPS documents


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?


Solution

  • 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.