TCPDF ERROR: Unable to find object (8, 0) at expected location

妖精的绣舞 提交于 2019-12-18 17:05:22

问题


I am getting an error while deleting a page from an scanned pdf using TCPDF & FPDI. Other pdf are working fine.

ERROR: Unable to find object (8, 0) at expected location

回答1:


Your file might be corrupted. Some scanners will produce corrupted PDF's, But nothing to worry there. You can recreate pdf if you are using linux with shell_exec

function pdf_recreate($f)
    {

        rename($f,str_replace('.pdf','_.pdf',$f));  

        $fileArray=array(str_replace('.pdf','_.pdf',$f));
        $outputName=$f;
        $cmd = "gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=$outputName ";

        foreach($fileArray as $file)
        {
          $cmd .= $file." ";
        }
        $result = shell_exec($cmd);
        unlink(str_replace('.pdf','_.pdf',$f));

    }

After recreation has completed,please delete pages . Hope this answer will solve your problems..



来源:https://stackoverflow.com/questions/23990246/tcpdf-error-unable-to-find-object-8-0-at-expected-location

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!