Php FPDF:Mergin将2个PDF文件转换为1个PDF,共1页

Php FPDF:Mergin将2个PDF文件转换为1个PDF,共1页,php,pdf,fpdf,fpdi,Php,Pdf,Fpdf,Fpdi,我正在尝试将两个PDF合并为一个PDF,只有一个页面。每个PDF有一页 多亏了这篇文章 我能够使第一个PDF成为模板。现在唯一的问题是,我如何导入另一个并将其设置为内容,而不会得到一个包含多个页面的PDF 我希望有人能帮忙 提前感谢。导入的页面并不意味着它会在文档中生成一个新页面,除非您编写了此行为的代码。以链接页面上的示例为例,您可以通过以下方式导入另一个文档页面: <?php require_once('fpdf.php'); require_once('fpdi.php'); $p

我正在尝试将两个PDF合并为一个PDF,只有一个页面。每个PDF有一页

多亏了这篇文章 我能够使第一个PDF成为模板。现在唯一的问题是,我如何导入另一个并将其设置为内容,而不会得到一个包含多个页面的PDF

我希望有人能帮忙


提前感谢。

导入的页面并不意味着它会在文档中生成一个新页面,除非您编写了此行为的代码。以链接页面上的示例为例,您可以通过以下方式导入另一个文档页面:

<?php
require_once('fpdf.php');
require_once('fpdi.php');

$pdf = new FPDI();

$pdf->setSourceFile("Fantastic-Speaker.pdf");
$tplIdxA = $pdf->importPage(1, '/MediaBox');

$pdf->setSourceFile("Another-Fantastic-Speaker.pdf");
$tplIdxB = $pdf->importPage(1, '/MediaBox');

$pdf->addPage();
// place the imported page of the first document:
$pdf->useTemplate($tplIdxA, 10, 10, 90);
// place the imported page of the snd document:
$pdf->useTemplate($tplIdxB, 100, 10, 90);

$pdf->Output();

效果很好。我唯一改变的是$pdf->useTemplate($tplIdxA,10,10200)$pdf->useTemplate($tplIdxB,10,10200);