Silverlight Issue : Save in Jpeg format
I am new to Silverlight. We are working on silverlight 3.0 and telerik controls.
I want to implement a functionality that specific part of the file like stack panel or grid needs to be export or print to the image format. I mean when i click on specific button then that part of the application needs to export in image format.
My first question is, Is it possible to implement it in Silverlight3.0?
Or funcitonality is in Silverlight4.0.
If it is possible then can anyone please show me a way to implement it?
Thanks In Adva开发者_如何学Gonce, Amit
Silverlight 4 hasn't added any features to allow the export of bitmap data to other formats. However if your purpose is ultimately to print then printing support has been added to Silverlight 4.
However there is on codeplex imagetools which adds load/save from bmp, Png and Jpeg.
Here is a tutorial that does what you need: http://blog.blueboxes.co.uk/2009/07/21/rendering-xaml-to-a-jpeg-using-silverlight-3/
Note that this example uses a third party library (FjCore) to re-encode the image as a higher quality jpeq, but you dont need to do that to accomplish the goal, you can remove that code and just save the image bytes directly.
精彩评论