Page 2 of 2

Re: Convert PDF to JPG using ASP classic

Posted: 2011-06-01T01:46:43-07:00
by nitech
I don't think I ever found a solution to this.

Re: Convert PDF to JPG using ASP classic

Posted: 2011-06-01T05:22:58-07:00
by fredoche
thanks for your answer nitech

The strange thing is for instance, you can convert jpg to pdf with asp and COM object, but not the opposite way

Re: Convert PDF to JPG using ASP classic

Posted: 2011-06-01T07:27:37-07:00
by fredoche
Hi

it seems that I have the solution :
this is the topic that led me to the right direction : https://www.imagemagick.org/discourse-s ... =1&t=16169


on the TEMP directory (c:\windows\temp for my server)
You need at least to give "change" rights to IUSR user (or any authenticated windows user that will use your ASP application)
You need to give "read/write" rights IIS_IUSRS group

With those rights, it seems to work well. Just one thing to notice, IM creates files in temp directory (named like magick-n9Y1wqmn for example), and some of them will remain after IM execution through ASP pages. Files that remain are empty, I don't think it's a big matter, but you may have to clean it manually after a while. Even with full controls on both previous user and group, files are not deleted.

So this seems to be enough to make it work with PDF, Ghostscript & ASP

As my server is a win 2k8 R2 64 bits, I installed GS 64 bits version. I had to modify delegates.xml, replace all "@PSDelegate@" values with "gswin64c" value. By default, it looks for the "gswin32c" exe file, and I didn't find a place to change this, other than delegates.xml. But this has nothing to do with ASP problem. If someone knows where to change this "@PSDelegate@" value, please tell me

And what I've done is set a new environment variable on the system "MAGICK_TEMPORARY_PATH" as documented here : http://www.imagemagick.org/script/resources.php.
With that I use a dedicated path for IM needs, and I can set rights for ASP accordingly.

I have to validate this in the whole application, but I feel better now that I see working like before.

Thanks to kdc415, nitech,and everybody else for following the problem. Being able to get in touch with a small community when you're stuck is always good. :)

And many thanks for your wonderful work, Imagemagick team

Re: Convert PDF to JPG using ASP classic

Posted: 2011-07-08T22:12:22-07:00
by kevtk1984
I am having a similar problem, only it is with a PHP script. If anyone has come to a successful conclusion, please contact me personally.

I am up against a deadline and will be willing to pay a $200 bounty for anyone to resolve this successfully! It has to be a permissions thing somewhere...

Kevin

Re: Convert PDF to JPG using ASP classic

Posted: 2011-08-10T04:42:18-07:00
by nitech
Hi,

I bumped over the solution, which was to run the convert.exe directly instead of using the com-object. The exe is obviously running under some other user restrictions than the com object. Here is the vbs-code:

Code: Select all

' Try doing same operation using command line convert.exe
Dim wshell
Set wshell = CreateObject("Wscript.Shell")
		
' Use convert.exe instead of ImageMagickObject.MagickImage.1 because of security problems executing GhostScript from within IIS
wshell.Exec("C:\Program Files\ImageMagick-6.5.6-Q16\convert.exe """ & strSourceFile & """" & _
            " -size 229x160" & _
            " -resize 229x160" & _
            " -colorspace RGB" & _
            " -quality 80" & _
            " """ & strDestFile & """")