To display the text centered, the second parameter is wrong. It should be $footer->addPreserveText(htmlspecialchars('Page {PAGE} of {NUMPAGES}.'), **null,** array('align' => 'center'));