Я использую PDFWord для создания динамического документа. Файлы .docx и .html генерируются отлично, но я не могу создать .pdf (я пробовал и DomPDF, и TCPDF).
Вот пример моего кода:
// Saving the document as OOXML file...
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');
$objWriter->save('documents/RFP_for_'.str_replace(' ', '_', $info[org_name]).'.docx');
// Saving the document as HTML file...
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'HTML');
$objWriter->save('documents/RFP_for_'.$info[org_name].'.html');
// Saving the document as PDF file...
\PhpOffice\PhpWord\Settings::setPdfRendererPath('vendor/tcpdf');
\PhpOffice\PhpWord\Settings::setPdfRendererName('TCPDF');
$template->saveAs('documents/'.$file_name.'.docx');
$temp = \PhpOffice\PhpWord\IOFactory::load('documents/'.$file_name.'.docx');
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($temp , 'PDF');
$xmlWriter->save('documents/'.$file_name.'.pdf', TRUE);
Подробнее здесь: https://stackoverflow.com/questions/354 ... ng-phpword
Не удалось создать PDF-файл из .docx с помощью PHPWord. ⇐ Php
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
PHPWord — класс «PhpOffice\PhpWord\Media» не найден после установки zip-файлов из GitHub
Anonymous » » в форуме Php - 0 Ответы
- 30 Просмотры
-
Последнее сообщение Anonymous
-