Running PHP 7.0 on Ubuntu 16.04 and LibreOffice 5.1.6.2
New version of phpdocx 8.2 (Advanced) installed today.
phpdocx config file is modified to use libreoffice like so:
[transform]
method = "libreoffice"
; libreoffice installation path, absolute path
path = "/usr/bin/soffice"
Creating docx files directly and from templates (with modifications) works perfectly.
When I try to convert any docx file to pdf I get errors. From the documentation and forums it looks like the recommended code is like this:
$docx = new TransformDocAdvLibreOffice();
$docx->transformDocument($docxname, $pdfname);
But that generates this error:
PHP Fatal error: Uncaught Exception: The chosen extension is not supported
I have no idea what that means. What extension isn't supported?
If I remove the phpdocx code and instead do it myself, this works perfectly:
exec("/usr/bin/soffice --headless --convert-to pdf:writer_pdf_Export --outdir $pdfname $docxname");
I thought it would be easier/safer/more reliable to use the docx-pdf conversion function in phpdocx, but I can't get it working. I even tried following the instructions in the website section called Debugging LibreOffice. That tells me to run a sample script called sample_1.php but that doesn't provide anything helpful. That script just generates a different error:
PHP Warning: rename(./example_text.pdf,example_text.pdf): No such file or directory in /var/www/staging-wgaccounts/phpdocx/classes/TransformDocAdvLibreOffice.php on line 138
Any advice?