Page 1 of 1

Inner exception - cannot read file (PHP use)

Posted: 2016-08-05T02:36:13-07:00
by Crispin
Hi folks,


I've just started using imagemaick (amazingly awesome tool) with PHP and for the most part, it's working really well.


I am getting an exception though when trying to load a particular pdf to convert to png.
The error is that it cannot read the file.

Some basics on it:
  • The PDF is 87MB (1670-odd pages)
  • I have ample server RAM (64GB)
  • Ample space
  • It worked on hundreds of other pdfs I successfully converted to png.
  • The file is 777 and can be opened by FoxIt reader.
Not sure what else might be of use?

I've read about the forums on large pdfs and while there are a lot of instances where larger than this cannot be loaded due to resources, I don't think this is my case.


Is there anything else I can look for in terms of compatibility etc of the pdf?



Many thanks
Crispin

Re: Inner exception - cannot read file (PHP use)

Posted: 2016-08-05T05:10:17-07:00
by snibgo
What version of IM are you using? What is the Q-number? What version of Ghostscript? What error message do you get? How long after it starts does it fail?

How many pixels per page? IM does the job by rasterizing the PDF, storing all the pages in memory before writing each page to a PNG. But it does this via Ghostscript, which might be failing here.

Re: Inner exception - cannot read file (PHP use)

Posted: 2016-08-05T05:13:16-07:00
by Crispin
All good questions for a noob :)
I will gather that info this evening and post it up for you. Thanks.

Re: Inner exception - cannot read file (PHP use)

Posted: 2016-08-05T09:25:59-07:00
by Crispin
My version info

PHP: PHP Version 5.6.24

ImageMagick
Version: ImageMagick 6.7.8-9 2016-06-16 Q16 http://www.imagemagick.org

GPL Ghostscript 9.07 (2013-02-14)


ok, so something odd -

I set up a test page, simple script, just did the following

Code: Select all

		$imgPages = new imagick("/var/www/***/blabla.pdf");
		echo "|" . $imgPages->getNumberImages() . "|";
and... it works. I've no idea why it fails the "normal" way. This is the exact code...

Anyway, I'll debug some more and see.

It's 1468 pages big and takes ages to load and give me the page count (not that I am in a hurry)

Thanks for your time - will pop back if I find the problem...

Re: Inner exception - cannot read file (PHP use)

Posted: 2016-08-05T11:31:06-07:00
by Bonzo
You are using Imagemagick through the php Imagick API which is not exactly the same.

Re: Inner exception - cannot read file (PHP use)

Posted: 2016-08-05T11:39:45-07:00
by fmw42
What is the error message? Note that IM 6.7.8.9 is very old (over 150 versions old) and your ghostscript at 9.07 is old. IM is at 6.9.5.4 and Ghostscript is higher than my 9.16.

Re: Inner exception - cannot read file (PHP use)

Posted: 2016-08-05T14:55:35-07:00
by Crispin
thanks for the hints.

I have to put this aside for a few weeks so when I'm back I'll pick it up and get it all updated.
I simply installed it thought pkg on CentOS7 (I think...) I will try update it when I am back on the project.


thanks again
C