Пример #1
0
 /**
  * Testing to output a PNG image!
  */
 public function testPngOutput()
 {
     $pdfBuilder = new PdfDocument();
     $pdfBuilder->addPage();
     $pdfBuilder->addImage("tests/burn.png");
     $this->assertEquals('', $pdfBuilder->output("tests/test6.pdf", "F"));
     $this->assertEquals(253474, strlen($pdfBuilder));
 }
Пример #2
0
 /**
  * Call the header callback with PdfPage reference,
  * first make data copy - then restore with proper
  * getters and setters if available.
  *
  * @return PdfDocument
  */
 public function outputHeader()
 {
     $this->_dataCopy = $this->_pdfDocument->data;
     $this->_pdfDocument->setInHeaderOrFooter(true);
     if (is_callable($this->_headerCallback)) {
         call_user_func($this->_headerCallback, $this->_pdfDocument);
     }
     $this->_pdfDocument->setInHeaderOrFooter(false);
     foreach ($this->_dataCopy as $key => $value) {
         if ($value !== $this->_pdfDocument->data[$key]) {
             $method = "set" . ucfirst($key);
             $this->_pdfDocument->{$method}($value);
         }
     }
     return $this->_pdfDocument;
 }
Пример #3
0
 /**
  * Line feed; default value is last cell height
  *
  * @param  null $h
  * @return PdfDocument
  */
 public function ln($h = null)
 {
     $page = $this->_pdfDocument->getPage();
     $page->setX($page->getLeftMargin());
     if ($h === null) {
         $page->setY($page->getY() + $this->_lastH);
     } else {
         $page->setY($page->getY() + $h);
     }
     return $this->_pdfDocument;
 }
Пример #4
0
 /**
  * Put a link on the page
  *
  * @param  $x
  * @param  $y
  * @param  $w
  * @param  $h
  * @param  $link
  * @return $this
  */
 public function link($x, $y, $w, $h, $link)
 {
     $scaleFactor = $this->_pdfDocument->getScaleFactor();
     $this->pageLinks[] = array($x * $scaleFactor, $this->_hPt - $y * $scaleFactor, $w * $scaleFactor, $h * $scaleFactor, $link);
     return $this;
 }