0

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:

enter image description here

This error is solved if I run the application as Administrator, but that is not acceptable.

Any ideas?

adripanico
  • 1,026
  • 14
  • 32

1 Answers1

1

Put your code in a try { } catch() {} block and see what exception it throws using a debugger.

Tony The Lion
  • 61,704
  • 67
  • 242
  • 415
  • 1
    Install a debugger? I mean VS Express is free, so you could just install that. – Tony The Lion Aug 06 '13 at 08:38
  • I'll try to print out the catched exception and let you know about it. – adripanico Aug 06 '13 at 08:38
  • Solved! In a earlier version of the application I tried to store the temporal image in the root of C:\ and it seems that the DLL project who stores such image was not being updated, so the program still tried to store the file in C:\ and that is why I needed Admin privileges. Thanks! – adripanico Aug 06 '13 at 09:36