-
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
Is it possible to use this lib to convert docx files to pdf? #2411
Comments
Using domPDF // Locate DomPDF vendor
$dompdfPath = $vendorDirPath . '/dompdf/dompdf';
// Set renderer settings
\PhpOffice\PhpWord\Settings::setPdfRenderer(\PhpOffice\PhpWord\Settings::PDF_RENDERER_DOMPDF, $domPdfPath);
// Load docx
$phpWord = \PhpOffice\PhpWord\IOFactory::load($docxPath);
// Write into PDF
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'PDF'); For better result you can use unoserve that use libreoffice libs directly |
in the end I ended up installing libreoffice on the production debian server and using headless to convert docx to PDF, having to install libreoffice on the server for that is pretty bad but at the moment I haven't seen another library that does this in order to preserve the layout, do this without needing libre office just with pure php would be wonderful |
Is it possible to use this lib to convert docx files to pdf?
The text was updated successfully, but these errors were encountered: