/** * 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_Canvas_Interface */ 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; }