PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sun Jul 14, 2024 10:19 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Wed Nov 10, 2010 9:51 pm 
Offline

Joined: Wed Nov 10, 2010 9:37 pm
Posts: 1
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


Top
 Profile  
Reply with quote  
PostPosted: Mon Nov 15, 2010 8:46 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3101
Location: Cologne, Germany
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.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Fri Nov 19, 2010 11:08 pm 
Offline

Joined: Fri Nov 19, 2010 11:03 pm
Posts: 3
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..


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: Bing [Bot] and 18 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group