Forum


Replies: 3   Views: 4705
Using transformdoc to transform docx to pdf
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 bre-europe  · 16-11-2017 - 16:06

Hi,

we started using the namespaced premium version of phpdocx 7.5. We use it within a CakePHP project, I copied phpdocx's sources to the vendors folder, setup the classmap path in composer.json and ran composer dump-autoload.

When evaluating the test version, I understood that the conversion plugin was not included. Only know that we bought a license I learned that for using TransformDocAdv (or its decessors) you need OpenOffice or LibreOffice running.

So now I'd like to try to convert with the class TransformDoc, because that seems to be able to do the trick without any external software.

Here is a code snippet:

$transform  = new \Phpdocx\Transform\TransformDoc();
$transform->setstrFile('/path/to/source.docx');
$transform->generatePDF('/path/to/dest.pdf');

First I received an error that the class DOMPDF was not found in TransformDoc.inc on line 320. As this class resides in a subfolder of /lib/pdf/, I added that path to the classmap of composer.json and did another composer dump-autoload.

After that I got another error:

 Call to undefined function clear_object() in /[…]/phpdocx/lib/pdf/include/frame_tree.cls.php on line 105

Could someone tell me how to configure composer so that all necessary classes/functions can be found?