php - Codeigniter 3 将 docx 转换为 pdf php
问题描述
我想用 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"');
任何想法 ?谢谢
解决方案
CI 只是一个轻量级框架,不包含任何你想做的事情。您需要安装一些东西才能使这项工作。你可以在这里试试这个库:https ://github.com/phpgearbox/pdf
推荐阅读
- java - 使用 itext 和 java 在 pdf 中打印大量行的问题
- elasticsearch - 将弹性搜索范围查询与过滤器相结合,以排除其他字段上的空值
- java - 在 Tomcat 或 Wildfly 中使用 Java Web 应用程序进行多租户
- php - 尝试在 Laravel 8 中读取 null 的属性“权限”
- javascript - 从日历 ID 中拆分 base64 编码的事件 ID 并获取该事件的开始时间?
- graphql - 从 graphql 模式生成 proto3 文件
- go - String() 字符串到底是做什么的?
- python - 如何正确保存图形?我保存后这个图什么都没有了
- bash - 如何使用 bash 变量作为 awk 输入文件
- php - 使用通配符、范围和术语进行 Elasticsearch 搜索