PDFsharp & MigraDoc Foundation

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

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Sun May 29, 2011 3:24 pm 
Offline

Joined: Sun May 29, 2011 3:14 pm
Posts: 3
LS,

I am building an application in LightSwitch (LightSwitch uses SilverLight)

As I am printing invoices I want to place a logo on the paper. And my problem is how can I load an image to XImage.
XImage.FromFile is depreciated and doesn't work so I tried:

string LogoFile = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\RawoLogo.jpg";
FileStream file = new FileStream(LogoFile, FileMode.Open);
int BitsLength = (int)file.Length;
byte[] Bits = new byte[BitsLength];
file.Read(Bits, 0, BitsLength);
XImage image = XImage.FromStream(file);
file.Close();

I do not get any compinling errors, but when the program get to XImage image = XImage.FromStream(file) there is an error:
The byte array is not a recognized imageformat.

It doesn't matter if I use a JPG or PNG, both report the same error. The file exists on disc, it is loaded the amount of bytes correspond with the size of the image.

Am I missing something, is there something I am doing wrong??

I hope someone can help me and tell me how I can get my logo-image in my XImage.


Kind regards,



Clemens Linders


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

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 60 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:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group