示例#1
0
 /**
  * Draw a line of text at the specified position.
  *
  * @param string $text
  * @param float $x
  * @param float $y
  * @throws Zend_Pdf_Exception
  */
 public function drawText($text, $x, $y)
 {
     if ($this->_font === null) {
         throw new Zend_Pdf_Exception('Font has not been set');
     }
     $this->_addProcSet('Text');
     $textObj = new Zend_Pdf_Element_String($text);
     $xObj = new Zend_Pdf_Element_Numeric($x);
     $yObj = new Zend_Pdf_Element_Numeric($y);
     $this->_contents .= "BT\n" . $xObj->toString() . ' ' . $yObj->toString() . " Td\n" . $textObj->toString() . " Tj\n" . "ET\n";
 }
示例#2
0
文件: Page.php 项目: chaimvaid/linet3
 /**
  * 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) {
         //require_once 'Zend/Pdf/Exception.php';
         throw new Zend_Pdf_Exception('Font has not been set');
     }
     $this->_addProcSet('Text');
     $textObj = new Zend_Pdf_Element_String($this->_font->encodeString($text, $charEncoding));
     $xObj = new Zend_Pdf_Element_Numeric($x);
     $yObj = new Zend_Pdf_Element_Numeric($y);
     $this->_contents .= "BT\n" . $xObj->toString() . ' ' . $yObj->toString() . " Td\n" . $textObj->toString() . " Tj\n" . "ET\n";
     return $this;
 }
示例#3
0
 public function testToString()
 {
     $stringObj = new Zend_Pdf_Element_String('some text ()');
     $this->assertEquals($stringObj->toString(), '(some text \\(\\))');
 }