2

I am using ImageMagick for PDF to Image Conversion in my C# code. But After testing on some files, I've noticed that ImageMagick creates a lot of temp files in %Temp% folder which takes all disk space. I'm using Magick.Net 7.0.0.0104. Is there a fix to this problem?

Ahmed
  • 2,176
  • 5
  • 26
  • 40
Sheraz
  • 567
  • 4
  • 22
  • 1
    Either allow ImageMagick to use more RAM, so it uses less disk, or use environment variables or commandline options to make it use a disk directory of your choice and purge/remove files from there after each run. See here... http://stackoverflow.com/a/31388904/2836621 – Mark Setchell Aug 19 '16 at 07:44

1 Answers1

0

There is no option to disable cache/temp files when you read PDF files. It will call the executable of Ghostscript and that will create a temporary file that contains the image data. But there is a way to make sure that the executable is not called and the library will be used instead. This will prevent the use of a temporary file. You will need to install the x86 version if your application pool is 32-bit and the x64 version of your application is 64-bit. But because the Ghostscript library is not thread safe only one call is allowed per application pool. Another call at the same moment will still use the command line. This means you can only convert one PDF at a time if you don't want Magick.NET to use the temporary directory.

dlemstra
  • 7,813
  • 2
  • 27
  • 43