|
|
@@ -38,112 +38,112 @@ require_once 'Zend/Pdf/ElementFactory.php';
|
|
|
*/
|
|
|
abstract class Zend_Pdf_Annotation
|
|
|
{
|
|
|
- /**
|
|
|
- * Annotation dictionary
|
|
|
- *
|
|
|
- * @var Zend_Pdf_Element_Dictionary|Zend_Pdf_Element_Object|Zend_Pdf_Element_Reference
|
|
|
- */
|
|
|
- protected $_annotationDictionary;
|
|
|
-
|
|
|
- /**
|
|
|
- * Get annotation dictionary
|
|
|
- *
|
|
|
- * @internal
|
|
|
- * @return Zend_Pdf_Element
|
|
|
- */
|
|
|
- public function getResource()
|
|
|
- {
|
|
|
- return $this->_annotationDictionary;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * Set bottom edge of the annotation rectangle.
|
|
|
- *
|
|
|
- * @param float $bottom
|
|
|
- * @return Zend_Pdf_Annotation
|
|
|
- */
|
|
|
- public function setBottom($bottom) {
|
|
|
- $this->_annotationDictionary->Rect->items[1]->touch();
|
|
|
- $this->_annotationDictionary->Rect->items[1]->value = $bottom;
|
|
|
+ /**
|
|
|
+ * Annotation dictionary
|
|
|
+ *
|
|
|
+ * @var Zend_Pdf_Element_Dictionary|Zend_Pdf_Element_Object|Zend_Pdf_Element_Reference
|
|
|
+ */
|
|
|
+ protected $_annotationDictionary;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Get annotation dictionary
|
|
|
+ *
|
|
|
+ * @internal
|
|
|
+ * @return Zend_Pdf_Element
|
|
|
+ */
|
|
|
+ public function getResource()
|
|
|
+ {
|
|
|
+ return $this->_annotationDictionary;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Set bottom edge of the annotation rectangle.
|
|
|
+ *
|
|
|
+ * @param float $bottom
|
|
|
+ * @return Zend_Pdf_Annotation
|
|
|
+ */
|
|
|
+ public function setBottom($bottom) {
|
|
|
+ $this->_annotationDictionary->Rect->items[1]->touch();
|
|
|
+ $this->_annotationDictionary->Rect->items[1]->value = $bottom;
|
|
|
|
|
|
return $this;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * Get bottom edge of the annotation rectangle.
|
|
|
- *
|
|
|
- * @return float
|
|
|
- */
|
|
|
- public function getBottom() {
|
|
|
- return $this->_annotationDictionary->Rect->items[1]->value;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * Set top edge of the annotation rectangle.
|
|
|
- *
|
|
|
- * @param float $top
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Get bottom edge of the annotation rectangle.
|
|
|
+ *
|
|
|
+ * @return float
|
|
|
+ */
|
|
|
+ public function getBottom() {
|
|
|
+ return $this->_annotationDictionary->Rect->items[1]->value;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Set top edge of the annotation rectangle.
|
|
|
+ *
|
|
|
+ * @param float $top
|
|
|
* @return Zend_Pdf_Annotation
|
|
|
- */
|
|
|
- public function setTop($top) {
|
|
|
+ */
|
|
|
+ public function setTop($top) {
|
|
|
$this->_annotationDictionary->Rect->items[3]->touch();
|
|
|
$this->_annotationDictionary->Rect->items[3]->value = $top;
|
|
|
|
|
|
return $this;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * Get top edge of the annotation rectangle.
|
|
|
- *
|
|
|
- * @return float
|
|
|
- */
|
|
|
- public function getTop() {
|
|
|
- return $this->_annotationDictionary->Rect->items[3]->value;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * Set right edge of the annotation rectangle.
|
|
|
- *
|
|
|
- * @param float $right
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Get top edge of the annotation rectangle.
|
|
|
+ *
|
|
|
+ * @return float
|
|
|
+ */
|
|
|
+ public function getTop() {
|
|
|
+ return $this->_annotationDictionary->Rect->items[3]->value;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Set right edge of the annotation rectangle.
|
|
|
+ *
|
|
|
+ * @param float $right
|
|
|
* @return Zend_Pdf_Annotation
|
|
|
- */
|
|
|
- public function setRight($right) {
|
|
|
+ */
|
|
|
+ public function setRight($right) {
|
|
|
$this->_annotationDictionary->Rect->items[2]->touch();
|
|
|
$this->_annotationDictionary->Rect->items[2]->value = $right;
|
|
|
|
|
|
return $this;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * Get right edge of the annotation rectangle.
|
|
|
- *
|
|
|
- * @return float
|
|
|
- */
|
|
|
- public function getRight() {
|
|
|
- return $this->_annotationDictionary->Rect->items[2]->value;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * Set left edge of the annotation rectangle.
|
|
|
- *
|
|
|
- * @param float $left
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Get right edge of the annotation rectangle.
|
|
|
+ *
|
|
|
+ * @return float
|
|
|
+ */
|
|
|
+ public function getRight() {
|
|
|
+ return $this->_annotationDictionary->Rect->items[2]->value;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Set left edge of the annotation rectangle.
|
|
|
+ *
|
|
|
+ * @param float $left
|
|
|
* @return Zend_Pdf_Annotation
|
|
|
- */
|
|
|
- public function setLeft($left) {
|
|
|
+ */
|
|
|
+ public function setLeft($left) {
|
|
|
$this->_annotationDictionary->Rect->items[0]->touch();
|
|
|
$this->_annotationDictionary->Rect->items[0]->value = $left;
|
|
|
|
|
|
- return $this;
|
|
|
- }
|
|
|
+ return $this;
|
|
|
+ }
|
|
|
|
|
|
- /**
|
|
|
- * Get left edge of the annotation rectangle.
|
|
|
- *
|
|
|
- * @return float
|
|
|
- */
|
|
|
- public function getLeft() {
|
|
|
- return $this->_annotationDictionary->Rect->items[0]->value;
|
|
|
- }
|
|
|
+ /**
|
|
|
+ * Get left edge of the annotation rectangle.
|
|
|
+ *
|
|
|
+ * @return float
|
|
|
+ */
|
|
|
+ public function getLeft() {
|
|
|
+ return $this->_annotationDictionary->Rect->items[0]->value;
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* Return text to be displayed for the annotation or, if this type of annotation
|
|
|
@@ -153,9 +153,9 @@ abstract class Zend_Pdf_Annotation
|
|
|
* @return string
|
|
|
*/
|
|
|
public function getText() {
|
|
|
- if ($this->_annotationDictionary->Contents === null) {
|
|
|
- return '';
|
|
|
- }
|
|
|
+ if ($this->_annotationDictionary->Contents === null) {
|
|
|
+ return '';
|
|
|
+ }
|
|
|
|
|
|
return $this->_annotationDictionary->Contents->value;
|
|
|
}
|
|
|
@@ -170,23 +170,23 @@ abstract class Zend_Pdf_Annotation
|
|
|
*/
|
|
|
public function setText($text) {
|
|
|
if ($this->_annotationDictionary->Contents === null) {
|
|
|
- $this->_annotationDictionary->touch();
|
|
|
+ $this->_annotationDictionary->touch();
|
|
|
$this->_annotationDictionary->Contents = new Zend_Pdf_Element_String($text);
|
|
|
} else {
|
|
|
- $this->_annotationDictionary->Contents->touch();
|
|
|
- $this->_annotationDictionary->Contents->value = new Zend_Pdf_Element_String($text);
|
|
|
+ $this->_annotationDictionary->Contents->touch();
|
|
|
+ $this->_annotationDictionary->Contents->value = new Zend_Pdf_Element_String($text);
|
|
|
}
|
|
|
|
|
|
return $this;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * Annotation object constructor
|
|
|
- *
|
|
|
- * @throws Zend_Pdf_Exception
|
|
|
- */
|
|
|
- public function __construct(Zend_Pdf_Element $annotationDictionary)
|
|
|
- {
|
|
|
+ * Annotation object constructor
|
|
|
+ *
|
|
|
+ * @throws Zend_Pdf_Exception
|
|
|
+ */
|
|
|
+ public function __construct(Zend_Pdf_Element $annotationDictionary)
|
|
|
+ {
|
|
|
if ($annotationDictionary->getType() != Zend_Pdf_Element::TYPE_DICTIONARY) {
|
|
|
require_once 'Zend/Pdf/Exception.php';
|
|
|
throw new Zend_Pdf_Exception('Annotation dictionary resource has to be a dictionary.');
|
|
|
@@ -213,7 +213,7 @@ abstract class Zend_Pdf_Annotation
|
|
|
require_once 'Zend/Pdf/Exception.php';
|
|
|
throw new Zend_Pdf_Exception('\'Rect\' dictionary entry must be an array of four numeric elements.');
|
|
|
}
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* Load Annotation object from a specified resource
|
|
|
@@ -224,6 +224,6 @@ abstract class Zend_Pdf_Annotation
|
|
|
*/
|
|
|
public static function load(Zend_Pdf_Element $resource)
|
|
|
{
|
|
|
- /** @todo implementation */
|
|
|
+ /** @todo implementation */
|
|
|
}
|
|
|
}
|