Codeigniter 3将docx转换为pdf php

时间:2018-09-18 07:38:57

标签: php codeigniter converters

我想使用codeingiter将docx转换为pdf。我的第一个解决方案是安装Libre office,但现在我无法在服务器上安装它(因为老板不想要...)

第一个解决方案:

$PHPWord = $this->word; // New Word Document
    $document = $PHPWord->loadTemplate('assets/word/' . $select_info->attestation);
    $document->setValue('ID', $insert);
    $document->setValue('lastname', strtoupper($select_info->nom));
    $document->setValue('name', $select_info->prenom);
    $document->setValue('date', date('d/m/Y'));
    $document->save('./'.$select_info->attestation);

    //Avec libraoffice convertir word to pdf
    shell_exec('start /wait soffice --headless --convert-to pdf --outdir "." "./test.docx"');

有什么主意吗?谢谢

1 个答案:

答案 0 :(得分:0)

CI is just a lightweight framework and doesn't include anything to do what you want. You will need to install something to make this work. You could try the library here: https://github.com/phpgearbox/pdf