Forum


Replies: 5   Views: 3614
Noob needs simple tut
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 edkocol  · 23-03-2015 - 15:39

I have a php application that can retrieve a .doc/.docx from our database which returns the stored base64 content. How do I use the PHPDOCX (currently on the demo) to convert that to .pdf?

Posted by admin  · 23-03-2015 - 16:21

Hello, You need to use the conversion plugin that is not included in the trial version. This plugin allows to transform a DOCX to PDF. Regards.

Posted by edkocol  · 23-03-2015 - 20:01

Just to be clear, how would I load the base64 string contents into the conversion plugin? Like this? include_once ('phpdocx/classes/CreateDocx.inc'); $docx = new CreateDocx(); $docx->enableCompatibilityMode(); $docxfilename = "../upload/".$uploaddir.'/'.$filename; $pdffilename = "../upload/".$uploaddir.'/'.$filename.'.pdf'; $text=base64_decode($contents); $paramsText = array('b' => 'single'); $docx->addText($text, $parmsText); $docx->createDocx($docxfilename); $docx->transformDocument($docxfilename, $pdffilename); Also, does the entire conversion take place entirely on the server?

Posted by admin  · 24-03-2015 - 07:47

Hello, That is. First you need to decode the content, then add it to the document and finally transform to PDF. Regards.

Posted by edkocol  · 24-03-2015 - 21:00

I am sssuming $docx->createDocx($docxfilename); creates the file on the server not the client computer Are both files in the following statement located on the server? $docx->transformDocument($docxfilename, $pdffilename); I ask because we do not want the "docx" file to be on the client computer/PC and we have the process in place to download the PDF to the client computer.

Posted by admin  · 25-03-2015 - 07:20

Hello, Yes, both files are created in the FS of the server. And you can download them at any time. Regards.