问题描述
在正确加载后,我下载并解压缩 FPDF 1.83
和 FPDI 2.3.6
:
<?PHP
require_once('fpdf183/fpdf.PHP');
require_once('FPDI-2.3.6/src/autoload.PHP');
但是当我尝试使用时:
<?PHP
require_once('fpdf183/fpdf.PHP');
require_once('FPDI-2.3.6/src/autoload.PHP');
$pdf = new FPDI();
Fatal error: Uncaught Error: Class "FPDI" not found ... on line 5
我该如何解决?,如何在不使用 composer
的情况下使用所有函数 FPDI 和 FPDF?
解决方法
您需要使用附加行:use setasign\Fpdi\Fpdi;
<?php
require_once('fpdf183/fpdf.php');
require_once('FPDI-2.3.6/src/autoload.php');
use setasign\Fpdi\Fpdi;
但是,在 2021
中使用 PDFI 打开 PDF 可能会得到:
Alternatively the document you're trying to import has to be resaved without the use of compressed cross-reference streams and objects by an external programm (e.g. by lowering the PDF version to 1.4).
然后 setasign.com 回复:We offer a commercial addon which enables FPDI to handle documents that uses these compression features.
:@
https://www.setasign.com/support/faq/fpdi/error-document-compression-technique-not-supported/