当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Pdf_ElementFactory::setObjectCount方法代码示例

本文整理汇总了PHP中Zend_Pdf_ElementFactory::setObjectCount方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Pdf_ElementFactory::setObjectCount方法的具体用法?PHP Zend_Pdf_ElementFactory::setObjectCount怎么用?PHP Zend_Pdf_ElementFactory::setObjectCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Pdf_ElementFactory的用法示例。


在下文中一共展示了Zend_Pdf_ElementFactory::setObjectCount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: rollback

 /**
  * Rollback document $steps number of revisions.
  * This method must be invoked before any changes, applied to the document.
  * Otherwise behavior is undefined.
  *
  * @param integer $steps
  */
 public function rollback($steps)
 {
     for ($count = 0; $count < $steps; $count++) {
         if ($this->_trailer->getPrev() !== null && $this->_trailer->getPrev()->Root !== null) {
             $this->_trailer = $this->_trailer->getPrev();
         } else {
             break;
         }
     }
     $this->_objFactory->setObjectCount($this->_trailer->Size->value);
     // Mark content as modified to force new trailer generation at render time
     $this->_trailer->Root->touch();
     $this->pages = array();
     $this->_loadPages($this->_trailer->Root->Pages);
 }
开发者ID:BackupTheBerlios,项目名称:openpublisher-svn,代码行数:22,代码来源:Pdf.php

示例2: __construct

 /**
  * Object constructor
  *
  * Note: PHP duplicates string, which is sent by value, only of it's updated.
  * Thus we don't need to care about overhead
  *
  * @param mixed $source
  * @param Zend_Pdf_ElementFactory $factory
  * @param boolean $load
  * @throws Zend_Exception
  */
 public function __construct($source, Zend_Pdf_ElementFactory $factory, $load)
 {
     if ($load) {
         if (($pdfFile = @fopen($source, 'rb')) === false) {
             throw new Zend_Pdf_Exception("Can not open '{$source}' file for reading.");
         }
         $byteCount = filesize($source);
         $data = '';
         while ($byteCount > 0 && ($nextBlock = fread($pdfFile, $byteCount)) != false) {
             $data .= $nextBlock;
             $byteCount -= strlen($nextBlock);
         }
         fclose($pdfFile);
         $this->_stringParser = new Zend_Pdf_StringParser($data, $factory);
     } else {
         $this->_stringParser = new Zend_Pdf_StringParser($source, $factory);
     }
     $pdfVersionComment = $this->_stringParser->readComment();
     if (substr($pdfVersionComment, 0, 5) != '%PDF-') {
         throw new Zend_Pdf_Exception('File is not a PDF.');
     }
     $pdfVersion = (double) substr($pdfVersionComment, 5);
     if ($pdfVersion < 0.9 || $pdfVersion >= 1.61) {
         /**
          * @todo
          * To support PDF versions 1.5 (Acrobat 6) and PDF version 1.7 (Acrobat 7)
          * Stream compression filter must be implemented (for compressed object streams).
          * Cross reference streams must be implemented
          */
         throw new Zend_Pdf_Exception(sprintf('Unsupported PDF version. Zend_Pdf supports PDF 1.0-1.4. Current version - \'%f\'', $pdfVersion));
     }
     $this->_stringParser->offset = strrpos($this->_stringParser->data, '%%EOF');
     if ($this->_stringParser->offset === false || strlen($this->_stringParser->data) - $this->_stringParser->offset > 7) {
         throw new Zend_Pdf_Exception('Pdf file syntax error. End-of-fle marker expected at the end of file.');
     }
     $this->_stringParser->offset--;
     /**
      * Go to end of cross-reference table offset
      */
     while (Zend_Pdf_StringParser::isWhiteSpace(ord($this->_stringParser->data[$this->_stringParser->offset])) && $this->_stringParser->offset > 0) {
         $this->_stringParser->offset--;
     }
     /**
      * Go to the start of cross-reference table offset
      */
     while (!Zend_Pdf_StringParser::isWhiteSpace(ord($this->_stringParser->data[$this->_stringParser->offset])) && $this->_stringParser->offset > 0) {
         $this->_stringParser->offset--;
     }
     /**
      * Go to the end of 'startxref' keyword
      */
     while (Zend_Pdf_StringParser::isWhiteSpace(ord($this->_stringParser->data[$this->_stringParser->offset])) && $this->_stringParser->offset > 0) {
         $this->_stringParser->offset--;
     }
     /**
      * Go to the white space (eol marker) before 'startxref' keyword
      */
     $this->_stringParser->offset -= 9;
     $nextLexeme = $this->_stringParser->readLexeme();
     if ($nextLexeme != 'startxref') {
         throw new Zend_Pdf_Exception(sprintf('Pdf file syntax error. \'startxref\' keyword expected. Offset - 0x%X.', $this->_stringParser->offset - strlen($nextLexeme)));
     }
     $startXref = $this->_stringParser->readLexeme();
     if (!ctype_digit($startXref)) {
         throw new Zend_Pdf_Exception(sprintf('Pdf file syntax error. Cross-reference table offset must contain only digits. Offset - 0x%X.', $this->_stringParser->offset - strlen($nextLexeme)));
     }
     $this->_trailer = $this->_loadXRefTable($startXref);
     $factory->setObjectCount($this->_trailer->Size->value);
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:80,代码来源:Parser.php


注:本文中的Zend_Pdf_ElementFactory::setObjectCount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。