Esempio n. 1
0
 /**
  * Create a new page
  *
  * Create a new page in the PDF document with the given width and height.
  *
  * @param float $width
  * @param float $height
  * @return void
  */
 public function createPage($width, $height)
 {
     if ($this->document === null) {
         $this->initialize();
     }
     $this->pages[] = $this->currentPage = $this->document->addPage();
     $this->currentPage->setWidth(ezcDocumentPcssMeasure::create($width)->get('pt'));
     $this->currentPage->setHeight(ezcDocumentPcssMeasure::create($height)->get('pt'));
     $this->currentPage->setTextRenderingMode(HaruPage::FILL);
     // The current font might need to be recreated for the new page.
     $this->currentFont['font'] = null;
 }
Esempio n. 2
0
 /**
  * Create a new page
  *
  * Create a new page in the PDF document with the given width and height.
  * 
  * @param float $width 
  * @param float $height 
  * @return void
  */
 public function createPage($width, $height)
 {
     $this->pages[] = $this->currentPage = $this->document->addPage();
     $this->currentPage->setWidth($this->mmToPixel($width));
     $this->currentPage->setHeight($this->mmToPixel($height));
 }
Esempio n. 3
0
<?php

$doc = new HaruDoc();
$p = $doc->addPage();
/* set the color (dark blue) */
$p->setRGBFill(0.2, 0.2, 0.5);
/* draw a rectangle */
$p->rectangle(150, 400, 300, 200);
/* fill it */
$p->fill();
/* se the color (white) */
$p->setRGBFill(1, 1, 1);
/* enter text mode */
$p->beginText();
/* choose the font and its size */
$font = $doc->getFont("Helvetica");
$p->setFontAndSize($font, 35);
/* move text position */
$p->moveTextPos(200, 500);
/* print a well-known phrase */
$p->showText("Hello world!");
/* leave text mode */
$p->endText();
/* save the result */
$doc->save("/tmp/test.pdf");