FPDF error: This document (testcopy.pdf) probably uses a compression technique which is not supported by the free parser shipped with FPDI

前端 未结 8 1353
无人及你
无人及你 2020-12-13 10:26

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

相关标签:
8条回答
  • 2020-12-13 10:51

    Here is my answer from another topic:

    "It can be overcome by re-saving the template and change compression type. In Adobe Acrobat Pro go to File->Save As->Optimised PDF-> Popup left list - Clean Up, Object Compression Options -> Change to "Compress document structure" -> OK to save"

    Ref. Editing password protected pdfs with fpdi

    0 讨论(0)
  • 2020-12-13 10:55

    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) Download the Ghostscript here.

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

    (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) Now we get PDF with version 1.4 as output, then continue with FPDF.

    Enjoy!

    0 讨论(0)
提交回复
热议问题