Ejemplo n.º 1
0
 function from_box(&$box)
 {
     $field = new BoxTextFieldPageNo();
     $field->copy_style($box);
     $field->words = array("000");
     $field->encodings = array("iso-8859-1");
     $field->_left = $box->_left;
     $field->_top = $box->_top;
     $field->baseline = $box->baseline;
     return $field;
 }
 function from_box(&$box)
 {
     $field = new BoxTextFieldPageNo();
     $field->copy_style($box);
     $field->word = "000";
     $field->encoding = $box->encoding;
     $field->src_encoding = $box->src_encoding;
     $field->size = $box->size;
     $field->decoration = $box->decoration;
     $field->family = $box->family;
     $field->weight = $box->weight;
     $field->style = $box->style;
     $field->_left = $box->_left;
     $field->_top = $box->_top;
     $field->_width_constraint = $box->_width_constraint;
     $field->_height_constraint = $box->_height_constraint;
     $field->baseline = $box->baseline;
     return $field;
 }
Ejemplo n.º 3
0
 function process(&$tree, $data, &$pipeline)
 {
     if (is_a($tree, 'TextBox')) {
         // Ignore completely empty text boxes
         if (count($tree->words) == 0) {
             return;
         }
         switch ($tree->words[0]) {
             case '##PAGE##':
                 $parent =& $tree->parent;
                 $field = BoxTextFieldPageNo::from_box($tree);
                 $parent->insert_before($field, $tree);
                 $parent->remove($tree);
                 break;
             case '##PAGES##':
                 $parent =& $tree->parent;
                 $field = BoxTextFieldPages::from_box($tree);
                 $parent->insert_before($field, $tree);
                 $parent->remove($tree);
                 break;
             case '##FILENAME##':
                 if (is_null($this->filename)) {
                     $tree->words[0] = $data->get_uri();
                 } else {
                     $tree->words[0] = $this->filename;
                 }
                 break;
             case '##FILESIZE##':
                 if (is_null($this->filesize)) {
                     $tree->words[0] = strlen($data->get_content());
                 } else {
                     $tree->words[0] = $this->filesize;
                 }
                 break;
             case '##TIMESTAMP##':
                 $tree->words[0] = $this->_timestamp;
                 break;
         }
     } elseif (is_a($tree, 'GenericContainerBox')) {
         for ($i = 0; $i < count($tree->content); $i++) {
             $this->process($tree->content[$i], $data, $pipeline);
         }
     }
 }