简体   繁体   中英

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

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

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..

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM