Location: PHPKode > projects > Php Pdf Factory > Pdf/Objects.php
<?
require_once "Objects/Action.php";
require_once "Objects/Annotation.php";
require_once "Objects/Catalog.php";
require_once "Objects/Contents.php";
require_once "Objects/Destination.php";
require_once "Objects/Encryption.php";
require_once "Objects/Font.php";
require_once "Objects/FontDescriptor.php";
require_once "Objects/FontEncoding.php";
require_once "Objects/Info.php";
require_once "Objects/Outlines.php";
require_once "Objects/Page.php";
require_once "Objects/Pages.php";
require_once "Objects/Procset.php";
require_once "Objects/Resources.php";
require_once "Objects/ViewerPreferences.php";
require_once "Objects/XObject.php";
require_once "Etc/SpareObjects.php";

class PdfObjects {
  var $spare;
  var $objects = array('');
  /**
  *  Reference to the Pdf Catalog in dictionary
  *
  *  @type ref
  *  @access public
  */
  var $catalogId;
  /**
  *  Current Outline in dictionary
  *
  *  @type ref
  *  @access public
  */
  var $currentOutline;
  /**
  *  Current PageTree node 
  *
  *  @type ref
  *  @access public
  */
  var $currentNode;
  var $encrypted = false;
  /**
  * store label->id pairs for named destinations, these will be used to replace internal links
  * done this way so that destinations can be defined after the location that links to them
  */
  var $destinations = array();
  var $infoObject;
  /**
  * an array which contains information about the objects which are not firmly attached to pages
  * these have been added with the addObject function
  */
  var $looseObjects=array();
  /**
  * array contains infomation about how the loose objects are to be added to the document
  */
  var $addLooseObjects=array();
  /**
  * the objectId of the information object for the document
  * this contains authorship, title etc.
  */
  var $numPages = 0;
  var $pages = array('');
  /**
  * an object which is used to save the state of the document, mainly the colours and styles
  * it is used to temporarily change to another state, the change back to what it was before
  */
  var $_stateStack;
  function PdfObjects() {
    $this->spare = &new PdfSpareObjects($this);
  }
  function &createObject ($cname,$options='') {
    if (class_exists($cname)) {
      $ob = &new $cname($this,sizeof($this->objects));
      $this->objects[] = &$ob;
      $a = sizeof($this->objects)-1;
      $ob->create($options);
      return $this->objects[$a];
    } else {
      return false;
    }
  }
  /**
  * after an object has been created, it wil only show if it has been added, using this function.
  */
  function addObject($id,$options='add'){
    $this->spare->add($id,$options);
  }
  /**
  * make a loose object, the output will go into this object, until it is closed, then will revert to
  * the current one.
  * this object will not appear until it is included within a page.
  * the function will return the object number
  */
  function openObject(){
    return $this->spare->open();
  }
  /**
  * open an existing object for editing
  */
  function reopenObject($id){
    return $this->spare->reopen($id);
  }
  /**
  * close an object
  */
  function closeObject(){
   return $this->spare->close();
  }
  /**
  * stop an object from appearing on pages from this point on
  */
  function stopObject($id){
    $this->spare->stop($id);
  }
  /**
  * add content to the currently active object
  *
  * @access private
  */
  function addContent($content){
    $this->currentContents->addRaw($content);
  }

  function &getById ($id) {
    if (is_object($id)) $id = $id->getId();
    return $this->objects[$id];
  }
  function replace ($id,$r) {
    $this->objects[$id] = $r;
  }
  function isExists ($id) {
    return isset($this->objects[$id]);
  }
  function getObjCount () {
    return sizeof($this->objects);
  }
}

?>
Return current item: Php Pdf Factory