【问题标题】:Codeigniter 3 convert docx to pdf phpCodeigniter 3 将 docx 转换为 pdf php
【发布时间】:2019-02-22 04:18:50
【问题描述】:

我想用 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"');

有什么想法吗?谢谢

【问题讨论】:

标签: php codeigniter converters


【解决方案1】:

CI 只是一个轻量级框架,不包含任何你想做的事情。您需要安装一些东西才能使这项工作。你可以在这里试试这个库:https://github.com/phpgearbox/pdf

【讨论】:

  • 谢谢,但我不能使用这个:“DOCX:如果你要使用 DOCX 模板,你需要在你的主机上安装 libre-office-headless 或 unoconv。”需要安装libre office :/.. 感谢您的回复
猜你喜欢
  • 2017-05-12
  • 2021-04-23
  • 2015-05-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多