public function testActionURIGettersSetters() { $action = Zend_Pdf_Action_URI::create('http://somehost/'); $this->assertEquals($action->getUri(), 'http://somehost/'); $action->setUri('http://another_host/'); $this->assertEquals($action->getUri(), 'http://another_host/'); $this->assertEquals($action->getIsMap(), false); $action->setIsMap(true); $this->assertEquals($action->getIsMap(), true); $this->assertEquals($action->getResource()->toString(), '<</Type /Action /S /URI /URI (http://another_host/) /IsMap true >>'); $action->setIsMap(false); $this->assertEquals($action->getIsMap(), false); $this->assertEquals($action->getResource()->toString(), '<</Type /Action /S /URI /URI (http://another_host/) >>'); }
protected function addLink($link, Zend_Pdf_Style $style, $text = "") { $target = Zend_Pdf_Action_URI::create($link, true); $lines = explode("\n", $this->getWrappedText($text, $style, $this->getLineLimit())); $lastLine = null; $this->_currentPage->setStyle($style); foreach ($lines as $line) { if (trim($line) != "") { if ($lastLine != null) { $this->addNewLine($style->getFontSize()); } $this->_currentPage->drawText($line, $this->getX(), $this->getY()); $annotation = Zend_Pdf_Annotation_Link::create($this->getX(), $this->getY(), $this->getX() + $this->widthForStringUsingFontSize($line, $style->getFont(), $style->getFontSize()), $this->getY(), $target); $this->_currentPage->attachAnnotation($annotation); $this->_currentPage->drawLine($this->getX(), $this->getY() - 2, $this->getX() + $this->widthForStringUsingFontSize($line, $style->getFont(), $style->getFontSize()), $this->getY() - 2); $lastLine = $line; } } $this->setX($this->getX() + $this->widthForStringUsingFontSize($lastLine, $style->getFont(), $style->getFontSize())); }