/**
  * Constructor.
  *
  * Parse the tag attributes and add the new line to the document.
  *
  * @param array $tagProperties tag properties
  * @return void
  */
 public function __construct($tagProperties)
 {
     $pdf = Pdf::singleton();
     $lineColor = $tagProperties['LINECOLOR'];
     if ($lineColor != '') {
         $drawColor = Xml2Pdf::convertColor($lineColor);
         $pdf->SetDrawColor($drawColor['r'], $drawColor['g'], $drawColor['b']);
     }
     $lineWidth = $tagProperties['LINEWIDTH'];
     if ($lineWidth != '') {
         $currentLW = $pdf->LineWidth;
         $pdf->SetLineWidth((double) $lineWidth);
     }
     $x1 = $this->mathEval($tagProperties['LEFT']);
     $x2 = $this->mathEval($tagProperties['RIGHT']);
     $y1 = $this->mathEval($tagProperties['TOP']);
     $y2 = $this->mathEval($tagProperties['TOP']);
     $pdf->Line((double) $x1, (double) $y1, (double) $x2, (double) $y2);
     $y1 = $this->mathEval($tagProperties['BOTTOM']);
     $y2 = $y1;
     $pdf->Line((double) $x1, (double) $y1, (double) $x2, (double) $y2);
     //$x1 = $this->mathEval($tagProperties['LEFT']);
     $x2 = $x1;
     $y1 = $this->mathEval($tagProperties['TOP']);
     $y2 = $this->mathEval($tagProperties['BOTTOM']);
     $pdf->Line((double) $x1, (double) $y1, (double) $x2, (double) $y2);
     $x1 = $this->mathEval($tagProperties['RIGHT']);
     $x2 = $x1;
     //$y1 = $this->mathEval($tagProperties['TOP']);
     //$y2 = $this->mathEval($tagProperties['BOTTOM']);
     $pdf->Line((double) $x1, (double) $y1, (double) $x2, (double) $y2);
     if ($lineWidth != '') {
         $pdf->SetLineWidth($currentLW);
     }
 }
 public function __construct($tagProperties)
 {
     $pdf = Pdf::singleton();
     $x = $tagProperties['LEFT'];
     $y = $tagProperties['TOP'];
     $w = $tagProperties['WIDTH'];
     $h = $tagProperties['HEIGHT'];
     $r = $tagProperties['RADIUS'];
     $style = $tagProperties['STYLE'];
     $angle = $tagProperties['ANGLE'];
     $lineColor = $tagProperties['LINECOLOR'];
     if ($lineColor != '') {
         $drawColor = Xml2Pdf::convertColor($lineColor);
         $pdf->SetDrawColor($drawColor['r'], $drawColor['g'], $drawColor['b']);
     }
     $lineWidth = $tagProperties['LINEWIDTH'];
     if ($lineWidth != '') {
         $current = $pdf->LineWidth;
         $pdf->SetLineWidth((double) $lineWidth);
     }
     $pdf->RoundedRect($x, $y, $w, $h, $r, $angle, $style);
     if ($lineWidth != '') {
         $pdf->SetLineWidth($current);
     }
 }
 /**
  * Constructor.
  *
  * @param array $tagProperties tag properties
  * @return void
  */
 public function __construct($tagProperties)
 {
     $pdf = Pdf::singleton();
     if (isset($tagProperties['FILE'])) {
         $this->_styleSheet = $tagProperties['FILE'];
         $this->_parseStyleSheet();
         $pdf->addStyles($this->_styleTags);
     }
 }
Example #4
0
 /**
  * Constructor.
  *
  * @return void
  */
 public function __construct($tagProperties = array())
 {
     $this->pdf = Pdf::singleton();
     if (isset($tagProperties['ID'])) {
         $this->id = $tagProperties['ID'];
         if (!isset($this->pdf->linksIds[$this->id])) {
             $this->pdf->linksIds[$this->id] = $this->pdf->AddLink();
         }
         $this->pdf->SetLink($this->pdf->linksIds[$this->id], -1);
     }
 }
Example #5
0
 /**
  * Constructor.
  *
  * @param $tagProperties tag attributes
  * @return void
  */
 public function __construct($tagProperties)
 {
     $pdf = Pdf::singleton();
     if (isset($tagProperties['TITLE'])) {
         $pdf->setTitle($tagProperties['TITLE']);
     }
     if (isset($tagProperties['SUBJECT'])) {
         $pdf->setSubject($tagProperties['SUBJECT']);
     }
     if (isset($tagProperties['CREATOR'])) {
         $pdf->setCreator($tagProperties['CREATOR']);
     }
 }
Example #6
0
 /**      
  * Constructor.
  *
  * @param string $xml xml file or content
  * @return void
  */
 public function __construct($xml)
 {
     set_exception_handler(array('Xml2Pdf', 'exceptionHandler'));
     $this->_xml = $this->_getXmlContent($xml);
     $this->_pdf = Pdf::singleton();
 }
 /**
  * Constructor.
  *
  * Parse the tag properties.
  *
  * @param object Pdf $pdf object Pdf
  * @param array $tagProperties tag properties
  * @return void
  */
 public function __construct($tagProperties)
 {
     parent::__construct($tagProperties);
     // parse the tag properties for text
     $pdf = Pdf::singleton();
     if (isset($tagProperties['FONT']) && $tagProperties['FONT'] != '') {
         $this->font = $tagProperties['FONT'];
     } else {
         $this->font = $pdf->pageFont;
     }
     if (isset($tagProperties['FONTSTYLE'])) {
         $this->fontStyle = $tagProperties['FONTSTYLE'];
     }
     if (isset($tagProperties['FONTCOLOR'])) {
         $this->fontColor = $tagProperties['FONTCOLOR'];
     }
     if (isset($tagProperties['FONTSIZE'])) {
         $this->fontSize = $tagProperties['FONTSIZE'];
     }
     if (isset($tagProperties['TEXTALIGN'])) {
         $this->textAlign = $tagProperties['TEXTALIGN'];
     }
     if (isset($tagProperties['LINEHEIGHT'])) {
         $this->lineHeight = $tagProperties['LINEHEIGHT'];
     }
     if (isset($tagProperties['BORDER'])) {
         $this->border = $tagProperties['BORDER'];
     }
     if (isset($tagProperties['WIDTH'])) {
         $this->width = $tagProperties['WIDTH'];
     }
     if (isset($tagProperties['LINESPACING'])) {
         $this->lineSpacing = $tagProperties['LINESPACING'];
     }
 }
Example #8
0
 /**
  * Constructor.
  *
  * @return void
  */
 public function __construct($tagProperties)
 {
     $pdf = Pdf::singleton();
     $formatArray = array('A3' => array(841.89, 1190.55), 'A4' => array(595.28, 841.89), 'A5' => array(420.94, 595.28), 'LETTER' => array(612, 791), 'LEGAL' => array(612, 1008));
     $unitArray = array('PT' => 1, 'MM' => 72 / 25.4, 'CM' => 72 / 2.54, 'IN' => 72);
     if (isset($tagProperties['FORMAT'])) {
         $format = strtoupper($tagProperties['FORMAT']);
         if (!isset($formatArray[$format])) {
             throw new Exception('unknow format page in tag body');
             die;
         }
         list($pdf->fwPt, $pdf->fhPt) = $formatArray[$format];
     }
     if (isset($tagProperties['ORIENTATION'])) {
         $orientation = strtoupper($tagProperties['ORIENTATION']);
         if ($orientation == 'P' || $orientation == 'PORTRAIT') {
             $pdf->DefOrientation = 'P';
             $pdf->wPt = $pdf->fwPt;
             $pdf->hPt = $pdf->fhPt;
         } elseif ($orientation == 'L' || $orientation == 'LANDSCAPE') {
             $pdf->DefOrientation = 'L';
             $pdf->wPt = $pdf->fhPt;
             $pdf->hPt = $pdf->fwPt;
         } else {
             throw new Exception('Incorrect orientation: ' . $orientation);
         }
     }
     if (isset($tagProperties['UNIT'])) {
         $unit = strtoupper($tagProperties['UNIT']);
         if (!isset($unitArray[$unit])) {
             throw new Exception('unknow unit scale in tag body');
             die;
         }
         $pdf->k = $unitArray[$unit];
     }
     if (isset($tagProperties['MARGINLEFT'])) {
         if (!is_float((double) $tagProperties['MARGINLEFT'])) {
             throw new Exception('margins needs a float type in tag body');
         }
         $pdf->lMargin = $tagProperties['MARGINLEFT'];
     }
     if (isset($tagProperties['MARGINRIGHT'])) {
         if (!is_float((double) $tagProperties['MARGINRIGHT'])) {
             throw new Exception('margins needs a float type in tag body');
         }
         $pdf->rMargin = $tagProperties['MARGINRIGHT'];
     }
     if (isset($tagProperties['MARGINTOP'])) {
         if (!is_float((double) $tagProperties['MARGINTOP'])) {
             throw new Exception('margins needs a float type in tag body');
         }
         $pdf->tMargin = $tagProperties['MARGINTOP'];
     }
     if (isset($tagProperties['MARGINBOTTOM'])) {
         if (!is_float((double) $tagProperties['MARGINBOTTOM'])) {
             throw new Exception('margins needs a float type in tag body');
         }
         $pdf->SetAutoPageBreak(true, $tagProperties['MARGINBOTTOM']);
     }
     if (isset($tagProperties['MARGINS'])) {
         if (!is_float((double) $tagProperties['MARGINS'])) {
             throw new Exception('margins needs a float type in tag body');
         }
         $pdf->lMargin = $tagProperties['MARGINS'];
         $pdf->rMargin = $tagProperties['MARGINS'];
         $pdf->tMargin = $tagProperties['MARGINS'];
         $pdf->SetAutoPageBreak(true, $tagProperties['MARGINS']);
     }
 }
 /**
  * Constructor.
  *
  * @param array $tagProperties tag properties
  * @param object $parent Object Xml2PfdTag
  * @return void
  */
 public function __construct($tagProperties, $parent = false)
 {
     if (isset($tagProperties['FILE'])) {
         $this->file = $tagProperties['FILE'];
     }
     if (isset($tagProperties['WIDTH'])) {
         $this->width = $tagProperties['WIDTH'];
     }
     if (isset($tagProperties['HEIGHT'])) {
         $this->height = $tagProperties['HEIGHT'];
     }
     if (isset($tagProperties['TOP'])) {
         $this->top = $tagProperties['TOP'];
     }
     if (isset($tagProperties['LEFT'])) {
         $this->left = $tagProperties['LEFT'];
     }
     if (isset($tagProperties['POSITION'])) {
         $this->position = $tagProperties['POSITION'];
     }
     if (isset($tagProperties['TYPE'])) {
         $this->type = $tagProperties['TYPE'];
     }
     $this->_parent = $parent;
     $this->pdf = Pdf::singleton();
 }
Example #10
0
 /**
  * Constructor.
  *
  * Parse the tag attributes and add the new line to the document.
  *
  * @param array $tagProperties tag properties
  * @return void
  */
 public function __construct($tagProperties)
 {
     $pdf = Pdf::singleton();
     $lineHeight = isset($tagProperties['LINEHEIGHT']) ? $tagProperties['LINEHEIGHT'] : PDF_DEFAULT_LINEHEIGHT;
     $pdf->Ln((double) $lineHeight);
 }
 /**
  * Draw an arc of circle
  *
  * @param integer $x1 center absciss
  * @param integer $y1 center ordonnate
  * @param integer $x2 start point absciss
  * @param integer $y2 start point ordonnate
  * @param integer $x3 end poinf absciss
  * @param integer $y3 end point ordonnate
  * @return void 
  */
 public static function arc($x1, $y1, $x2, $y2, $x3, $y3)
 {
     $pdf = Pdf::singleton();
     $h = $pdf->h;
     $pdf->_out(sprintf('%.2f %.2f %.2f %.2f %.2f %.2f c', $x1 * $pdf->k, ($h - $y1) * $pdf->k, $x2 * $pdf->k, ($h - $y2) * $pdf->k, $x3 * $pdf->k, ($h - $y3) * $pdf->k));
 }
 /**
  * Constructor.
  *
  * @param array $tagProperties tag properties
  * @param object $parent Object Xml2PfdTag
  * @return void
  */
 public function __construct($tagProperties, $parent = false)
 {
     if (isset($tagProperties['FILE'])) {
         $this->file = $tagProperties['FILE'];
         if (!file_exists($this->file)) {
             global $_CAMILA;
             $file = CAMILA_TMPL_DIR . '/images/' . $_CAMILA['lang'] . '/' . $this->file;
             if (file_exists($file)) {
                 $this->file = $file;
             }
         }
     }
     if (isset($tagProperties['WIDTH'])) {
         $this->width = $tagProperties['WIDTH'];
     }
     if (isset($tagProperties['HEIGHT'])) {
         $this->height = $tagProperties['HEIGHT'];
     }
     if (isset($tagProperties['TOP'])) {
         $this->top = $this->mathEval($tagProperties['TOP']);
     }
     if (isset($tagProperties['LEFT'])) {
         $this->left = $this->mathEval($tagProperties['LEFT']);
     }
     if (isset($tagProperties['POSITION'])) {
         $this->position = $tagProperties['POSITION'];
     }
     if (isset($tagProperties['TYPE'])) {
         $this->type = $tagProperties['TYPE'];
     }
     if (isset($tagProperties['CONTENT'])) {
         $this->content = $tagProperties['CONTENT'];
     }
     $this->_parent = $parent;
     $this->pdf = Pdf::singleton();
 }