Forum


Replies: 1   Views: 140
Domdocument class not found

Posted by ealnour  · 26-08-2024 - 12:03

Hello Team,

I'm facing error like below

Uncaught Error: Class "DOMDocument" not found in /var/www/html/ltc/wp-content/themes/LTC-Child/PHPDoc_premium/classes/CreateDocx.php:798
Stack trace:
#0 /var/www/html/ltc/wp-content/themes/LTC-Child/functions.php(2164): CreateDocx->__construct()

This is my code 

function  add_docx_footer_tracking($input_pdf_path, $output_pdf_path){

    $upload_dir  = wp_upload_dir();

    $directory = $upload_dir['basedir'].'/foldersharefiles/0000/0000/0000/0000';

    $directory_outpput = $upload_dir['basedir'].'/tracking_doc';

 

    $docx = new CreateDocx($directory.'/6276.docx');

    $docx = new CreateDocxFromTemplate($directory.'/6276.docx');

 

    // Define the footer content

    $footerContent = new WordFragment($docx, 'defaultFooter');

    $current_user = wp_get_current_user();

    $email_addresss = $current_user->user_email;

    $date_time = date('d-m-Y H:i:s');

    $paragraphOptions = array(

        'bold' => true,

        'font' => 'Arial',

        'textAlign' => 'center',

        'color' => '#b73b32'

    );

    $footerContent->addText($email_addresss.' '.$date_time, $paragraphOptions);

 

    // Add the footer to the document

    $docx->addFooter(array('default' => $footerContent));

    // Save the modified document

   

    $docx->CreateDocx($directory_outpput.'/6276test.docx');

 

    // Output success message

    echo "Footer added successfully to the existing document.";

    die();

}

Note : It's working on my local environment but not in working in Live