[英]Is there a way to hide header and footer in a pdf file created with FPDF in PHP?
[英]pdf file output created with FPDF are empty (PHP)
您好,提前感谢您的帮助。
我正在尝试在 PHP 上使用 FPDF 编写 PDF。
我实际上正在研究 WordPress。
如果我在我的第一个网站上使用此代码,它运行良好:
if (isset($_GET["obtenir-mon-analyse"])){
$pdfFile = getcwd() . '/wp-content/themes/childtheme/ressources/PDF_analyse_template.pdf';
require_once('library/fpdf/fpdf.php');
require_once('library/fdpi/src/autoload.php');
// initiate FPDI
$pdf = new setasign\Fpdi\Fpdi();
// add a page
$pdf->AddPage("L");
// set the source file
$pdf->setSourceFile($pdfFile);
// import page 1
$tplIdx = $pdf->importPage(1);
// use the imported page and place it at point 10,10 with a width of 100 mm
$pdf->useTemplate($tplIdx, 0,0 );
$pdf->Output('I');
}
但是,在另一个网站上使用相同的代码,由 output function 生成的 PDF 为空(0kb)。
此外,该模板正在工作,因为 FDPF 可以很好地检测可用页码。
PS:
我真的不知道问题出在哪里。
非常感谢。
我认为没有人会看到这个答案,但是:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.