【问题标题】:Codeigniter PHPworkCodeigniter PHPwork
【发布时间】:2018-12-14 01:12:32
【问题描述】:

我有一个问题^^!我使用 phpword、tcpdf 和 codeigniter。我想(首先,这第一部分很好)写在word文档中(用于更改信息或其他)。在此之后,我想将 word 转换为 PDF 并最终下载它。当我在文档(phpword)中搜索时,我说 tcpdf 是可能的。但是当尝试我有这个错误:(图片)。 (对不起,我的英语不好..)。谢谢code

error

【问题讨论】:

  • 请将您的代码直接添加到问题中(复制粘贴),同样的错误。图片(尤其是链接)会随着时间的推移而中断,根本没有帮助
  • 如果你搜索那个特定的错误,谷歌上有很多资源
  • 好的,感谢和抱歉过去的代码^^

标签: php codeigniter tcpdf phpword


【解决方案1】:

这个问题的解决方法:

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

        //Avec libraoffice convertir word to pdf

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

安装libreoffice并使用它进行转换,谢谢大家的回复

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-12-21
    • 2012-04-03
    • 2011-05-30
    • 2011-04-23
    • 2014-07-29
    • 2012-09-28
    • 2018-08-30
    相关资源
    最近更新 更多