예제 #1
0
파일: Page.php 프로젝트: bradley-holt/zf2
 /**
  * Draw a line of text at the specified position.
  *
  * @param string $text
  * @param float $x
  * @param float $y
  * @param string $charEncoding (optional) Character encoding of source text.
  *   Defaults to current locale.
  * @throws \Zend\Pdf\Exception
  * @return \Zend\Pdf\Page
  */
 public function drawText($text, $x, $y, $charEncoding = '')
 {
     if ($this->_font === null) {
         throw new Exception\LogicException('Font has not been set');
     }
     $this->_addProcSet('Text');
     $textObj = new InternalType\StringObject($this->_font->encodeString($text, $charEncoding));
     $xObj = new InternalType\NumericObject($x);
     $yObj = new InternalType\NumericObject($y);
     $this->_contents .= "BT\n" . $xObj->toString() . ' ' . $yObj->toString() . " Td\n" . $textObj->toString() . " Tj\n" . "ET\n";
     return $this;
 }