将XPSImage对象转换为Bitmap对象 [英] Converting XPSImage object to Bitmap object

查看:94
本文介绍了将XPSImage对象转换为Bitmap对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试下面这段代码。

I am trying something like the below piece of code.

Bitmap myBitmap=new Bitmap(
myXpsDocument.FixedDocumentSequenceReader.FixedDocuments[0].FixedPages[0].Images.First().Uri.AbsolutePath)






or

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



但上述工作都没有。请建议。


But neither of the above work. Please suggest.

推荐答案

你好,



你不能用URI来获取图像URI只是一个字符串,用作资源的id。



你需要做的是获取XpsImage本身并获取流



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

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







Valery。




Valery.


这篇关于将XPSImage对象转换为Bitmap对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆