Forum


Replies: 4   Views: 5734
Template output pdf - compatibility mode error
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 weatherworks  · 17-12-2013 - 18:44

Hello, we are trying to use PHPDocX to modify templates and then output them as .pdf. The template conversion works perfectly, but we can't seem to get the pdf output to work properly.



We are using PHPDocX 3.6, and paid for the Pro+ license specifically for PDF export functionality.



We have java installed: java version "1.6.0_26"

Java(TM) SE Runtime Environment (build 1.6.0_26-b03)



PHP Version => 5.3.3-7+squeeze18



Here is the code:




error_reporting(-1);
require_once '/var/www/app/phpdocx/classes/CreateDocx.inc';
$docx = new CreateDocx();
$docx->addTemplate('docx_template.docx');
$docx->addTemplateVariable('TIMESTAMP', date('l F, Y | g:i a'));
$docx->addTemplateVariable('CLIENT', 'Client Name Inc.');
$docx->createDocx('outfile');

try{$docx->transformDocx('outfile.docx','outfile.pdf'); } catch(Exception $e){
echo '<p>Error Caught!</p>';
var_dump($e);
}


When I run this, the .docx gets created, but the PDF creation fails. I had to add in the try/catch block to even see any error, because by default no errors are thrown when PDF conversion fails.



Here's the output from the try/catch block:



"Running in compatibility mode. Unsupported method."



I've tried adding the line that enables compatibility mode, all it does is suppress the exception that gets thrown.



Please let me know how I can disable compatibility mode and/or output the pdf. There are lots of forum posts or documentation that say not to use certian functions when doing PDF conversion... but there's no list of what functions are allowed / not allowed.