FPDF错误:此文档(testcopy.pdf)可能使用了FPDI随附的免费解析器不支持的压缩技术 [英] FPDF error: This document (testcopy.pdf) probably uses a compression technique which is not supported by the free parser shipped with FPDI

查看:719
本文介绍了FPDF错误:此文档(testcopy.pdf)可能使用了FPDI随附的免费解析器不支持的压缩技术的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行以下代码,并给我这个错误:FPDF error: This document (testcopy.pdf) probably uses a compression technique which is not supported by the free parser shipped with FPDI.我使用了另一个名为test.pdf的pdf,它工作正常,但在testcopy.pdf.中却给我错误

I am running the following code and giving me this error : FPDF error: This document (testcopy.pdf) probably uses a compression technique which is not supported by the free parser shipped with FPDI. I used another pdf named test.pdf and that works fine but it is giving me error in testcopy.pdf.

我认为这是解析器问题.有人知道可以与fpdf一起使用的其他解析器来避免此错误吗?

I think this is parser problem. Anyone know any other parser that can be used with fpdf to avoid this error?

我的代码:

require('fpdf17/fpdf.php'); 
require('fpdf17/fpdi.php'); 
// initiate FPDI 
$pdf = new FPDI(); 
while (ob_get_level())
ob_end_clean();
header("Content-Encoding: None", true);
// set the sourcefile 
$pagecount = $pdf->setSourceFile('testcopy.pdf');

我想将pdf分为两个pdf,并希望将两个pdf都附加在文件附件字段中.如何将pdf保存到服务器. fpdf可以吗?

I want to split pdf in two pdfs and want to attach both pdfs in file attachments field.How to save pdf to server. Can it be possible with fpdf?

推荐答案

是的,确实FPDF库仅支持PDF版本1.4及更高版本.小一点.因此,要解决此问题,请使用 GhostScript .该脚本有助于动态更改PDF版本.

Yes, Exactly the FPDF library supports only PDF version 1.4 & lesser. So to over come from this issue use GhostScript. This script helps to change the PDF versions dynamically.

(1)在此处下载 Ghostscript .

(2)安装Ghostscript并定义环境变量PATH.

(2) Install the Ghostscript and define the environment variable PATH.

(3)然后,使用下面的php代码更改PDF版本.

(3) Then, use the below php code to change the PDF version.

shell_exec( "gswin32 -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dNOPAUSE -dQUIET -dBATCH -sOutputFile=".$new_pdf." ".$old_pdf.""); 

(4)现在我们获得了1.4版的PDF作为输出,然后继续使用FPDF.

(4) Now we get PDF with version 1.4 as output, then continue with FPDF.

享受!

这篇关于FPDF错误:此文档(testcopy.pdf)可能使用了FPDI随附的免费解析器不支持的压缩技术的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆