| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,229 @@ |
| 1 |
+<?php |
|
| 2 |
+ |
|
| 3 |
+/** |
|
| 4 |
+ * viabook platform for Contao Open Source CMS |
|
| 5 |
+ * |
|
| 6 |
+ * Copyright (C) 2012-2014 eSalesMedia |
|
| 7 |
+ * |
|
| 8 |
+ * @package eSM_viabook |
|
| 9 |
+ * @link http://www.esales-media.de |
|
| 10 |
+ * @license commercial |
|
| 11 |
+ * |
|
| 12 |
+ * @author Benjamin Roth <benjamin@esales-media.de> |
|
| 13 |
+ */ |
|
| 14 |
+ |
|
| 15 |
+ |
|
| 16 |
+/** |
|
| 17 |
+ * Namespace |
|
| 18 |
+ */ |
|
| 19 |
+namespace eSM_isotope_custom\Pdf; |
|
| 20 |
+ |
|
| 21 |
+/** |
|
| 22 |
+ * Include required tcpdf config files |
|
| 23 |
+ */ |
|
| 24 |
+ |
|
| 25 |
+require_once(TL_ROOT . '/system/modules/eSM_isotope_custom/config/bb_tcpdf.php'); |
|
| 26 |
+require_once(TL_ROOT . '/vendor/tecnickcom/tcpdf/tcpdf.php'); |
|
| 27 |
+ |
|
| 28 |
+class BBPDF extends \TCPDF {
|
|
| 29 |
+ |
|
| 30 |
+ public function Header() |
|
| 31 |
+ {
|
|
| 32 |
+ // Header |
|
| 33 |
+ // get the current page break margin |
|
| 34 |
+ $bMargin = $this->getBreakMargin(); |
|
| 35 |
+ // get current auto-page-break mode |
|
| 36 |
+ $auto_page_break = $this->getAutoPageBreak(); |
|
| 37 |
+ // disable auto-page-break |
|
| 38 |
+ $this->SetAutoPageBreak(false, 0); |
|
| 39 |
+ // set bacground image |
|
| 40 |
+ // restore auto-page-break status |
|
| 41 |
+ $this->SetAutoPageBreak($auto_page_break, $bMargin); |
|
| 42 |
+ $this->SetMargins(0,0,0); |
|
| 43 |
+ $this->SetFooterMargin(0); |
|
| 44 |
+ $this->Image(TL_ROOT . '/files/base/layout/img/expertise_header.jpg', 15, 10,180,0,'','','T',true,300); |
|
| 45 |
+ //$this->Image(TL_ROOT . '/files/themes/affentaler_2017/assets/images/base/affentaler_logo.png', 75, 15,60,0,'PNG','','T',true,300); |
|
| 46 |
+ $this->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); |
|
| 47 |
+ $this->SetFooterMargin(PDF_MARGIN_FOOTER); |
|
| 48 |
+ } |
|
| 49 |
+ |
|
| 50 |
+ |
|
| 51 |
+ // Page footer |
|
| 52 |
+ public function Footer() |
|
| 53 |
+ {
|
|
| 54 |
+ // Footer |
|
| 55 |
+ // get the current page break margin |
|
| 56 |
+ $bMargin = $this->getBreakMargin(); |
|
| 57 |
+ // get current auto-page-break mode |
|
| 58 |
+ $auto_page_break = $this->getAutoPageBreak(); |
|
| 59 |
+ // disable auto-page-break |
|
| 60 |
+ $this->SetAutoPageBreak(false, 0); |
|
| 61 |
+ // set bacground image |
|
| 62 |
+ // restore auto-page-break status |
|
| 63 |
+ $this->SetAutoPageBreak($auto_page_break, $bMargin); |
|
| 64 |
+ $this->SetMargins(0,0,0); |
|
| 65 |
+ $this->SetFooterMargin(0); |
|
| 66 |
+ |
|
| 67 |
+ |
|
| 68 |
+ $this->Rect(15, 277, 180, 10, 'F', array('all'=>array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 1, 'color' => array(35, 52, 75, 13))), array(95,102,106));
|
|
| 69 |
+ |
|
| 70 |
+ |
|
| 71 |
+ $this->SetTextColor(255,255,255); |
|
| 72 |
+ $this->SetXY(15, 277); |
|
| 73 |
+ $this->CreateCell(180, 10, 'www.baden-badener-weinhaus.de', 0, 15, '', 'C', PDF_FONT_NAME_DATA); |
|
| 74 |
+ |
|
| 75 |
+// $this->Image(TL_ROOT . '/files/themes/gengenbach_v1/assets/images/pdf/expertise_papier_footer.jpg', 0, 278,210,0,'JPG','','T',true,300); |
|
| 76 |
+ $this->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); |
|
| 77 |
+ $this->SetFooterMargin(PDF_MARGIN_FOOTER); |
|
| 78 |
+ } |
|
| 79 |
+ |
|
| 80 |
+ public function CreateTextBox($textval, $x = 0, $y = 0, $width = 0, $height = 0, $fontsize = PDF_FONT_SIZE_MAIN, $fontstyle = '', $align = 'L', $font = PDF_FONT_NAME_MAIN) |
|
| 81 |
+ {
|
|
| 82 |
+ $margins = $this->getMargins(); |
|
| 83 |
+ $this->SetFont($font, $fontstyle, $fontsize); |
|
| 84 |
+ |
|
| 85 |
+ if (!strlen($y)) |
|
| 86 |
+ {
|
|
| 87 |
+ $this->SetX($x+$margins['left']); |
|
| 88 |
+ } else {
|
|
| 89 |
+ $this->SetXY($x+$margins['left'], $y); |
|
| 90 |
+ } |
|
| 91 |
+ |
|
| 92 |
+ // Start clipping. |
|
| 93 |
+ $this->StartTransform(); |
|
| 94 |
+ |
|
| 95 |
+ if (!strlen($y)) |
|
| 96 |
+ {
|
|
| 97 |
+ $x = $x+$margins['left']; |
|
| 98 |
+ $y = $y+$margins['top']; |
|
| 99 |
+ $this->SetXY($x, $y); |
|
| 100 |
+ } else {
|
|
| 101 |
+ $x = $x+$margins['left']; |
|
| 102 |
+ $this->SetX($x); |
|
| 103 |
+ } |
|
| 104 |
+ |
|
| 105 |
+ if (!$height) |
|
| 106 |
+ {
|
|
| 107 |
+ $pdf2 = clone $this; |
|
| 108 |
+ $pdf2->setPrintHeader(false); |
|
| 109 |
+ $pdf2->setPrintFooter(false); |
|
| 110 |
+ $pdf2->AddPage(); |
|
| 111 |
+ $pdf2->Cell($width, $height, $textval, 0, false, $align); |
|
| 112 |
+ $height = $pdf2->GetY(); |
|
| 113 |
+ unset($pdf2); |
|
| 114 |
+ } |
|
| 115 |
+ |
|
| 116 |
+ // Draw clipping rectangle to match cell. |
|
| 117 |
+ $this->Rect($x, $y, $width, $height, 'CNZ'); |
|
| 118 |
+ |
|
| 119 |
+ $this->Cell($width, $height, $textval, 0, false, $align); |
|
| 120 |
+ |
|
| 121 |
+ // Stop clipping. |
|
| 122 |
+ $this->StopTransform(); |
|
| 123 |
+ } |
|
| 124 |
+ |
|
| 125 |
+ public function lbr($fltNo=1) |
|
| 126 |
+ {
|
|
| 127 |
+ $this->SetY($this->GetY()+(($this->getFontSize()*$this->getCellHeightRatio())*floatval($fltNo))); |
|
| 128 |
+ } |
|
| 129 |
+ |
|
| 130 |
+ public function CreateHTMLBox($htmlVal, $x = 0, $y = 0, $width = 0, $height = 0, $fontsize = PDF_FONT_SIZE_MAIN, $fontstyle = '', $align = 'L', $font = PDF_FONT_NAME_MAIN) |
|
| 131 |
+ {
|
|
| 132 |
+ $margins = $this->getMargins(); |
|
| 133 |
+ $this->SetFont($font, $fontstyle, $fontsize); |
|
| 134 |
+ |
|
| 135 |
+ // Start clipping. |
|
| 136 |
+ $this->StartTransform(); |
|
| 137 |
+ |
|
| 138 |
+ if (!strlen($y)) |
|
| 139 |
+ {
|
|
| 140 |
+ $x = $x+$margins['left']; |
|
| 141 |
+ $y = $y+$margins['top']; |
|
| 142 |
+ } else {
|
|
| 143 |
+ $x = $x+$margins['left']; |
|
| 144 |
+ } |
|
| 145 |
+ |
|
| 146 |
+ if (!$height) |
|
| 147 |
+ {
|
|
| 148 |
+ $pdf2 = clone $this; |
|
| 149 |
+ $pdf2->setPrintHeader(false); |
|
| 150 |
+ $pdf2->setPrintFooter(false); |
|
| 151 |
+ $pdf2->AddPage(); |
|
| 152 |
+ $pdf2->writeHTMLCell($width, $height, 0, 0, $htmlVal, 0, 1, false, true, $align); |
|
| 153 |
+ $height = $pdf2->GetY(); |
|
| 154 |
+ unset($pdf2); |
|
| 155 |
+ } |
|
| 156 |
+ |
|
| 157 |
+ // Draw clipping rectangle to match html cell. |
|
| 158 |
+ $this->Rect($x, $y, $width, $height, 'CNZ'); |
|
| 159 |
+ |
|
| 160 |
+ // Output html. |
|
| 161 |
+ $this->writeHTMLCell($width, $height, $x, $y, $htmlVal, 0, 0, false, true, $align); |
|
| 162 |
+ |
|
| 163 |
+ // Stop clipping. |
|
| 164 |
+ $this->StopTransform(); |
|
| 165 |
+ } |
|
| 166 |
+ |
|
| 167 |
+ |
|
| 168 |
+ public function CreateCell($w, $h = 0, $txt = '', $ln = 0, $fontsize = PDF_FONT_SIZE_MAIN, $fontstyle = '', $align = 'L', $font = PDF_FONT_NAME_MAIN) |
|
| 169 |
+ {
|
|
| 170 |
+ $margins = $this->getMargins(); |
|
| 171 |
+ $currFontsize = $this->getFontSize(); |
|
| 172 |
+ $currFontfamily = $this->getFontFamily(); |
|
| 173 |
+ $currFontstyle = $this->getFontStyle(); |
|
| 174 |
+ |
|
| 175 |
+ $x = $this->GetX(); |
|
| 176 |
+ $y = $this->GetY(); |
|
| 177 |
+ |
|
| 178 |
+ $this->SetFont($font, $fontstyle, $fontsize); |
|
| 179 |
+ |
|
| 180 |
+ // Start clipping. |
|
| 181 |
+ $this->StartTransform(); |
|
| 182 |
+ |
|
| 183 |
+ if (!$h) |
|
| 184 |
+ {
|
|
| 185 |
+ $h = ($this->getFontSize()*$this->getCellHeightRatio()); |
|
| 186 |
+ } |
|
| 187 |
+ |
|
| 188 |
+ // Draw clipping rectangle to match html cell. |
|
| 189 |
+ $this->Rect($x, $y, $w, $h, 'CNZ'); |
|
| 190 |
+ |
|
| 191 |
+ $this->Cell($w,$h,$txt,0,$ln,$align); |
|
| 192 |
+ $this->SetFont($currFontfamily, $currFontstyle, $currFontsize); |
|
| 193 |
+ |
|
| 194 |
+ // Stop clipping. |
|
| 195 |
+ $this->StopTransform(); |
|
| 196 |
+ |
|
| 197 |
+ if (!$ln) |
|
| 198 |
+ {
|
|
| 199 |
+ $this->SetY($this->GetY()); |
|
| 200 |
+ } |
|
| 201 |
+ } |
|
| 202 |
+ |
|
| 203 |
+ public function CreateMultiCell($w, $h = 0, $txt = '', $ln = 0, $fontsize = PDF_FONT_SIZE_MAIN, $fontstyle = '', $align = 'L', $font = PDF_FONT_NAME_MAIN) |
|
| 204 |
+ {
|
|
| 205 |
+ $currFontsize = $this->getFontSize(); |
|
| 206 |
+ $currFontfamily = $this->getFontFamily(); |
|
| 207 |
+ $currFontstyle = $this->getFontStyle(); |
|
| 208 |
+ |
|
| 209 |
+ $this->SetFont($font, $fontstyle, $fontsize); |
|
| 210 |
+ |
|
| 211 |
+ if (!$h) |
|
| 212 |
+ {
|
|
| 213 |
+ $pdf2 = clone $this; |
|
| 214 |
+ $pdf2->setPrintHeader(false); |
|
| 215 |
+ $pdf2->setPrintFooter(false); |
|
| 216 |
+ $pdf2->AddPage(); |
|
| 217 |
+ $pdf2->MultiCell($w,$h,$txt,0,$align,false,1,0,0); |
|
| 218 |
+ $h = $pdf2->GetY(); |
|
| 219 |
+ unset($pdf2); |
|
| 220 |
+ } |
|
| 221 |
+ |
|
| 222 |
+ $this->MultiCell($w,$h,$txt,0,$align,false,$ln); |
|
| 223 |
+ if (!$ln) |
|
| 224 |
+ {
|
|
| 225 |
+ $this->SetY($this->GetY()+$h-($this->getFontSize()*$this->getCellHeightRatio())); |
|
| 226 |
+ } |
|
| 227 |
+// $this->SetFont($currFontfamily, $currFontstyle, $currFontsize); |
|
| 228 |
+ } |
|
| 229 |
+} |
|
| 0 | 230 |
\ No newline at end of file |