Click here to Skip to main content
15,891,567 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying something like the below piece of code.
C#
Bitmap myBitmap=new Bitmap(
myXpsDocument.FixedDocumentSequenceReader.FixedDocuments[0].FixedPages[0].Images.First().Uri.AbsolutePath)

or
C#
Bitmap myBitmap=new Bitmap(
myXpsDocument.FixedDocumentSequenceReader.FixedDocuments[0].FixedPages[0].Images.First().Uri.OriginalString)

But neither of the above work. Please suggest.
Posted
v4

1 solution

Hello,

You can't use the URI to get the image a URI is just a string of characters used as an id for a resource.

What you need to do is get the XpsImage itself and get read the stream

C#
XpsImage image = myXpsDocument.FixedDocumentSequenceReader.FixedDocuments[0].FixedPages[0].Images.First();
Bitmap myBitmap = new Bitmap(image.GetStream()); 



Valery.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900