首页 > 解决方案 > 将 RTL 文档转换为 PDF

问题描述

有没有办法从 RTL doc/docx 文件中读取并转换为具有相同样式的 PDF 格式?我的代码的结果只是我的文档的一部分,没有图像和页眉和页脚部分。

// Creating the new document...
$phpWord = new \PhpOffice\PhpWord\PhpWord();
$phpWord = \PhpOffice\PhpWord\IOFactory::load('doc2.docx');

$lang    = new \PhpOffice\PhpWord\Style\Language();
$lang->setLangId(1065);
$phpWord->getSettings()->setThemeFontLang($lang);

// Adding Text element with font customized using explicitly created font style
$fontStyle = new \PhpOffice\PhpWord\Style\Font();
$fontStyle->setBold(true);
$fontStyle->setRTL(true);
$fontStyle->setName('B nazanin');
$fontStyle->setSize(13);
$phpWord->addFontStyle('*', $fontStyle);

// I plan to get PDF version after converting HTML
// but it does not read all content from the word file

$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'HTML');
$objWriter->save('doc.html');

标签: phpright-to-leftphpword

解决方案


推荐阅读