function o_contents($id,$action,$options=''){
    if ($action!='new'){
        $o =& $this->objects[$id];
    }
    switch ($action){
        case 'new':
        $this->objects[$id]=array('t'=>'contents','c'=>'','info'=>array());
        if (strlen($options) && intval($options)){
        // then this contents is the primary for a page
        $this->objects[$id]['onPage']=$options;
        } else if ($options=='raw'){
        // then this page contains some other type of system object
        $this->objects[$id]['raw']=1;
        }
        break;
        case 'add':
        // add more options to the decleration
        foreach ($options as $k=>$v){
            $o['info'][$k]=$v;
        }
        case 'out':
        $tmp=$o['c'];
        $res= "\n".$id." 0 obj\n";
        if (isset($this->objects[$id]['raw'])){
        $res.=$tmp;
        } else {
        $res.= "<<";
        if (function_exists('gzcompress') && $this->options['compression']){
            // then implement ZLIB based compression on this content stream
            $res.=" /Filter /FlateDecode";
            $tmp = gzcompress($tmp);
        }
        if ($this->encrypted){
            $this->encryptInit($id);
            $tmp = $this->ARC4($tmp);
        }
        foreach($o['info'] as $k=>$v){
            $res .= "\n/".$k.' '.$v;
        }
        $res.="\n/Length ".strlen($tmp)." >>\nstream\n".$tmp."\nendstream";
        }
        $res.="\nendobj\n";
        return $res;
        break;
    }
    }