PDFsharp & MigraDoc Foundation https://forum.pdfsharp.net/ |
|
Silverlight 4 and XImage.FromFile method https://forum.pdfsharp.net/viewtopic.php?f=2&t=1417 |
Page 1 of 1 |
Author: | dflack [ Wed Nov 10, 2010 9:51 pm ] |
Post subject: | Silverlight 4 and XImage.FromFile method |
I'm a newbie to PDFSharp and C#- so far I think it's working very well and quite easy to use. I'm using PDFSharp in conjunction with Silverlight 4 and ArcGIS Server to create PDF map output. That works fine. I've also had the need to add some graphic elements (rectangles and text). That works fine too- so far I have a clean PDF that looks exactly how I want. But I'm having trouble adding an image to this layout. From the examples it seems that all I should need to do is add two lines of code as follows: Code: XImage imgLegend = XImage.FromFile("Graphics/Legend.png"); gfx.DrawImage(imgLegend, 500, 500); The problem here is that VS is throwing the error: 'PdfSharp.Drawing.XImage.FromFile(string)' is obsolete: "'Can't use this in Silverlight!'" Is the FromFile method really obsolete? Any suggestions for a workaround? Thanks, Dave |
Author: | Thomas Hoevel [ Mon Nov 15, 2010 8:46 am ] |
Post subject: | Re: Silverlight 4 and XImage.FromFile method |
Hi, Dave! dflack wrote: Is the FromFile method really obsolete? Any suggestions for a workaround? Silverlight runs in a Sandbox with limited access to the local file system. The Silverlight way would be images added as ressources. If that's not possible, then you could load images via HTTP and cache them in isolated storage. |
Author: | ansdhr [ Fri Nov 19, 2010 11:08 pm ] |
Post subject: | Re: Silverlight 4 and XImage.FromFile method |
I am trying to load an image too. My image is in http location. If I want to use XImage.FromStream(), what are the steps to read the image as a stream? I've played with BitmapImage, WriteableBitmap, or Image, but haven't got it working.. |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |