function fromXmlNode($node) { // print_r("G:fromXmlNode"); parent::fromXmlNode($node); if (empty($this->dynamic)) { return; } $settings = array('rows' => $this->rows, 'cols' => $this->cols, 'dynamic' => $this->dynamic); //look for the bounding box.. $boundingbox = false; //echo "<PRE>";print_r($this->children);exit; foreach (array_keys($this->children) as $k) { if (!is_a($this->children[$k], 'XML_SvgToPDF_Rect')) { continue; } if (empty($this->children[$k]->nonprintable) || $this->children[$k]->nonprintable != 'true') { continue; } // echo "SETTING BOUNDING BOX"; exit; $boundingbox = clone $this->children[$k]; // box will be rendered.. $this->children[$k]->style['fill'] = 'none'; // unset($this->children[$k]); } if (!$boundingbox) { return; } //echo "<PRE>";print_r($boundingbox ); exit; $this->boundingbox = $boundingbox; $this->settings = $settings; // change the X/Y values of all the child elements.. $this->shiftChildren(-1 * $this->boundingbox->x, -1 * $this->boundingbox->y); //$this->shiftChildren($this->boundingbox->x,$this->boundingbox->y); }
function fromXmlNode($node) { parent::fromXmlNode($node); // any text ??? if (empty($this->children) || empty($this->children[0]->content)) { return; } // modify the alignment of the if this block content of the first child is "==" if (substr($this->children[0]->content, 0, 2) == '==') { $this->style['text-anchor'] = 'justify'; $this->children[0]->content = substr($this->children[0]->content, 2); } }
function fromXmlNode($node) { parent::fromXmlNode($node); $d = explode(' ', trim($this->d)); $i = 0; $data = array(); while ($i < count($d)) { $action = $d[$i]; switch (strtolower($action)) { case 'c': // ???? $data[] = array('L', $d[$i + 3], $d[$i + 4]); $i += 7; break; case 'm': // move // move case 'l': // line $data[] = array($action, $d[$i + 1], $d[$i + 2]); $i += 3; break; case 'h': // move horizontal // move horizontal case 'v': // move horizontal $data[] = array($action, $d[$i + 1]); $i += 2; break; case 'z': // close path.. $data[] = array($action); $i++; break; default: echo "oops found something odd in path? '{$action}'"; echo $this->d; exit; break; } } $this->d = $data; }
function fromXmlNode($node) { parent::fromXmlNode($node); $this->x = false; $this->y = false; $this->content = $node->textContent; /* if (isset($this->x)) { unset($this->x); } if (isset($this->y)) { unset($this->y); } */ static $trans = false; if (!$trans) { $trans = array_flip(get_html_translation_table(HTML_ENTITIES)); } if (strlen($this->content)) { // convert & etc. if (strpos($this->content, '&') !== false) { $this->content = strtr($this->content, $trans); $this->content = str_replace(''', "'", $this->content); $this->content = preg_replace_callback('/&#(\\d+);/m', array($this, 'content_replace'), $this->content); } if (!empty($node->language)) { // todo - other conversions.... $this->content = mb_convert_encoding($this->content, 'BIG-5', 'UTF-8'); } // dynamic parts.. if (false === strpos($this->content, '{')) { return; } preg_match_all('/\\{([a-z0-9_.]+(\\(\\))?)\\}/i', $this->content, $matches); $this->args = $matches[1]; foreach ($this->args as $v) { $this->content = str_replace('{' . $v . '}', '%s', $this->content); } //$this->content = preg_replace('/\{('.implode('|',$matches[1]).')\}/','%s',$this->content); } }