PHP exec and Batik rasterizer -


i'm using batik convert svg images pdf. when converting them through terminal everying fine , file gets converted. however, want convert dynamically php exec().

this see when convert terminal:

about convert 1 svg file(s)  converting output.svg /opt/lampp/htdocs/tool/generated/output.pdf...  ... success 

when using exec() output limited 'converting output.svg... etc' without ...success part. if server won't wait script finish. also, resulting pdf-file generated empty.

this call in php:

$command = 'cd ~/downloads/batik-1.7 && java -jar batik-rasterizer.jar /opt/lampp/htdocs/tool/generated/output.svg -m "application/pdf"';

$string = exec($command);

echo '{"success": true, "message": "design saved generated/output.svg' . $string . '"}';` 

this see in js console:

design saved generated/output.svgconverting output.svg /opt/lampp/htdocs/tool/generated/output.pdf ...

edit:

using stderr got:

no protocol specified exception in thread "main" java.lang.internalerror: can't connect x11 window server using ':0.0' value of display variable.

edit 2:

after googling found solution:

-djava.awt.headless=true :)

thanks guiding me in finding answer!

learn standard streams stdout , stderr.


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -