Creating a PDF document using PHPDocX

June 6, 2011

This information is outdated, please, refer to the Conversion plugin tutorial documentation for up to date info.

PHPdocx can create PDF documents creating first the docx and then transform it to PDF.

You only need to add the transform at the end of the document like this:

// You need to call also TransformDoc.inc to create a PDF
require_once '../../classes/TransformDoc.inc';
require_once '../../classes/CreateDocx.inc';
 
$docx = new CreateDocx();
 
$text = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, ' .
    'sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut ' .
    'enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut' .
    'aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit ' .
    'in voluptate velit esse cillum dolore eu fugiat nulla pariatur. ' .
    'Excepteur sint occaecat cupidatat non proident, sunt in culpa qui ' .
    'officia deserunt mollit anim id est laborum.';
 
$paramsText = array(
    'b' => 'single',
    'font' => 'Arial'
);
 
$docx->addText($text, $paramsText);
$docx->createDocx('example_mixed');
 
// Creating the PDF
$document = new TransformDoc();
$document->setStrFile('example_mixed.docx');
$document->generatePDF();
If you enjoyed this post you might want to subscribe to our RSS Feed!

Download PHPDocX

download PhpDocX

Choose the version that better suits your needs

Click here

Recent Posts

  • March 4, 2013
    We are happy to announce the release of PHPDocX v3.2. This new version includes some important changes that greatly improve the PHPDocX...
  • February 6, 2013
    Since v3.0 we have included the notion of Word (or WordML) fragments to simplify the process of creating sophisticated Word documents from scratch...
  • January 31, 2013
    We are happy to announce the release of PHPDocX v3.1 This new version includes quite a few new features that you may find interesting: It is now...
  • January 8, 2013
    We have just released PHPDocX v3.0. This new version includes substantial changes that have required that this new version were not fully backwards...
  • December 21, 2012
    Although one can easily introduce real checkboxes in a Word document generated by PHPDocX via the embedHTML method (just include the corresponding...

Recent Posts

  • March 4, 2013
    We are happy to announce the release of PHPDocX v3.2. This new version includes some important changes that greatly improve the PHPDocX...
  • February 6, 2013
    Since v3.0 we have included the notion of Word (or WordML) fragments to simplify the process of creating sophisticated Word documents from scratch...
  • January 31, 2013
    We are happy to announce the release of PHPDocX v3.1 This new version includes quite a few new features that you may find interesting: It is now...
  • January 8, 2013
    We have just released PHPDocX v3.0. This new version includes substantial changes that have required that this new version were not fully backwards...
  • December 21, 2012
    Although one can easily introduce real checkboxes in a Word document generated by PHPDocX via the embedHTML method (just include the corresponding...