Esempio n. 1
0
 function useTemplate($tplidx, $_x = null, $_y = null, $_w = 0, $_h = 0, $adjustPageSize = false)
 {
     if ($adjustPageSize == true && is_null($_x) && is_null($_y)) {
         $size = $this->getTemplateSize($tplidx, $_w, $_h);
         $format = array($size['w'], $size['h']);
         if ($format[0] != $this->CurPageFormat[0] || $format[1] != $this->CurPageFormat[1]) {
             $this->w = $format[0];
             $this->h = $format[1];
             $this->wPt = $this->w * $this->k;
             $this->hPt = $this->h * $this->k;
             $this->PageBreakTrigger = $this->h - $this->bMargin;
             $this->CurPageFormat = $format;
             $this->PageSizes[$this->page] = array($this->wPt, $this->hPt);
         }
     }
     $this->_out('q 0 J 1 w 0 j 0 G 0 g');
     // reset standard values
     $s = parent::useTemplate($tplidx, $_x, $_y, $_w, $_h);
     $this->_out('Q');
     return $s;
 }
Esempio n. 2
0
 function useTemplate($tplidx, $_x = null, $_y = null, $_w = 0, $_h = 0)
 {
     $this->_out('q 0 J 1 w 0 j 0 G 0 g');
     // reset standard values
     $s = parent::useTemplate($tplidx, $_x, $_y, $_w, $_h);
     $this->_out('Q');
     return $s;
 }
Esempio n. 3
0
 /**
  * Use a template or imported page in current page or other template.
  *
  * You can use a template in a page or in another template.
  * You can give the used template a new size. All parameters are optional.
  * The width or height is calculated automatically if one is given. If no
  * parameter is given the origin size as defined in beginTemplate() or of
  * the imported page is used.
  *
  * The calculated or used width and height are returned as an array.
  *
  * @param int $tplIdx A valid template-id
  * @param int $x The x-position
  * @param int $y The y-position
  * @param int $w The new width of the template
  * @param int $h The new height of the template
  * @param boolean $adjustPageSize If set to true the current page will be resized to fit the dimensions
  *                                of the template
  *
  * @return array The height and width of the template (array('w' => ..., 'h' => ...))
  * @throws LogicException|InvalidArgumentException
  */
 public function useTemplate($tplIdx, $x = null, $y = null, $w = 0, $h = 0, $adjustPageSize = false)
 {
     if ($adjustPageSize == true && is_null($x) && is_null($y)) {
         $size = $this->getTemplateSize($tplIdx, $w, $h);
         $orientation = $size['w'] > $size['h'] ? 'L' : 'P';
         $size = array($size['w'], $size['h']);
         if (is_subclass_of($this, 'TCPDF')) {
             $this->setPageFormat($size, $orientation);
         } else {
             $size = $this->_getpagesize($size);
             if ($orientation != $this->CurOrientation || $size[0] != $this->CurPageSize[0] || $size[1] != $this->CurPageSize[1]) {
                 // New size or orientation
                 if ($orientation == 'P') {
                     $this->w = $size[0];
                     $this->h = $size[1];
                 } else {
                     $this->w = $size[1];
                     $this->h = $size[0];
                 }
                 $this->wPt = $this->w * $this->k;
                 $this->hPt = $this->h * $this->k;
                 $this->PageBreakTrigger = $this->h - $this->bMargin;
                 $this->CurOrientation = $orientation;
                 $this->CurPageSize = $size;
                 $this->PageSizes[$this->page] = array($this->wPt, $this->hPt);
             }
         }
     }
     $this->_out('q 0 J 1 w 0 j 0 G 0 g');
     // reset standard values
     $size = parent::useTemplate($tplIdx, $x, $y, $w, $h);
     $this->_out('Q');
     return $size;
 }
Esempio n. 4
0
 function useTemplate($tplidx, $_x = null, $_y = null, $_w = 0, $_h = 0, $adjustPageSize = false)
 {
     if ($adjustPageSize == true && is_null($_x) && is_null($_y)) {
         $size = $this->getTemplateSize($tplidx, $_w, $_h);
         $orientation = $size['w'] > $size['h'] ? 'L' : 'P';
         $size = array($size['w'], $size['h']);
         $this->setPageFormat($size, $orientation);
     }
     $this->_out('q 0 J 1 w 0 j 0 G 0 g');
     // reset standard values
     $s = parent::useTemplate($tplidx, $_x, $_y, $_w, $_h);
     $this->_out('Q');
     return $s;
 }