1.使用phpword 实现word->pdf

require_once("includes/PHPWord/vendor/autoload.php");

$inputfile = "files/temp/offerte_Hankie-Pankie.docx";

$path = realpath(realpath(__DIR__) . '/includes/dompdf');

echo "realpath: " . $path;

\PhpOffice\PhpWord\Settings::setPdfRendererPath($path);
\PhpOffice\PhpWord\Settings::setPdfRendererName(\PhpOffice\PhpWord\Settings::PDF_RENDERER_DOMPDF);

//Load temp file
$phpWord = \PhpOffice\PhpWord\IOFactory::load($inputfile); 

//Save it
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord , 'PDF');
$xmlWriter->save('result.pdf');

2.Html2word

https://packagist.org/packages/cshaptx4869/html2word

3.word->html

https://segmentfault.com/a/1190000019821351?utm_source=tag-newest

4.PDFdo:

http://www.pdfdo.com/doc-to-pdf.aspx

5.cshaptx4869/html2word

https://packagist.org/packages/cshaptx4869/html2word

Leave A Comment

Recommended Posts

在原文件名前加上前缀并实现文件的批量重命名

要在原文件名前加上前缀并实现文件的批量重命名,你可以根据你所使用的操作系统选择合适的脚本语言来编写脚本。以下是在不同操作系统上实现这一功能的示例: 在 Windows 上使用 PowerShell 在 macOS/Linux 上使用 Shell 脚本 在 Python 中使用 os 模块 注意事项 将上述脚本中的 folder_path 或 $folderPath 替换为你的文件夹路径,将 prefix 替换为你想要添加的前缀,然后运行脚本即可。

blueidea