當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zend_Pdf_ElementFactory_Interface::resolve方法代碼示例

本文整理匯總了PHP中Zend_Pdf_ElementFactory_Interface::resolve方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Pdf_ElementFactory_Interface::resolve方法的具體用法?PHP Zend_Pdf_ElementFactory_Interface::resolve怎麽用?PHP Zend_Pdf_ElementFactory_Interface::resolve使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend_Pdf_ElementFactory_Interface的用法示例。


在下文中一共展示了Zend_Pdf_ElementFactory_Interface::resolve方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getObject

 /**
  * Read inderect object from a PDF stream
  *
  * @param integer $offset
  * @param Zend_Pdf_Element_Reference_Context $context
  * @return Zend_Pdf_Element_Object
  */
 public function getObject($offset, Zend_Pdf_Element_Reference_Context $context)
 {
     if ($offset === null) {
         return new Zend_Pdf_Element_Null();
     }
     // Save current offset to make getObject() reentrant
     $offsetSave = $this->offset;
     $this->offset = $offset;
     $this->_context = $context;
     $this->_elements = array();
     $objNum = $this->readLexeme();
     if (!ctype_digit($objNum)) {
         require_once 'Zend/Pdf/Exception.php';
         throw new Zend_Pdf_Exception(sprintf('PDF file syntax error. Offset - 0x%X. Object number expected.', $this->offset - strlen($objNum)));
     }
     $genNum = $this->readLexeme();
     if (!ctype_digit($genNum)) {
         require_once 'Zend/Pdf/Exception.php';
         throw new Zend_Pdf_Exception(sprintf('PDF file syntax error. Offset - 0x%X. Object generation number expected.', $this->offset - strlen($genNum)));
     }
     $objKeyword = $this->readLexeme();
     if ($objKeyword != 'obj') {
         require_once 'Zend/Pdf/Exception.php';
         throw new Zend_Pdf_Exception(sprintf('PDF file syntax error. Offset - 0x%X. \'obj\' keyword expected.', $this->offset - strlen($objKeyword)));
     }
     $objValue = $this->readElement();
     $nextLexeme = $this->readLexeme();
     if ($nextLexeme == 'endobj') {
         /**
          * Object is not generated by factory (thus it's not marked as modified object).
          * But factory is assigned to the obect.
          */
         $obj = new Zend_Pdf_Element_Object($objValue, (int) $objNum, (int) $genNum, $this->_objFactory->resolve());
         foreach ($this->_elements as $element) {
             $element->setParentObject($obj);
         }
         // Restore offset value
         $this->offset = $offsetSave;
         return $obj;
     }
     /**
      * It's a stream object
      */
     if ($nextLexeme != 'stream') {
         require_once 'Zend/Pdf/Exception.php';
         throw new Zend_Pdf_Exception(sprintf('PDF file syntax error. Offset - 0x%X. \'endobj\' or \'stream\' keywords expected.', $this->offset - strlen($nextLexeme)));
     }
     if (!$objValue instanceof Zend_Pdf_Element_Dictionary) {
         require_once 'Zend/Pdf/Exception.php';
         throw new Zend_Pdf_Exception(sprintf('PDF file syntax error. Offset - 0x%X. Stream extent must be preceded by stream dictionary.', $this->offset - strlen($nextLexeme)));
     }
     /**
      * References are automatically dereferenced at this moment.
      */
     $streamLength = $objValue->Length->value;
     /**
      * 'stream' keyword must be followed by either cr-lf sequence or lf character only.
      * This restriction gives the possibility to recognize all cases exactly
      */
     if ($this->data[$this->offset] == "\r" && $this->data[$this->offset + 1] == "\n") {
         $this->offset += 2;
     } else {
         if ($this->data[$this->offset] == "\n") {
             $this->offset++;
         } else {
             require_once 'Zend/Pdf/Exception.php';
             throw new Zend_Pdf_Exception(sprintf('PDF file syntax error. Offset - 0x%X. \'stream\' must be followed by either cr-lf sequence or lf character only.', $this->offset - strlen($nextLexeme)));
         }
     }
     $dataOffset = $this->offset;
     $this->offset += $streamLength;
     $nextLexeme = $this->readLexeme();
     if ($nextLexeme != 'endstream') {
         require_once 'Zend/Pdf/Exception.php';
         throw new Zend_Pdf_Exception(sprintf('PDF file syntax error. Offset - 0x%X. \'endstream\' keyword expected.', $this->offset - strlen($nextLexeme)));
     }
     $nextLexeme = $this->readLexeme();
     if ($nextLexeme != 'endobj') {
         require_once 'Zend/Pdf/Exception.php';
         throw new Zend_Pdf_Exception(sprintf('PDF file syntax error. Offset - 0x%X. \'endobj\' keyword expected.', $this->offset - strlen($nextLexeme)));
     }
     $obj = new Zend_Pdf_Element_Object_Stream(substr($this->data, $dataOffset, $streamLength), (int) $objNum, (int) $genNum, $this->_objFactory->resolve(), $objValue);
     foreach ($this->_elements as $element) {
         $element->setParentObject($obj);
     }
     // Restore offset value
     $this->offset = $offsetSave;
     return $obj;
 }
開發者ID:travisj,項目名稱:zf,代碼行數:96,代碼來源:StringParser.php

示例2: resolve

 /**
  * Get source factory object
  *
  * @return Zend_Pdf_ElementFactory
  */
 public function resolve()
 {
     return $this->_factory->resolve();
 }
開發者ID:dalinhuang,項目名稱:popo,代碼行數:9,代碼來源:Proxy.php


注:本文中的Zend_Pdf_ElementFactory_Interface::resolve方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。