Forum


Replies: 7   Views: 455
Tcpdf_parser error: decodefilterflatedecode: invalid code
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by tarekas  · 15-07-2024 - 08:29

 // require pdf libraries
        $core_path = substr(COREPATH, 0, -12);
        require_once $core_path . '/application/libraries/phpdocx-premium-14-ns/Classes/Phpdocx/Create/CreateDocx.php';
        require_once $core_path . '/application/libraries/phpdocx-premium-14-ns/Classes/Phpdocx/Libs/TCPDF_lib.php';

        // create the signed pdf
        $signed_pdf  = new Phpdocx\Libs\TCPDI();
        $page_count  = $signed_pdf->setSourceFile($pdf_to_sign);
        for ($page_no = 1; $page_no <= $page_count; $page_no++) {
            $signed_pdf->AddPage();
            $signed_pdf->SetAutoPageBreak(false);
            $template_id = $signed_pdf->importPage($page_no);
            $signed_pdf->useTemplate($template_id);
            $objects = array('signature' => $params['signature_picture'], 'stamp' => $params['stamp_picture'], 'name' => $params['user_full_name'], 'designation' => $params['designation'], 'date' => $params['sign_date']);
            foreach ($objects as $object => $object_value) {
                foreach ($params['user_signature_info']->$object->pages as $page_details) {
                    if ($page_no == $page_details->number) {
                        $template_size = $signed_pdf->getTemplateSize($template_id);
                        if(in_array($object, array('signature', 'stamp'))){
                            $signed_pdf->Image(file : $object_value, x : $page_details->coordinates->x, y : $page_details->coordinates->y, w : 60, h : $object == 'signature' ? 30 : 0);
                        }
                        else{
                            if(preg_match('/\p{Arabic}/u', $object_value)){
                                $signed_pdf->SetFont('aealarabiya', '', 14);
                            }
                            $signed_pdf->Text(x : $page_details->coordinates->x, y : $page_details->coordinates->y, txt : $object_value);
                        }
                    }      
                }
            }
        }


When changed to phpdocx 14, when signing the document, the pdf I'm getting is 1 blank page. Why?