【问题标题】:FPDI-2.3.6 "Fatal error: Uncaught Error: Class "FPDI" not found" (2021)FPDI-2.3.6“致命错误:未捕获的错误:未找到“FPDI”类”(2021)
【发布时间】:2021-04-26 14:55:28
【问题描述】:

我下载并解压缩FPDF 1.83FPDI 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 ?

【问题讨论】:

    标签: fpdf fpdi


    【解决方案1】:

    您需要使用附加行: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/

    【讨论】:

    • 是的!2021 年我得到Fatal error: Uncaught setasign\Fpdi\PdfParser\CrossReference\CrossReferenceException: This PDF document probably uses a compression technique which is not supported by the free parser shipped with FPDI. sone 解决方案?
    猜你喜欢
    • 2018-04-27
    • 2018-11-08
    • 2018-09-06
    • 2021-07-10
    • 1970-01-01
    • 1970-01-01
    • 2018-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多