无法从PHP imagick生成svg到pdf

We have migrated our app from one server to other server. In first server svg to pdf using PHP imagick is working good but in second server imagick returns empty content after conversion. Please help me to resolve the issue. or please provide me what could be reason for this issue.

The code used for the conversion is given below:

$im = new \Imagick();
$im->readImageBlob($svgContent);
$im->setImageFormat('pdf');
echo 'Test1: '. $im->getImageBlob();
$PDFContent = 'data:application/pdf;base64,' . base64_encode($im);
echo 'Test2: '. $PDFContent;

Both Test1 and Test2 displays empty.

when I try $im->setImageFormat('png'); its working.

Please suggest a solution. Thanks in advance.

dsaff82024
dsaff82024 如果你想大胆的话。您可以使用MPDF或类似的东西,因为它允许使用图像生成PDF(如图中所示)
接近 2 年之前 回复
duanpaxin3531
duanpaxin3531 是的尝试过同样的问题$im->getImageBlob()是空的。
接近 2 年之前 回复
dongzong3053
dongzong3053 你见过stackoverflow.com/questions/3870973/...?我之前没见过image/pdf。
接近 2 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问