这看起来是最简单的事情,但我无法让它发挥作用.
我需要将文本添加到多页pdf的第一页(可以是任意数量的页面)
在两页pdf上使用此代码(没有for循环,只使用$ pdf-> importPage(2))我最终得到两个页面,但第二页是第一页的重复.文本只写在第一页上,这是好的,但我需要输出pdf中包含的所有页面.这是我的代码
// Original file with multiple pages
$fullPathToFile = 'full/path/to/file.pdf';
class PDF extends FPDI {
var $_tplIdx;
function Header() {
global $fullPathToFile;
if (is_null($this->_tplIdx)) {
$this->setSourceFile($fullPathToFile);
$this->_tplIdx = $this->importPage(1);
}
$this->useTemplate($this->_tplIdx);
}
function Footer() {}
}
// initiate PDF
$pdf = new PDF();
$pdf->setFontSubsetting(true);
// add a page
$pdf->AddPage();
// The new content
$pdf->SetFont("helvetica", "B", 14);
$pdf->Text(10,10,'Some text here');
// How to get the number of pages of original pdf???
// $numPages = $pdf->getNumPages(???);
// Carry …Run Code Online (Sandbox Code Playgroud) 我想知道如何在一次打印点击中打印多个PDF文件.
我可以轻松打印单个PDF文件但我不知道如何在有更多文件时进行打印.
提前致谢.