Skip to content

Docx to PDF images and styles lost #1684

@shedh

Description

@shedh

Hi,

Using the following code the temp file has images and the styles but once converted to pdf images and styles are lost

$phpWord = new \PhpOffice\PhpWord\PhpWord();
$rendererLibraryPath = '../composer/vendor/tecnickcom/tcpdf';
\PhpOffice\PhpWord\Settings::setPdfRendererPath($rendererLibraryPath);
\PhpOffice\PhpWord\Settings::setPdfRendererName('TCPDF');
$templateProcessor = new \PhpOffice\PhpWord\TemplateProcessor('./docs/PurchaseOrderTemplate.docx');
$templateProcessor->setImageValue('logo', './docs/sigtext.png');
$templateProcessor->saveAs('./docs/temp/temp2.docx');

$temp = \PhpOffice\PhpWord\IOFactory::load('./docs/temp/temp2.docx');

$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($temp , 'PDF');
$xmlWriter->save('./docs/results/sampledocument.pdf', TRUE);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions