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 to create a PDF
require_once '../../classes/';
require_once '../../classes/';
$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);
// Creating the PDF
$document = new TransformDoc();
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

  • February 17, 2014
    To use PHPDocX with Symfony‭ ‬2,‭ ‬you just need to register it in the autoloader using the UniversalClassLoader class.‭ ‬Copy the contents of the...
  • January 13, 2014
    We are happy to announce the release of the 3.7 version of PHPDocX. The main goal of this version is to allow for the generation of "right to left...
  • November 28, 2013
    We are happy to announce the release of the 3.6 version of PHPDocX. This new version includes some changes that improve the core functionality of...
  • October 28, 2013
    We would like to start by saying that, generally speaking, PHPDocX is pretty fast but we do not want that you just take our Word for it (pun...
  • October 18, 2013
    To use PHPDocX within the Zend Framework 2, you just need to follow these steps: 1. Extract the content of the PHPDocX package to a folder inside...