function test_generateUniqueId()
 {
     $id = PageNumberItem::generateUniqueId();
     $this->assertTrue(preg_match('/^__page_no_(\\d+?)__$/', $id, $matches) === 1);
     $id = PageNumberItem::generateUniqueId();
     $this->assertEquals('__page_no_' . ($matches[1] + 1) . '__', $id);
 }
Example #2
0
 /**
  * @param Item\PageNumberItem $item
  */
 public function renderPageNumberItem(Item\PageNumberItem $item)
 {
     $format = $item->getFormat();
     $bounds = $item->getBounds();
     $this->doc->text->drawText($item->getFormattedPageNumber(), $bounds['x'], $bounds['y'], $bounds['width'], $bounds['height'], $this->buildTextStyles($item->exportStyles()));
 }
 /**
  * @access private
  *
  * @param array $item_format
  */
 public static function setPageNumberUniqueId(array &$item_format)
 {
     if (empty($item_format['id'])) {
         $item_format['id'] = Item\PageNumberItem::generateUniqueId();
     }
 }