Forum


Replies: 8   Views: 4584
Conversion to pdf os x libreoffice
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 hhwebteam  · 11-08-2016 - 21:02

Evening,

I have been trying to convert a simple docx to pdf using libreoffice. I can create the initial docx using the classes but converting does not appear to be working. Please see code below. Am I missing something.

This is the error I am getting when I convert

Warning: rename(./demo_2ad473d4f6f51e1232f00e7724503e10.pdf,demo_conversion_2ad473d4f6f51e1232f00e7724503e10.pdf): No such file or directory in/Applications/XAMPP/xamppfiles/htdocs/securesign/library/phpdocx/classes/TransformDocAdvLibreOffice.inc on line 131

 

Here is the code I am using

    // We instantiate the CreateDocx class in a new object
    require_once 'library/phpdocx/classes/CreateDocx.inc';

    // Create the initial document
    $docx = new CreateDocx();
    $text = 'This is a test document';
    $docx->addText($text); 

    // Save the document
    $fileType = 'pdf';
    $suffix = md5(microtime());
    $filename = 'demo_' . $suffix;
    $docx->createDocx($filename);
    

    $newFilename = 'demo_conversion_'. $suffix .'.' . $fileType;
    $docx = new TransformDocAdvLibreOffice();
    $docx->transformDocument($filename.'.docx', $newFilename, null, array('method' => 'script'));
    unlink($filename . '.docx');