PHPOffice / PHPWord

A pure PHP library for reading and writing word processing documents
https://phpoffice.github.io/PHPWord/
Other
7.26k stars 2.69k forks source link

Convert docx to pdf - header image is not showing #1567

Open alexia12345 opened 5 years ago

alexia12345 commented 5 years ago

This is:

Expected Behavior

Current Behavior

What is the current behavior? I have docx template with company memorandum in header and footer (combination of image and text). When I convert docx to pdf, I got only text not memorandum image. Is it possible to find fix or to move to another library

Failure Information

Please help provide information about the failure.

How to Reproduce

Please provide a code sample that reproduces the issue.


<?php
require_once 'vendor\autoload.php';
require_once 'vendor\phpoffice\phpword\bootstrap.php';

include_once 'tcpdf/tcpdf.php';

include_once 'tcpdf/examples/lang/hrv.php';

\PhpOffice\PhpWord\Settings::setPdfRendererPath('tcpdf');

$temp = \PhpOffice\PhpWord\IOFactory::load("test.docx");
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($temp , 'PDF');
$xmlWriter->save('test.pdf');

### Context

* PHP version:
* PHPWord version: 0.14
kaystrobach commented 5 years ago

i think this is related to the way the pdf conversion is done:

DOCX -> HTML -> PDF atleast other user wrote, that it's done that way