0

I've the problem, that the WPF-DocumentViewer throws exceptions during scrolling through the document. The document it self was loaded successful and is shown correctly.

I get the following error message: Unkown URI-Prefix.

The XPS is generated by GemBox.Spreadsheet like: Export to XpsDocument / DocumentViewer Control

I don't get why the xps it loaded and an exception is thrown.

Thank you!

BendEg
  • 20,098
  • 17
  • 57
  • 131
  • It renders on demand. I suspect it is coming across some bad syntax. https://msdn.microsoft.com/en-us/library/aa384461(v=vs.85).aspx – paparazzo Jan 22 '15 at 14:39
  • @Blam thank you, so i can't do anything, becuase it is a third party component? – BendEg Jan 22 '15 at 14:41
  • I would not give up. You may just need to add a reference. It was just a comment. That is where I would start. – paparazzo Jan 22 '15 at 14:43

1 Answers1

1

This problem occurred because the XpsDocument object needs to stay referenced so that DocumentViewer can access additional required resources (notice the use of XpsDocument xpsDocument; in that sample code).
Otherwise GC will collect the XpsDocument object and DocumentViewer will not be able to work.

Just as an FYI, you can also find this information in DocumentViewer.Document property's documentation (see the example code and comments which are provided).

Mario Z
  • 4,328
  • 2
  • 24
  • 38