Question

I trying to read in a XPS file with XamlReader.Load ( XMLReader ). Some XPS files read in and I can walk through perfectly. One of the XPS files I am working, that displays correctly in IE, gives the following exception:

Cannot convert string '/png/1.png' in attribute 'ImageSource' to object of type 'System.Windows.Media.ImageSource'. Cannot locate resource 'png/1.png'.  Error at object 'System.Windows.Media.ImageBrush', Line 2309 Position 166.

The image file in question is in the XPS file at the location specified 'png/1.png' when I look at the file in IE or by browsing in with unZIP tool, the image file displays correctly.

Any ideas?

Was it helpful?

Solution

The solution to this question involves setting up a ParserContext as an optional argument to Load().

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top