This project has moved and is read-only. For the latest updates, please go here.

Convert pdf to png in 64bit

Apr 15, 2014 at 4:17 PM
Hi!

I’m new to Magick.net and I need to convert a pdf to png.
I am having an issue when I try to run the application in a 64bit server. The project is done with Visual Studio 2010, I have referenced Magick.NET-AnyCPU and at project‘s properties I have “Any CPU (platform)” and the code is:
   'Lo transformamos a imagen
   Dim settings As New MagickReadSettings()
   settings.Density = New MagickGeometry(300, 300)

   Using images As New MagickImageCollection()
   images.Read("C:\tmp\prueba.pdf”, settings)
          Dim horizontal As MagickImage = images.AppendHorizontally()
          horizontal.Write("C:\tmp\prueba.png”)
   End Using
But, I have the following exception:
   System.TypeInitializationException: Se produjo una excepción en el inicializador de tipo de 'ImageMagick.Types'. ---> System.TypeInitializationException: Se produjo una excepción en el inicializador de tipo de 'ImageMagick.AssemblyHelper'. ---> System.IO.FileNotFoundException: No se puede cargar el archivo o ensamblado 'Magick.NET-Q16-x86.dll' ni una de sus dependencias. No se puede encontrar el módulo especificado.
      en System.Reflection.RuntimeAssembly.nLoadFile(String path, Evidence evidence)
      en System.Reflection.Assembly.LoadFile(String path)
      en ImageMagick.AssemblyHelper.LoadAssembly()
      en ImageMagick.AssemblyHelper..cctor()
      --- Fin del seguimiento de la pila de la excepción interna ---
      en ImageMagick.AssemblyHelper.GetType(String name)
     en ImageMagick.Types..cctor()
      --- Fin del seguimiento de la pila de la excepción interna ---
      en ImageMagick.MagickReadSettings..ctor()
I have installed Ghostscript 9.14 for 64bits, Microsoft Visual C++ 2010 SP1 Redistributable Package (x64) and Visual C++ Redistributable para Visual Studio 2012 (x64).

And I also have tried to change de library to Magick.NET-x64, but I obtain the same result.

Thanks in advance.
Apr 15, 2014 at 5:22 PM
It seems your program is not running in 64-bit mode. The AnyCPU version of ImageMagick detects if you are running the program in 32 or 64 bit and loads the library for that architecture. And from your error message it looks like it is trying to load the 32 bit version of Magick.NET. If you are running your application in a website make sure you set 'Enable 32-bit Applications' to 'False' if you want to run in 64-bit mode.
Apr 21, 2014 at 9:35 AM
Thanks. It's already working. We just have to reset the server.