Replies: 1   Views: 2156
Trying to generate pdf using stream with premium licence but it's not working
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by Jola  · 28-03-2019 - 10:42

I'm trying to generate a PDF with the following code and config but I'm having issues.

My config looks like this

; absolute path to the temp dir. If empty the default system tmp directory will be used
temp_path = ""

; if set to true: detects if the contents are UTF-8 encoded and if not encodes them
; if set to false do nothing
encode_to_UTF8 = "false"

; default document language
language = "en-US"

; default paper size
paper_size = "A4"

; right to left languages config
;bidi = "true"
;rtl = "true"

; if true, generate the DOCX as stream instead of saving if to the file system. Only available for Premium licenses

; PHPDocX license code
; subdomain (Basic license), domain (Advanced license) or IP (Premium license)
value = "[MY SERVER WAN IP]"

; transform options. Only available for Advanced and Premium licenses

; libreoffice, native, msword, openoffice
method = "libreoffice"

; libreoffice installation path, absolute path
path = "/opt/libreoffice6.2/program/soffice"


My PHP script looks like this

$html = "<b>Hello World</b>"

$docx = new CreateDocx();

    $docx->modifyPageLayout('A4', array('marginLeft' => '567', 'marginRight' => '567', 'marginTop' => '567', 'marginBottom' => '567'));

    $docx->transformDocument('report.docx', 'report.pdf');


The report.docx file is successfully generated and auto downloaded in my browser but the PDF is failing.


My php error logs outputs the following

PHP Warning:  rename(./report.pdf, report.pdf): No such file or directory in /website-location/includes/phpdocx-premium-9.0/classes/TransformDocAdvLibreOffice.php


What else can I check? Permissions seems fine, no errors saying anythign about permissions. 





Posted by admin  · 28-03-2019 - 10:54


The stream mode works for document generation output (, DOCX as a stream section), but not as source when using the conversion plugin. You need to generate the DOCX file and then transform it to PDF.

If you need help to debug the conversion plugin based on LibreOffice, please check the documentation available on The most common issue is missing rw access to the .config folder of the web user.

Also please note that trying to download more than one file should be avoided ( You should compress the files into a single package such as ZIP.