使用PHP将docx转换为pdf [英] Convert docx to pdf using PHP
本文介绍了使用PHP将docx转换为pdf的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我目前正在使用PHPWord生成多个.docx文件.我需要找到一种方法来组合这些docx文件并将其另存为1个pdf文件.有办法可以做到吗?
I am currently generating multiple .docx files using PHPWord. I need to find a way to combine these docx files and save them as 1 pdf file. Is there a way that this can be done?
推荐答案
使用PHPDOCX打开生成的docx http://www.phpdocx.com/
Open the generated docx with PHPDOCX http://www.phpdocx.com/
require_once 'phpdocx_pro/classes/TransformDoc.inc';
$docx = new TransformDoc();
$docx->setStrFile('document.docx');
$docx->generateXHTML();
$html = $docx->getStrXHTML();
此外,您可以通过以下方式将docx导出为PDF
Also, you can export the docx to PDF with
$docx->generatePDF();
请注意,这不是免费的库
这篇关于使用PHP将docx转换为pdf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文