Hello,
I want to convert a PDF file with 156 pages (filesize: 46 mb) to JPGs. If I split up the PDF to 5 PDF files with each around 30 pages it works fine with every PDF, but not using the complete PDF. A 30 pages PDF takes aorund 10 seconds to be converted, the script for the complete PDF breaks after 7 seconds without having converted any JPG. I am using the command: exec("convert -colorspace rgb input.pdf output.jpg"); in a PHP file. The script per-process memory limit of php5 is 128 mb and the run time is a maximum of 10 minutes. Is there a limitation concerning filesizes or page amount?
Any help is much appreciated.
PDF conversion fails with 156 pages, but works with 30 pages
Re: PDF conversion fails with 156 pages, but works with 30 pages
Try this command:
- convert -limit memory 1mb -limit map 1mb -colorspace rgb input.pdf output.jpg
Re: PDF conversion fails with 156 pages, but works with 30 pages
Thank you for the quick answer!
Functioned well using the command line, but not using PHP. What can be the reason as there is no error message?
Functioned well using the command line, but not using PHP. What can be the reason as there is no error message?
Re: PDF conversion fails with 156 pages, but works with 30 pages
ImageMagick uses the Ghostscript delegate library to render PDF. Its possible Ghostscript is exceeding the stack / memory limits imposed by PHP. You can increase these limits in your PHP configuration file. Add -debug all to your command line to find out where ImageMagick is exiting prematurely. If its in the delegate processing code, its most likely Ghostscript that is failing.
Re: PDF conversion fails with 156 pages, but works with 30 pages
PHP has a per process limit of 128 mb, so it shouldn't be a memory limit. Is there a possibility to have a debug report using PHP? Used -debug all in the command line, but there the PDF conversion is functioning, so I don't know if the debug report from the command line can help to understand the PHP execution of the same command?