Php tcpdf Imagick生成的pdf格式的Imagick错误,pdf:“;Postscript委托失败`/tmp/magick KKLAvA”;

Php tcpdf Imagick生成的pdf格式的Imagick错误,pdf:“;Postscript委托失败`/tmp/magick KKLAvA”;,php,imagemagick,tcpdf,imagick,Php,Imagemagick,Tcpdf,Imagick,我在服务器中保存了pdf(生成的py TCPDF),我需要预览它们。 我的预览代码适用于某些pdf,但不适用于其他pdf 我的代码: $filehandle = fopen( $urlPdf, "rb"); $img = new Imagick(); $img->readimagefile($filehandle); 代码继续,但问题发生在上面几行之后,因为当我在它们后面放置die()时,我有相同的错误: Postscript delegate failed `/tmp/magick-X

我在服务器中保存了pdf(生成的py TCPDF),我需要预览它们。 我的预览代码适用于某些pdf,但不适用于其他pdf

我的代码:

$filehandle = fopen( $urlPdf, "rb");
$img = new Imagick();
$img->readimagefile($filehandle);
代码继续,但问题发生在上面几行之后,因为当我在它们后面放置die()时,我有相同的错误:

Postscript delegate failed `/tmp/magick-XXtHvIKA': No such file or directory
以下是生成pdf的方法:

$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);

// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('CSI');
$pdf->SetTitle('Pismo');
$pdf->SetSubject('Pismo');
$pdf->SetKeywords('CSI');
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
// set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));

// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);

//set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);

//set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);

//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);

//set some language-dependent strings
$pdf->setLanguageArray($l);

// ---------------------------------------------------------

// add a page
$pdf->AddPage();
$pdf->SetFont('dejavusans', '', 10);

// create some HTML content
if ($image->kind == 0){
$html ='<img src="../public/img/ci2.png"/ style="width: 620px"/><br>';
}
else {
    $html ='<img src="../public/img/kan.png"/ style="width: 620px"/><br>';
}
$pdf->writeHTML($html, true, 0, true, true);
$tbl = <<<EOD
<table cellspacing="0" cellpadding="1" border="0">
<tr>
    <td><img src="../barcodes/$image->id.png" style="width: 200px;position:absolute;left:550px;top:50px;"/></td>
    <td>$line</td>
</tr>
<tr>
<td></td>
<td  style="text-align:right;">Warszawa, $image->date</td>
</tr>
</table>
EOD;

$pdf->writeHTML($tbl, true, false, true, false, '');

$html = '<br>'.stripslashes($image->content);

// output the HTML content
$pdf->writeHTML($html, true, 0, true, true);

// reset pointer to the last page
$pdf->lastPage();

// ---------------------------------------------------------

//Close and output PDF document
$pdfPreviewUrl = Doctrine::getTable('Configurations')->find('pdfPreviewUrl');
$pdf->Output($pdfPreviewUrl->value.$image->id.'.pdf', 'F');
$pdf=新的TCPDF(pdf页面方向,pdf单元,pdf页面格式,真,'UTF-8',假);
//设置文档信息
$pdf->SetCreator(pdf\u CREATOR);
$pdf->SetAuthor('CSI');
$pdf->SetTitle('Pismo');
$pdf->SetSubject('Pismo');
$pdf->SetKeywords('CSI');
$pdf->setPrintHeader(假);
$pdf->setPrintFooter(false);
//设置页眉和页脚字体
$pdf->setHeaderFont(数组(pdf\u FONT\u NAME\u MAIN',pdf\u FONT\u SIZE\u MAIN));
$pdf->setFooterFont(数组(pdf字体名称数据),pdf字体大小数据);
//设置默认的单间距字体
$pdf->SetDefaultMonospacedFont(pdf\u字体\u等距);
//设置边距
$pdf->SetMargins(pdf\u MARGIN\u左、pdf\u MARGIN\u上、pdf\u MARGIN\u右);
$pdf->SetFooterMargin(pdf\U MARGIN\U FOOTER);
//设置自动分页符
$pdf->SetAutoPageBreak(TRUE,pdf\u MARGIN\u BOTTOM);
//设置图像比例因子
$pdf->setImageScale(pdf图像比例);
//设置一些与语言相关的字符串
$pdf->setLanguageArray($l);
// ---------------------------------------------------------
//添加页面
$pdf->AddPage();
$pdf->SetFont('dejavusans','',10);
//创建一些HTML内容
如果($image->kind==0){
$html='
'; } 否则{ $html='
'; } $pdf->writeHTML($html,true,0,true,true);
$tbl=我找到了答案,我会稍后发布…如果你愿意,那太好了-它可能对其他人有用
:)
@rukya:答案在哪里?我以为我找到了,但它仍然无法处理某些文件。。。