PDF不使用mPDF合并大于PDF-1.5版本

时间:2022-10-20 20:46:15

I try to merge pdf using mPDF plugin with latest version but the error coming PDF merging working when using pdf version 1.3 but not done for 1.5

我尝试将使用mPDF插件的pdf与最新版本合并,但在使用pdf版本1.3但未完成1.5时,PDF合并工作时出现错误

I have try below code

我试过下面的代码

<?php
$mihir='<html>
<body>
  Generate PDFs with merge
</body>
</html>';    

require_once("MPDF/mpdf.php");
$mpdf=new mPDF(); 
$mpdf->SetDisplayMode('fullpage');
$mpdf->list_indent_first_level = 0; 
$mpdf->WriteHTML($mihir);

$mpdf->AddPage();
$mpdf->SetImportUse();
$pagecount = $mpdf->SetSourceFile("order_form_instructions_energy_supply.pdf");
$tplId = $mpdf->ImportPage($pagecount);
$mpdf->UseTemplate($tplId);
$mpdf->Output('test.pdf','D');
?>

I'm getting this error

我收到了这个错误

mPDF error: Unable to find xref table - Maybe a Problem with auto_detect_line_endings

mPDF错误:无法找到外部参照表 - 可能是auto_detect_line_endings的问题

thanks in advance

提前致谢

2 个解决方案

#1


2  

Rax: Have you tried with different pdf documents? This may help you: http://www.vankouteren.eu/blog/2009/07/fpdf-error-unable-to-find-xref-table/

Rax:你尝试过不同的pdf文件吗?这可能对您有所帮助:http://www.vankouteren.eu/blog/2009/07/fpdf-error-unable-to-find-xref-table/

One of the PDFs which should be merged was originally created from Word by a PDF creator which placed its signature in the properties of the PDF document. After removing this signature (in this case opening the PDF with Adobe Illustrator and saving it again) the problem was solved.

其中一个应合并的PDF最初是由PDF创建者从Word创建的,该创建者将其签名放在PDF文档的属性中。删除此签名后(在这种情况下,使用Adobe Illustrator打开PDF并再次保存),问题就解决了。

#2


0  

I have done to merge pdf greater then version 1.5 using mpdf and shell script.

$mihir='<html>
<body>
  Generate PDFs with merge
</body>
</html>';    

require_once("MPDF/mpdf.php");
$mpdf=new mPDF(); 
$mpdf->SetDisplayMode('fullpage');
$mpdf->list_indent_first_level = 0; 
$mpdf->WriteHTML($mihir);


$tmp_dir1='upload_files/tmp_ao_pdf';
if(!is_dir($tmp_dir1))
{
  mkdir($tmp_dir1,0777);
}            
$file_path=$tmp_dir1."/"."generate_html.pdf";
$mpdf->Output($file_path,'F');

$attachh_pdf_name="upload_files/order_form_instructions_energy_supply.pdf";
$fileArray= array($file_path,$attachh_pdf_name);
$datadir = "upload_files/";
$outputName = $datadir."orderform_".$order_id.".pdf";
$cmd = "gs -q -dNOPAUSE -dBATCH -dAutoRotatePages=1 -sPAPERSIZE=legal -sDEVICE=pdfwrite -sOutputFile=$outputName ";
foreach($fileArray as $file) {
    $cmd .= $file." ";
}
$result = shell_exec($cmd);

#1


2  

Rax: Have you tried with different pdf documents? This may help you: http://www.vankouteren.eu/blog/2009/07/fpdf-error-unable-to-find-xref-table/

Rax:你尝试过不同的pdf文件吗?这可能对您有所帮助:http://www.vankouteren.eu/blog/2009/07/fpdf-error-unable-to-find-xref-table/

One of the PDFs which should be merged was originally created from Word by a PDF creator which placed its signature in the properties of the PDF document. After removing this signature (in this case opening the PDF with Adobe Illustrator and saving it again) the problem was solved.

其中一个应合并的PDF最初是由PDF创建者从Word创建的,该创建者将其签名放在PDF文档的属性中。删除此签名后(在这种情况下,使用Adobe Illustrator打开PDF并再次保存),问题就解决了。

#2


0  

I have done to merge pdf greater then version 1.5 using mpdf and shell script.

$mihir='<html>
<body>
  Generate PDFs with merge
</body>
</html>';    

require_once("MPDF/mpdf.php");
$mpdf=new mPDF(); 
$mpdf->SetDisplayMode('fullpage');
$mpdf->list_indent_first_level = 0; 
$mpdf->WriteHTML($mihir);


$tmp_dir1='upload_files/tmp_ao_pdf';
if(!is_dir($tmp_dir1))
{
  mkdir($tmp_dir1,0777);
}            
$file_path=$tmp_dir1."/"."generate_html.pdf";
$mpdf->Output($file_path,'F');

$attachh_pdf_name="upload_files/order_form_instructions_energy_supply.pdf";
$fileArray= array($file_path,$attachh_pdf_name);
$datadir = "upload_files/";
$outputName = $datadir."orderform_".$order_id.".pdf";
$cmd = "gs -q -dNOPAUSE -dBATCH -dAutoRotatePages=1 -sPAPERSIZE=legal -sDEVICE=pdfwrite -sOutputFile=$outputName ";
foreach($fileArray as $file) {
    $cmd .= $file." ";
}
$result = shell_exec($cmd);