【发布时间】:2018-01-29 04:37:50
【问题描述】:
我想将 ms-word 文件(.doc,.docx) 转换为 .pdf 或 .html 文件,而不会丢失 word 文件的样式和图像。
$filenamearray = explode('.',$filename );
$doc = new Docx_reader();
$doc->setFile($item);
if(!$doc->get_errors()) {
$html = $doc->to_html();
$plain_text = $doc->to_plain_text();
$myfile = file_put_contents("$filenamearray[0].html", $html.PHP_EOL , FILE_APPEND | LOCK_EX);
} else {
echo implode(', ',$doc->get_errors());
}
我尝试了上述解决方案,但只给了我没有样式和图像的 html。我想要 .html 或 .pdf 与 .doc .docx 文件相同。
【问题讨论】:
标签: php pdf converter docx doc