-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docx to PDF images and styles lost #1684
Comments
I am also experiencing this issue. I started using PHPWord specifically because the documentation indicated I could use it to hydrate Word docs and then convert them to PDF. Please update/comment as to the status of this feature. |
@geoffwasham try use unoconv to convert docx to pdf. |
@gpstiip88 Thanks for the suggestion. I've looked into that one, just not a good fit for my web server. Would love to hear a response from PhpOffice/PhpWord developers. |
also experiencing this issue. absolutely cannot/will not run word on my servers for something like unoconv to work. not awesome that this is the "standard" php word/office lib? |
also experiencing this issue, any updates? |
our solution was to make sure that openoffice was available to the app, write the docx, convert to pdf, do whatever w/ the pdf bytes, cleanup temp docx and pdf (so not using this particular library... which I'm sure is great for other things) |
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);
The text was updated successfully, but these errors were encountered: