Browser issue with PDF

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
dawson
Posts: 5
Joined: 2012-01-31T07:55:19-07:00
Authentication code: 8675308

Browser issue with PDF

Post by dawson »

What I'm trying to do here is to put a image (kind of a stamp) into a PDF.

When I call a PHP that call a shell script from a browser it doesn't work it shows this message:

Code: Select all

convert: Missing Null Image List Separator layers Composite @ mogrify.c/MogrifyImageList/7899.
The command that I run is this:

Code: Select all

convert -density 300 -quality 100 -compress fax -monochrome -alpha off "/opt/lampp/htdocs/pdf/upload/$2" null: /opt/lampp/htdocs/pdf/carimboover.png -gravity $3 -compose multiply -layers composite "/opt/lampp/htdocs/pdf/autenticados/$2" 2>&1
the php code:

Code: Select all

exec("sh /opt/lampp/htdocs/pdf/assinador.sh 2012127444857741000-001 'Flash2.pdf' SouthWest");
If I run this from console It works great, even if I call the PHP file from the console it also works fine, other thing is that if instead of a PDF I send an JPG or PNG file it works fine too.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Browser issue with PDF

Post by fmw42 »

It could be your PHP config? There was a recent problem reported that was probably due to PHP configured in safe mode or something like that. Search the archives an see if you can find that or check your PHP configuration.

Also

try a simple IM command rather than your script.

In PHP all your convert and other such commands within your script probably need to have the full path to them specified.
dawson
Posts: 5
Joined: 2012-01-31T07:55:19-07:00
Authentication code: 8675308

Re: Browser issue with PDF

Post by dawson »

Safe mode is off on php.ini

The problem is just converting something from PDF to other thing, if I convert something to PDF it works fine, example:

Works:

Code: Select all

<?php
	echo exec("convert /opt/lampp/htdocs/pdf/upload/example.png /opt/lampp/htdocs/pdf/upload/example.pdf 2>&1");
?>
If I do like this:

Code: Select all

<?php
	echo exec("convert /opt/lampp/htdocs/pdf/upload/example.pdf /opt/lampp/htdocs/pdf/upload/example.png 2>&1");
?>
I get the following error:

Code: Select all

convert: missing an image filename `/opt/lampp/htdocs/pdf/upload/example.png' @ convert.c/ConvertImageCommand/2838.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Browser issue with PDF

Post by fmw42 »

Converting from pdf requires ghostscript (as I understand it). So you need to install the ghostscript delegate and then recompile IM. But PHP also needs to know about ghostscript and that may or may not work automatically.
Post Reply