我正在尝试使用TCPDF和FPDI的组合生成pdf.这是我的代码.
require_once('../tcpdf/tcpdf.php');
require_once('../FPDI/fpdi.php');
$fileName = '../sample.pdf';
class PDF extends FPDI {
/**
* "Remembers" the template id of the imported page
*/
var $_tplIdx;
var $numPages = 0;
/**
* Draw an imported PDF logo on every page
*/
function Header() {
global $fileName;
if (is_null($this->_tplIdx)) {
$this->setSourceFile($fileName);
$this->_tplIdx = $this->importPage(1);
$this->numPages = $this->setSourceFile($fileName);
}
$size = $this->useTemplate($this->_tplIdx);
}
function Footer() {
// emtpy method body
}
}
// initiate PDF
$pdf = new PDF($fileName);
$pdf->setFontSubsetting(true);
// add a page
$pdf->AddPage();
// save file
$pdf->Output('output.pdf', 'F');
这里,最后一行$pdf->输出(‘output.pdf’,’F’);用于保存文件.但它没有用.当我只有$pdf-> Output()时,它在浏览器中显示pdf.
我试过$pdf->输出(‘output.pdf’,’D’);下载,它工作正常.似乎$pdf->输出(‘output.pdf’,’F’);只是没有工作,它显示错误TCPDF错误:无法创建输出文件:output.pdf.
注意:没有文件权限问题
任何人都可以指出这个问题.
本文发布于:2024-02-04 07:32:37,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/170702102653573.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |