Forum


Replies: 1   Views: 2334
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

[settings]
; 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
stream="true"

[license]
; PHPDocX license code
code = "[I COPY & PASTED MY PREMIUM LICENCE HERE]"
; subdomain (Basic license), domain (Advanced license) or IP (Premium license)
value = "[MY SERVER WAN IP]"

[transform]
; 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->embedHTML($html);

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


    $docx->createDocx('report.docx');
    $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.