时间:2022-02-10 16:40:18
打开部分版本报此问题:This PDF document probably uses a compression technique which is not supported by the free parser shipped with FPDI. (See https://www.setasign.com/fpdi-pdf-parser for more details)
后来查看有问题的版本是1.6
没问题的是1.7
代码类库:xthiago/pdf-version-converter - Packagist
GIT地址: GitHub - xthiago/pdf-version-converter: PHP library for converting the version of PDF files (for compatibility purposes).
版本转换:
1
2
3
4
5
6
7
8
9
// 处理pdf版本问题,发现1.6读取失败,统一转成1.7即可讯出来
$localFile
=
'xxxxx/xx/xx.pdf'
;
// 绝对路径pdf文件
$version
= (
new
RegexGuesser())->guess(
$localFile
);
if
(
$version
&&
$version
!=
'1.7'
) {
$command
=
new
GhostscriptConverterCommand();
$filesystem
=
new
Filesystem();
$converter
=
new
GhostscriptConverter(
$command
,
$filesystem
);
$converter
->convert(
$localFile
,
'1.7'
);
}
由于symfony/process 版本兼容问题,没敢直接更新项目的版本。所以直接把git址址中的代码做了变更实现的。
相关文档
php - FPDF error: This document (testcopy.pdf) probably uses a compression technique which is not supported by the free parser shipped with FPDI - Stack Overflow