Answer the question
In order to leave comments, you need to log in
Why doesn't imagick work when converting to pdf?
Imagick 3.4.4
ImageMagick 6.8.9-9 Q16 x86_64 2019-06-15
When converting png to pdf, it gives empty space. The method returns true in this case
. There are no problems with other formats.
Maybe someone came across?
$imageick = new \Imagick();
ob_start();
imagepng($this->im);
$image_data = ob_get_contents();
ob_end_clean();
$imageick->readimageblob($image_data);
$imageick->setFormat('pdf');
$response = new Response($imageick->getImageBlob());
$response->headers->set('Content-Type', 'application/pdf');
$response->headers->set('Content-Disposition', 'inline; filename="'.$code.'"');
return $response;
Answer the question
In order to leave comments, you need to log in
Some formats have dangerous vulnerabilities.
Debian, for example, solved PDF problems by disabling ImageMagick from working with PDFs. Not your case?
Settings in /etc/ImageMagick-6/policy.xml, line with PDF - rights "none" should be changed to rights "read|write"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question