Esempio n. 1
0
 /**
  * @param ZendPage $page
  * @param string $text
  * @param float $x
  * @param float $y
  * @param int $renderMode
  *
  * @return ZendPage
  */
 private function drawRawText(ZendPage $page, $text, $x, $y, $renderMode = 0)
 {
     $textObj = new ZendStringObject($text);
     $xObj = new ZendNumericObject($x);
     $yObj = new ZendNumericObject($y);
     $rObj = new ZendNumericObject($renderMode);
     $content = "BT\n" . $xObj->toString() . ' ' . $yObj->toString() . " Td\n" . (0 === $renderMode ? '' : $rObj->toString() . " Tr\n") . $textObj->toString() . " Tj\n" . "ET\n";
     return $page->rawWrite($content, 'Text');
 }
Esempio n. 2
0
 public function testToString()
 {
     $stringObj = new InternalType\StringObject('some text ()');
     $this->assertEquals($stringObj->toString(), '(some text \\(\\))');
 }
Esempio n. 3
0
 /**
  * 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 \ZendPdf\Exception\ExceptionInterface
  * @return \ZendPdf\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;
 }