I have a problem, it simply does not work for me to convert a Docx Document to PDF under any method.
Please help me.
I have a problem, it simply does not work for me to convert a Docx Document to PDF under any method.
Please help me.
Hello,
On https://www.phpdocx.com/documentation/conversion-plugin you can read the steps to install, use and debug the conversion plugin. For futher support please post what conversion plugin are you using and if you get some PHP error or notice.
Regards.
The transform method 'native'.
Using dompdf allowed me to convert only normal plain text, otherwise I get the following error:
Fatal error: Uncaught Error: Cannot use object of type Dompdf\FrameDecorator\Inline as array in C:\wamp64\www\phpdocx\Classes\Phpdocx\Transform\TransformDocAdvPDF.php on line 486
How could I use the 'native' method to transform documents while maintaining their content and visual appearance? It seems to me that Libre Office is the recommended one.
I think that the 'libreoffice' conversion plugin necessarily works on 'Dedicated Hosts' due to the configuration issue, is it possible that it works on 'Shared Hosts'?
Thank you very much
Hello,
Please do not use dompdf 2 that was released after phpdocx 13 and it's not fully compatible. Use dompdf 1.2.2 or a previous version; or set the addHeadersAndFooters option as false.
The native conversion plugin supports a set of contents and styles detailed on https://www.phpdocx.com/documentation/conversion-plugin/preparing-the-templates-for-its-conversion (Supported OOXML tags and attributes when using the native method section).
The recommended conversion plugin is the one based on LibreOffice, that requires installing LibreOffice (https://www.phpdocx.com/documentation/conversion-plugin/conversion-plugin-installation-and-set-up), some shared hosting allow installing it, we recommend you contact them, or use a VPS (Amazon and Azure has free tiers for a whole year) or a dedicated server to install it.
Regards.
Well, now with the previous version of dompdf the conversion to PDF does work for me, but it still doesn't keep the original design such as typography, borders, orientation and settings in general.
In my particular case, I have a template .docx
$docx = new Phpdocx\Create\CreateDocxFromTemplate('InvoiceTemplate.docx');
Replace some variables
$docx->replaceVariableByText($variablesFooters, $options);
Then convert to PDF, without losing any style, keeping everything in its original appearance.
$docx->transformDocument('Invoice.docx', 'Invoice.pdf');
What solution could help me specifically?
Is libreoffice the only one that could help me?
Hello,
If the DOCX to be transformed uses contents or styles not supported in the native conversion plugin (supported contents and styles by the native conversion plugin are detailed on https://www.phpdocx.com/documentation/conversion-plugin/preparing-the-templates-for-its-conversion), you need to use the conversion plugin based on LibreOffice.
If you send your DOCX to contact[at]phpdocx.com we'll check it, but from the information you have posted, the solution seems to use the conversion plugin based on LibreOffice.
Regards.