예제 #1
0
 /**
  * Draw one label section for one item on the PDF document.
  *
  * @param int $column Horizontal index on the current page
  * @param int $row Vertical index on the current page
  * @param Item $item The item to report on
  */
 private function _drawItemLabel(Zend_Pdf_Page $page, $column, $row, $item)
 {
     // Start at the bottom left corner and count over for columns and down
     // for rows.
     $originX = self::MARGIN_LEFT + $column * (self::LABEL_WIDTH + self::HORIZONTAL_SPACING);
     $originY = self::PAGE_HEIGHT - self::MARGIN_TOP - ($row + 1) * (self::LABEL_HEIGHT + self::VERTICAL_SPACING);
     $page->saveGS();
     // Clip on label boundaries to stop text from running over.
     $page->clipRectangle($originX, $originY, $originX + self::LABEL_WIDTH, $originY + self::LABEL_HEIGHT);
     $image = $this->_getQrCode($this->_baseUrl . '/items/show/' . $item->id);
     $page->drawImage($image, $originX, $originY, $originX + self::LABEL_HEIGHT, $originY + self::LABEL_HEIGHT);
     $titles = $item->getElementTexts('Dublin Core', 'Title');
     if (count($titles) > 0) {
         $textOriginX = $originX + self::LABEL_HEIGHT;
         $textOriginY = $originY + 0.8 * self::LABEL_HEIGHT;
         $cleanTitle = strip_tags(htmlspecialchars_decode($titles[0]->text));
         $this->_drawWrappedText($page, $cleanTitle, $textOriginX, $textOriginY, self::LABEL_WIDTH - (self::LABEL_HEIGHT + 4));
     }
     // Remove clipping rectangle
     $page->restoreGS();
     // Release objects after use to keep memory usage down
     release_object($item);
 }