Forum


Replies: 2   Views: 3767
Docx transform 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 helpdesk  · 01-05-2013 - 21:47

We are having problems transforming a generated docx file to PDF.



We have set up the OOService.sh script as recommended.  We have run the Transform.php file in CLI, output as follows.



May 1, 2013 3:25:07 PM

com.artofsolving.jodconverter.openoffice.connection.AbstractOpenOfficeConnection connect INFO: connected May 1, 2013 3:25:16 PM




com.artofsolving.jodconverter.openoffice.connection.AbstractOpenOfficeConnection disposing INFO: disconnected


We have tried 2 methods of coverting the docx, with the listed results:




// transform file into pdf
// finalfile = /FULL_ABSOLUTE_PATH/filename.docx

/* corrupted file error on open pdf */
$pdf = new TransformDoc();
$pdf->setStrFile($finalfile);
$pdf->generatePDF();

/* no error but no file */
$docx->enableCompatibilityMode();
$docx->transformDocx($finalfile,substr($finalfile,-5).'.pdf');


Also, in the corrupted file created via generatePDF, if the file is opened as a text document you see the following on the first few lines:




<br />
<b>Warning</b>:  strstr() [<a href='function.strstr'>function.strstr</a>]: Empty delimiter in <b>/usr/include/php/phpdocx/classes/GenerateDocx.inc</b> on line <b>40</b><br />
<br />
<b>Warning</b>:  strstr() [<a href='function.strstr'>function.strstr</a>]: Empty delimiter in <b>/usr/include/php/phpdocx/classes/GenerateDocx.inc</b> on line <b>40</b><br />
%PDF-1.3


Removing the initial lines of warning does not fix the file corruption.