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

前端 未结 8 1378
无人及你
无人及你 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: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!

提交回复
热议问题