简体   繁体   中英

How can I install ghostscript to work with PHP and imagegick so I can convert pdf files to png images

Ok , I'm really confused .. I installed Imagemagick on XAMPP and it got installed successfully after running the phpinfo() function ... However , I'm not sure how to link ghostscript to PHP because I installed ghostscript on my computer and it's installed as a normal software having a UI like other programs on my desktop and I don't think that's how it's supposed to be ... How should I link it to PHP so imagemagick can detect it , like should I modify the apache file and php.ini .. if so , what should I put in there ? what exact file should should I download to install ghostscript ?

Thanks a bunch !!

you can run both imagemagick and ghostscript as shell commands like this

for Ghostscript :

echo exec('gswin64 -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=d:\pdf\6.pdf -dBATCH '); 

For Imagemagick

echo exec('convert -colorspace sRGB -quality 195% ');

now you will have to search for the right parameters to covert PDFs,optimize and merge them and as @kens said you will use gswin32c.exe as a command shell and gswin32.exe to show the output in the GS tool it self

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM