Exemplo n.º 1
0
 function evaluate($code, $vars = array())
 {
     if (!$this->_canvas->get_dompdf()->get_option("enable_php")) {
         return;
     }
     // Set up some variables for the inline code
     $pdf = $this->_canvas;
     $fontMetrics = $pdf->get_dompdf()->getFontMetrics();
     $PAGE_NUM = $pdf->get_page_number();
     $PAGE_COUNT = $pdf->get_page_count();
     // Override those variables if passed in
     foreach ($vars as $k => $v) {
         ${$k} = $v;
     }
     //$code = html_entity_decode($code); // @todo uncomment this when tested
     eval($code);
 }
Exemplo n.º 2
0
 /**
  * Returns the PDF as a string
  *
  * The file will open a download dialog by default.  The options
  * parameter controls the output.  Accepted options are:
  *
  *
  * 'compress' = > 1 or 0 - apply content stream compression, this is
  *    on (1) by default
  *
  *
  * @param array $options options (see above)
  *
  * @return string
  */
 public function output($options = null)
 {
     $this->saveLocale();
     $this->write_log();
     if (is_null($this->pdf)) {
         return null;
     }
     $output = $this->pdf->output($options);
     $this->restoreLocale();
     return $output;
 }
Exemplo n.º 3
0
 protected function _debug_layout($box, $color = "red", $style = array())
 {
     $this->_canvas->rectangle($box[0], $box[1], $box[2], $box[3], Color::parse($color), 0.1, $style);
 }