文档转换

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

发表评论

电子邮件地址不会被公开。 必填项已用*标注