I'm developing a Windows Form
application under Windows XP. I've created a Class Library
that is accessed by the user application in order to create PDF documents using PdfSharp and MigraDoc libraries.
My problem starts when I try to add a bitmap to the PDF. I have the image stored in the resources, and due MigraDoc features, I firstly need to save the file on the disk in order to do that, as you can see in the next lines:
string logoTemp = Directory.GetCurrentDirectory().ToString() + "\\imagename.png";
if (!File.Exists(logoTemp))
((Bitmap)Properties.Resources.imagename).Save(logoTemp, ImageFormat.Png);
paragraph.AddImage(logoTemp);
It works fine on my computer and also on a 32 bits Windows 7, but it gets throw an exception on 64 bits Windows 7, as showed in the next screenshot:
This error is solved if I run the application as Administrator, but that is not acceptable.
Any ideas?
Put your code in a try { } catch() {}
block and see what exception it throws using a debugger.