TCPDF 第一页在导入页面上丢失
TCPDF 1st page Missing on Import Page
当我尝试从现有 pdf 导入 pdf 时,它会删除第一页并从第二页开始。我哪里错了
$pdf = new TcpdfFpdi('P', 'mm', 'A4', true, 'UTF-8', false, true);
$pdf->SetCreator('TCPDF Name');
$pdf->SetAuthor('TCPDF Author');
$pdf->SetTitle('TCPDF title');
$pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('KEYWORDS');
$pagecount = $pdf->setSourceFile('/** file path**/');
for ($i=1; $i<=$pagecount; $i++) {
$tplId = $pdf->importPage($i);
$pdf->useTemplate($tplId,0,0,'210','297');
if ($i < $pagecount)
$pdf->AddPage('P','A4');
}
$pdf->Output(public_path('filename'.pdf'), 'F');
$pdf = new TcpdfFpdi('P', 'mm', 'A4', true, 'UTF-8', false, true);
$pages = $pdf->setSourceFile($this->file->path());
for ($i=1; $i<=$pages; $i++)
{
$pdf->AddPage();
$tplIdx = $pdf->importPage($i);
$pdf->useTemplate($tplIdx, 0, 0, '210','297');
}
$pdf->Output(public_path('filename'.pdf'), 'F');
当我尝试从现有 pdf 导入 pdf 时,它会删除第一页并从第二页开始。我哪里错了
$pdf = new TcpdfFpdi('P', 'mm', 'A4', true, 'UTF-8', false, true);
$pdf->SetCreator('TCPDF Name');
$pdf->SetAuthor('TCPDF Author');
$pdf->SetTitle('TCPDF title');
$pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('KEYWORDS');
$pagecount = $pdf->setSourceFile('/** file path**/');
for ($i=1; $i<=$pagecount; $i++) {
$tplId = $pdf->importPage($i);
$pdf->useTemplate($tplId,0,0,'210','297');
if ($i < $pagecount)
$pdf->AddPage('P','A4');
}
$pdf->Output(public_path('filename'.pdf'), 'F');
$pdf = new TcpdfFpdi('P', 'mm', 'A4', true, 'UTF-8', false, true);
$pages = $pdf->setSourceFile($this->file->path());
for ($i=1; $i<=$pages; $i++)
{
$pdf->AddPage();
$tplIdx = $pdf->importPage($i);
$pdf->useTemplate($tplIdx, 0, 0, '210','297');
}
$pdf->Output(public_path('filename'.pdf'), 'F');