Passed
Push — main ( 829487...427f06 )
by Stefan
02:23
created
XFPDFExample.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -13,16 +13,16 @@
 block discarded – undo
13 13
 
14 14
 $date = time();
15 15
 for ($iRow=1; $iRow <= 100; $iRow++) {
16
-	// just a simple demo - most cases data comes from DB-query ;-)
17
-	$row = array(
18
-		'text' => 'Text in var Col, Line ' . $iRow,
19
-	    'weight' => (rand(10, 500) / 10),
20
-	    'date' => date('Y-m-d', $date),
21
-	    'price' => (rand(10, 2000) / 9),
22
-	    'grp_id' => rand(1, 4)
23
-	);
24
-	$pdf->Row($row);
25
-	$date += 24 * 60 * 60;
16
+    // just a simple demo - most cases data comes from DB-query ;-)
17
+    $row = array(
18
+        'text' => 'Text in var Col, Line ' . $iRow,
19
+        'weight' => (rand(10, 500) / 10),
20
+        'date' => date('Y-m-d', $date),
21
+        'price' => (rand(10, 2000) / 9),
22
+        'grp_id' => rand(1, 4)
23
+    );
24
+    $pdf->Row($row);
25
+    $date += 24 * 60 * 60;
26 26
 }
27 27
 // ...and end of the grid
28 28
 $pdf->EndGrid();
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,13 +6,13 @@
 block discarded – undo
6 6
 
7 7
 // set some file information
8 8
 $pdf->SetInfo('XFPDF', 'Example', 'PHP classes', 'Keyword1, Keyword2, ...');
9
-$pdf->SetPageHeader( 'Create PDF Table', 'using extpdf package from PHPClasses.org');
9
+$pdf->SetPageHeader('Create PDF Table', 'using extpdf package from PHPClasses.org');
10 10
 
11 11
 // prepare grid and just insert a bulk of lines
12 12
 $pdf->Prepare();
13 13
 
14 14
 $date = time();
15
-for ($iRow=1; $iRow <= 100; $iRow++) {
15
+for ($iRow = 1; $iRow <= 100; $iRow++) {
16 16
 	// just a simple demo - most cases data comes from DB-query ;-)
17 17
 	$row = array(
18 18
 		'text' => 'Text in var Col, Line ' . $iRow,
Please login to merge, or discard this patch.
SKien/XFPDF/XPDFFont.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -17,23 +17,23 @@
 block discarded – undo
17 17
  */
18 18
 class XPDFFont
19 19
 {
20
-	/** @var string fontname	 */
21
-	public string $strFontname;
22
-	/** @var int size	 */
23
-	public int $iSize;
24
-	/** @var string style	 */
25
-	public string $strStyle;
20
+    /** @var string fontname	 */
21
+    public string $strFontname;
22
+    /** @var int size	 */
23
+    public int $iSize;
24
+    /** @var string style	 */
25
+    public string $strStyle;
26 26
 	
27
-	/**
28
-	 * Creates a Font-object
29
-	 * @param string $strFontname
30
-	 * @param string $strStyle		'B', 'I' or 'BI'
31
-	 * @param int $iSize
32
-	 */
33
-	function __construct(string $strFontname, string $strStyle, int $iSize)
34
-	{
35
-		$this->strFontname = $strFontname;
36
-		$this->strStyle = $strStyle;
37
-		$this->iSize = $iSize;
38
-	}
27
+    /**
28
+     * Creates a Font-object
29
+     * @param string $strFontname
30
+     * @param string $strStyle		'B', 'I' or 'BI'
31
+     * @param int $iSize
32
+     */
33
+    function __construct(string $strFontname, string $strStyle, int $iSize)
34
+    {
35
+        $this->strFontname = $strFontname;
36
+        $this->strStyle = $strStyle;
37
+        $this->iSize = $iSize;
38
+    }
39 39
 }
Please login to merge, or discard this patch.
XFPDFExample.class.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
      * define table columns
23 23
      * @param string $orientation
24 24
      */
25
-    public function __construct(string $orientation='P') 
25
+    public function __construct(string $orientation = 'P') 
26 26
     {
27 27
         // first call parent constructor for general initialization
28 28
         parent::__construct($orientation);
@@ -46,14 +46,14 @@  discard block
 block discarded – undo
46 46
         $this->setPageFooter("Page: {PN}/{NP}\tAuthor: S.Kien\t{D} {T}");
47 47
         
48 48
         // now we define the columns of our report
49
-        $this->addCol('Row',            10, 'R', XPDF::COL_ROW_NR,     XPDF::FLAG_TOTALS_TEXT);
50
-        $this->addCol('Date',           35, 'C', 'date',               XPDF::FLAG_DATE);
51
-        $this->addCol('Text',           -1, 'L', 'text');
52
-        $this->addCol('Grp.',           12, 'C', self::MY_GRP_COL);
53
-        $this->addCol('Weight',         20, 'R', 'weight',             XPDF::FLAG_TOTALS_CALC | XPDF::FLAG_NUMBER);
54
-        $iImgCol = $this->addCol(-1,     8, 'C', self::MY_IMAGE_COL,   XPDF::FLAG_IMAGE | XPDF::FLAG_TOTALS_EMPTY);
55
-        $this->addCol('Price',          25, 'R', 'price',              XPDF::FLAG_TOTALS_CALC | XPDF::FLAG_CUR_SYMBOL);
56
-        $this->addCol('Cost per kg',    25, 'R', self::MY_CALC_COL,    XPDF::FLAG_TOTALS_EMPTY);
49
+        $this->addCol('Row', 10, 'R', XPDF::COL_ROW_NR, XPDF::FLAG_TOTALS_TEXT);
50
+        $this->addCol('Date', 35, 'C', 'date', XPDF::FLAG_DATE);
51
+        $this->addCol('Text', -1, 'L', 'text');
52
+        $this->addCol('Grp.', 12, 'C', self::MY_GRP_COL);
53
+        $this->addCol('Weight', 20, 'R', 'weight', XPDF::FLAG_TOTALS_CALC | XPDF::FLAG_NUMBER);
54
+        $iImgCol = $this->addCol(-1, 8, 'C', self::MY_IMAGE_COL, XPDF::FLAG_IMAGE | XPDF::FLAG_TOTALS_EMPTY);
55
+        $this->addCol('Price', 25, 'R', 'price', XPDF::FLAG_TOTALS_CALC | XPDF::FLAG_CUR_SYMBOL);
56
+        $this->addCol('Cost per kg', 25, 'R', self::MY_CALC_COL, XPDF::FLAG_TOTALS_EMPTY);
57 57
         
58 58
         // enable the totals/pagetotals and carry-over functionality
59 59
         $this->enableTotals(XPDF::TOTALS | XPDF::PAGE_TOTALS | XPDF::CARRY_OVER);
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
         $this->setNumberFormat(1, '', ' kg');
68 68
         
69 69
         // and set meassuring for the image col
70
-        $this->setColImageInfo($iImgCol, 1.5, 2.5, 3 );
70
+        $this->setColImageInfo($iImgCol, 1.5, 2.5, 3);
71 71
     }
72 72
     
73 73
     /**
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
         $strCol = '';
89 89
         switch ($iCol) {
90 90
             case self::MY_GRP_COL:
91
-                $aValues = array( '', 'Grp. A', 'Grp. B', 'Grp. C', 'Grp. D');
91
+                $aValues = array('', 'Grp. A', 'Grp. B', 'Grp. C', 'Grp. D');
92 92
                 if ($row['grp_id'] > 0 && $row['grp_id'] <= 4) {
93 93
                     $strCol = $aValues[$row['grp_id']];
94 94
                 }
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
             case self::MY_CALC_COL:
110 110
                 $fltPricePerKg = 0.0;
111 111
                 if (floatval($row['weight']) != 0) {
112
-                    $fltPricePerKg = floatval($row['price']) / floatval($row['weight']);;
112
+                    $fltPricePerKg = floatval($row['price']) / floatval($row['weight']); ;
113 113
                 }
114 114
                 $strCol = $this->formatCurrency($fltPricePerKg, true);
115 115
                 break;
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
         // for grouping
140 140
         $date = strtotime($row['date']);
141 141
         $strMonth = date('Y-m', $date);
142
-        if ( $this->strMonth != $strMonth) {
142
+        if ($this->strMonth != $strMonth) {
143 143
             // first row we have no subtotals...
144 144
             if ($this->strMonth != '') {
145 145
                 $this->endGroup();
Please login to merge, or discard this patch.
SKien/XFPDF/XPDF.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -634,7 +634,7 @@  discard block
 block discarded – undo
634 634
      * @see XPDF::InitGrid()
635 635
      * @param int $iTotals  combination of 
636 636
      */
637
-    public function enableTotals(int $iTotals=self::TOTALS) : void
637
+    public function enableTotals(int $iTotals = self::TOTALS) : void
638 638
     {
639 639
         $this->bCalcTotals = ($iTotals & self::TOTALS) != 0;
640 640
         $this->bPageTotals = ($iTotals & self::PAGE_TOTALS) != 0;
@@ -829,7 +829,7 @@  discard block
 block discarded – undo
829 829
      */
830 830
     public function selectDrawColor(string $strColor) : void
831 831
     {
832
-        $r=0; $g=0; $b=0;
832
+        $r = 0; $g = 0; $b = 0;
833 833
         $this->getRGB($strColor, $r, $g, $b);
834 834
         $this->setDrawColor($r, $g, $b);
835 835
     }
@@ -1385,7 +1385,7 @@  discard block
 block discarded – undo
1385 1385
         // Restore line width
1386 1386
         if ($this->LineWidth != $a['lw']) {
1387 1387
             $this->LineWidth = $a['lw'];
1388
-            $this->out(sprintf( '%.2F w', $a['lw'] * $this->k));
1388
+            $this->out(sprintf('%.2F w', $a['lw'] * $this->k));
1389 1389
         }
1390 1390
         // Restore font
1391 1391
         if (($a['family'] != $this->FontFamily) ||
Please login to merge, or discard this patch.
OPlathey/FPDF/FPDF.php 2 patches
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 * http://www.fpdf.org/en/doc/index.php
25 25
 *******************************************************************************/
26 26
 
27
-define('FPDF_VERSION','1.82');
27
+define('FPDF_VERSION', '1.82');
28 28
 
29 29
 class FPDF
30 30
 {
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
      *                              or an array containing the width and the height (expressed in the unit given by unit). <br/>
174 174
      *                              Default value is 'A4'.
175 175
      */
176
-    public function __construct(string $orientation='P', string $unit='mm', $size='A4')
176
+    public function __construct(string $orientation = 'P', string $unit = 'mm', $size = 'A4')
177 177
     {
178 178
         // Some checks
179 179
         $this->doChecks();
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
      * @param float $top    Top margin.
249 249
      * @param float $right  Right margin. Default value is the left one.
250 250
      */
251
-    public function setMargins(float $left, float $top, ?float $right=null) : void
251
+    public function setMargins(float $left, float $top, ?float $right = null) : void
252 252
     {
253 253
         // Set left, top and right margins
254 254
         $this->lMargin = $left;
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
         // Set auto page break mode and triggering margin
310 310
         $this->AutoPageBreak = $auto;
311 311
         $this->bMargin = $margin;
312
-        $this->PageBreakTrigger = $this->h-$margin;
312
+        $this->PageBreakTrigger = $this->h - $margin;
313 313
     }
314 314
 
315 315
     /**
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
      *                              <li> 'defaul't: uses viewer default mode </li></ul>
341 341
      *                              Default value is default. 
342 342
      */
343
-    public function setDisplayMode($zoom, string $layout='default') : void
343
+    public function setDisplayMode($zoom, string $layout = 'default') : void
344 344
     {
345 345
         // Set display mode in viewer
346 346
         if ($zoom == 'fullpage' || $zoom == 'fullwidth' || $zoom == 'real' || $zoom == 'default' || !is_string($zoom)) {
@@ -679,7 +679,7 @@  discard block
 block discarded – undo
679 679
     public function getStringWidth(string $s) : float
680 680
     {
681 681
         // Get width of a string in the current font
682
-        $s = (string)$s;
682
+        $s = (string) $s;
683 683
         $cw = &$this->CurrentFont['cw'];
684 684
         $w = 0;
685 685
         $l = strlen($s);
@@ -741,9 +741,9 @@  discard block
 block discarded – undo
741 741
     public function rect(float $x, float $y, float $w, float $h, string $style = '') : void
742 742
     {
743 743
         // Draw a rectangle
744
-        if ($style=='F') {
744
+        if ($style == 'F') {
745 745
             $op = 'f';
746
-        } elseif ($style == 'FD' || $style=='DF') {
746
+        } elseif ($style == 'FD' || $style == 'DF') {
747 747
             $op = 'B';
748 748
         } else {
749 749
             $op = 'S';
@@ -783,7 +783,7 @@  discard block
 block discarded – undo
783 783
         if ($style == 'IB') {
784 784
             $style = 'BI';
785 785
         }
786
-        $fontkey = $family.$style;
786
+        $fontkey = $family . $style;
787 787
         if (isset($this->fonts[$fontkey])) {
788 788
             return;
789 789
         }
@@ -846,7 +846,7 @@  discard block
 block discarded – undo
846 846
         $style = strtoupper($style);
847 847
         if (strpos($style, 'U') !== false) {
848 848
             $this->underline = true;
849
-            $style = str_replace('U','',$style);
849
+            $style = str_replace('U', '', $style);
850 850
         } else {
851 851
             $this->underline = false;
852 852
         }
@@ -861,10 +861,10 @@  discard block
 block discarded – undo
861 861
             return;
862 862
         }
863 863
         // Test if font is already loaded
864
-        $fontkey = $family.$style;
864
+        $fontkey = $family . $style;
865 865
         if (!isset($this->fonts[$fontkey])) {
866 866
             // Test if one of the core fonts
867
-            if( $this->isCoreFont($family)) {
867
+            if ($this->isCoreFont($family)) {
868 868
                 if ($family == 'symbol' || $family == 'zapfdingbats') {
869 869
                     $style = '';
870 870
                 }
@@ -880,10 +880,10 @@  discard block
 block discarded – undo
880 880
         $this->FontFamily = $family;
881 881
         $this->FontStyle = $style;
882 882
         $this->FontSizePt = $size;
883
-        $this->FontSize = $size/$this->k;
883
+        $this->FontSize = $size / $this->k;
884 884
         $this->CurrentFont = &$this->fonts[$fontkey];
885
-        if($this->page > 0) {
886
-            $this->out(sprintf('BT /F%d %.2F Tf ET',$this->CurrentFont['i'],$this->FontSizePt));
885
+        if ($this->page > 0) {
886
+            $this->out(sprintf('BT /F%d %.2F Tf ET', $this->CurrentFont['i'], $this->FontSizePt));
887 887
         }
888 888
     }
889 889
     
@@ -1165,7 +1165,7 @@  discard block
 block discarded – undo
1165 1165
      *                          If set to true, current FillColor is used for the background. <br/>
1166 1166
      *                          Default value: false.
1167 1167
      */
1168
-    public function multiCell(float $w, float $h, string $txt, $border=0, string $align='J', bool $fill=false) : void
1168
+    public function multiCell(float $w, float $h, string $txt, $border = 0, string $align = 'J', bool $fill = false) : void
1169 1169
     {
1170 1170
         // Output text with automatic or explicit line breaks
1171 1171
         if (!isset($this->CurrentFont)) {
@@ -1178,7 +1178,7 @@  discard block
 block discarded – undo
1178 1178
         $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->FontSize;
1179 1179
         $s = str_replace("\r", '', $txt);
1180 1180
         $nb = strlen($s);
1181
-        if ($nb > 0 && $s[$nb-1] == "\n") {
1181
+        if ($nb > 0 && $s[$nb - 1] == "\n") {
1182 1182
             $nb--;
1183 1183
         }
1184 1184
         $b = 0;
@@ -1196,7 +1196,7 @@  discard block
 block discarded – undo
1196 1196
                 if (strpos($border, 'R') !== false) {
1197 1197
                     $b2 .= 'R';
1198 1198
                 }
1199
-                $b = (strpos($border,'T') !== false) ? $b2.'T' : $b2;
1199
+                $b = (strpos($border, 'T') !== false) ? $b2 . 'T' : $b2;
1200 1200
             }
1201 1201
         }
1202 1202
         $sep = -1;
@@ -1243,7 +1243,7 @@  discard block
 block discarded – undo
1243 1243
                         $this->ws = 0;
1244 1244
                         $this->out('0 Tw');
1245 1245
                     }
1246
-                    $this->cell($w, $h, substr($s, $j, $i-$j), $b, 2, $align, $fill);
1246
+                    $this->cell($w, $h, substr($s, $j, $i - $j), $b, 2, $align, $fill);
1247 1247
                 } else {
1248 1248
                     if ($align == 'J') {
1249 1249
                         $this->ws = ($ns > 1) ? ($wmax - $ls) / 1000 * $this->FontSize / ($ns - 1) : 0;
@@ -1326,8 +1326,8 @@  discard block
 block discarded – undo
1326 1326
             $l += $cw[$c];
1327 1327
             if ($l > $wmax) {
1328 1328
                 // Automatic line break
1329
-                if($sep == -1) {
1330
-                    if($this->x > $this->lMargin) {
1329
+                if ($sep == -1) {
1330
+                    if ($this->x > $this->lMargin) {
1331 1331
                         // Move to next line
1332 1332
                         $this->x = $this->lMargin;
1333 1333
                         $this->y += $h;
@@ -1446,7 +1446,7 @@  discard block
 block discarded – undo
1446 1446
                 $type = substr($file, $pos + 1);
1447 1447
             }
1448 1448
             $type = strtolower($type);
1449
-            if($type=='jpeg') {
1449
+            if ($type == 'jpeg') {
1450 1450
                 $type = 'jpg';
1451 1451
             }
1452 1452
             $mtd = 'parse' . ucfirst($type);
@@ -1496,7 +1496,7 @@  discard block
 block discarded – undo
1496 1496
         }
1497 1497
         $this->out(sprintf('q %.2F 0 0 %.2F %.2F %.2F cm /I%d Do Q', $w * $this->k, $h * $this->k, $x * $this->k, ($this->h - ($y + $h)) * $this->k, $info['i']));
1498 1498
         if ($link) {
1499
-            $this->link($x,$y,$w,$h,$link);
1499
+            $this->link($x, $y, $w, $h, $link);
1500 1500
         }
1501 1501
     }
1502 1502
     
@@ -1508,7 +1508,7 @@  discard block
 block discarded – undo
1508 1508
      * @param int $level
1509 1509
      * @param int $y
1510 1510
      */
1511
-    public function bookmark(string $txt, bool $isUTF8=false, int $level=0, int $y=0) : void
1511
+    public function bookmark(string $txt, bool $isUTF8 = false, int $level = 0, int $y = 0) : void
1512 1512
     {
1513 1513
         if (!$isUTF8) {
1514 1514
             $txt = utf8_encode($txt);
@@ -1586,7 +1586,7 @@  discard block
 block discarded – undo
1586 1586
         if ($y >= 0) {
1587 1587
             $this->y = $y;
1588 1588
         } else {
1589
-            $this->y = $this->h+$y;
1589
+            $this->y = $this->h + $y;
1590 1590
         }
1591 1591
         if ($resetX) {
1592 1592
             $this->x = $this->lMargin;
@@ -1801,7 +1801,7 @@  discard block
 block discarded – undo
1801 1801
             $this->CurOrientation = $orientation;
1802 1802
             $this->CurPageSize = $size;
1803 1803
         }
1804
-        if($orientation != $this->DefOrientation || $size[0] != $this->DefPageSize[0] || $size[1] != $this->DefPageSize[1]) {
1804
+        if ($orientation != $this->DefOrientation || $size[0] != $this->DefPageSize[0] || $size[1] != $this->DefPageSize[1]) {
1805 1805
             $this->PageInfo[$this->page]['size'] = array($this->wPt, $this->hPt);
1806 1806
         }
1807 1807
         if ($rotation != 0) {
@@ -1935,7 +1935,7 @@  discard block
 block discarded – undo
1935 1935
             strpos($s, ')') !== false || 
1936 1936
             strpos($s, '\\') !== false || 
1937 1937
             strpos($s, "\r") !== false) {
1938
-            $s = str_replace(array('\\','(',')',"\r"), array('\\\\','\\(','\\)','\\r'), $s);
1938
+            $s = str_replace(array('\\', '(', ')', "\r"), array('\\\\', '\\(', '\\)', '\\r'), $s);
1939 1939
         }
1940 1940
         return $s;
1941 1941
     }
@@ -1966,7 +1966,7 @@  discard block
 block discarded – undo
1966 1966
         // Underline text
1967 1967
         $up = $this->CurrentFont['up'];
1968 1968
         $ut = $this->CurrentFont['ut'];
1969
-        $w = $this->getStringWidth($txt) + $this->ws * substr_count($txt,' ');
1969
+        $w = $this->getStringWidth($txt) + $this->ws * substr_count($txt, ' ');
1970 1970
         return sprintf('%.2F %.2F %.2F %.2F re f', $x * $this->k, ($this->h - ($y - $up / 1000 * $this->FontSize)) * $this->k, $w * $this->k, -$ut / 1000 * $this->FontSizePt);
1971 1971
     }
1972 1972
     
@@ -2095,7 +2095,7 @@  discard block
 block discarded – undo
2095 2095
                         $trns = array($pos);
2096 2096
                     }
2097 2097
                 }
2098
-                $this->readStream($f,4);
2098
+                $this->readStream($f, 4);
2099 2099
             } elseif ($type == 'IDAT') {
2100 2100
                 // Read image data block
2101 2101
                 $data .= $this->readStream($f, $n);
@@ -2133,7 +2133,7 @@  discard block
 block discarded – undo
2133 2133
             $alpha = '';
2134 2134
             if ($ct == 4) {
2135 2135
                 // Gray image
2136
-                $len = 2*$w;
2136
+                $len = 2 * $w;
2137 2137
                 for ($i = 0; $i < $h; $i++) {
2138 2138
                     $pos = (1 + $len) * $i;
2139 2139
                     $color .= $data[$pos];
@@ -2290,7 +2290,7 @@  discard block
 block discarded – undo
2290 2290
      * Begin a new object.
2291 2291
      * @param int $n
2292 2292
      */
2293
-    protected function newObject(?int $n=null) : void
2293
+    protected function newObject(?int $n = null) : void
2294 2294
     {
2295 2295
         // Begin a new object
2296 2296
         if ($n === null) {
@@ -2375,7 +2375,7 @@  discard block
 block discarded – undo
2375 2375
             $this->put(sprintf('/MediaBox [0 0 %.2F %.2F]', $this->PageInfo[$n]['size'][0], $this->PageInfo[$n]['size'][1]));
2376 2376
         }
2377 2377
         if (isset($this->PageInfo[$n]['rotation'])) {
2378
-            $this->put('/Rotate '.$this->PageInfo[$n]['rotation']);
2378
+            $this->put('/Rotate ' . $this->PageInfo[$n]['rotation']);
2379 2379
         }
2380 2380
         $this->put('/Resources 2 0 R');
2381 2381
         if (isset($this->PageLinks[$n])) {
@@ -2391,12 +2391,12 @@  discard block
 block discarded – undo
2391 2391
                     if (isset($this->PageInfo[$l[0]]['size'])) {
2392 2392
                         $h = $this->PageInfo[$l[0]]['size'][1];
2393 2393
                     } else {
2394
-                        $h = ($this->DefOrientation=='P') ? $this->DefPageSize[1] * $this->k : $this->DefPageSize[0] * $this->k;
2394
+                        $h = ($this->DefOrientation == 'P') ? $this->DefPageSize[1] * $this->k : $this->DefPageSize[0] * $this->k;
2395 2395
                     }
2396 2396
                     $annots .= sprintf('/Dest [%d 0 R /XYZ 0 %.2F null]>>', $this->PageInfo[$l[0]]['n'], $h - $l[1] * $this->k);
2397 2397
                 }
2398 2398
             }
2399
-            $this->put($annots.']');
2399
+            $this->put($annots . ']');
2400 2400
         }
2401 2401
         if ($this->WithAlpha) {
2402 2402
             $this->put('/Group <</Type /Group /S /Transparency /CS /DeviceRGB>>');
@@ -2433,7 +2433,7 @@  discard block
 block discarded – undo
2433 2433
             }
2434 2434
             $this->put('/Length1 ' . $info['length1']);
2435 2435
             if (isset($info['length2'])) {
2436
-                $this->put('/Length2 '.$info['length2'].' /Length3 0');
2436
+                $this->put('/Length2 ' . $info['length2'] . ' /Length3 0');
2437 2437
             }
2438 2438
             $this->put('>>');
2439 2439
             $this->putStream($font);
@@ -2470,7 +2470,7 @@  discard block
 block discarded – undo
2470 2470
             if ($font['subsetted']) {
2471 2471
                 $name = 'AAAAAA+' . $name;
2472 2472
             }
2473
-            if ($type=='Core') {
2473
+            if ($type == 'Core') {
2474 2474
                 // Core font
2475 2475
                 $this->newObject();
2476 2476
                 $this->put('<</Type /Font');
@@ -2588,7 +2588,7 @@  discard block
 block discarded – undo
2588 2588
      */
2589 2589
     protected function putImages() : void
2590 2590
     {
2591
-        foreach(array_keys($this->images) as $file) {
2591
+        foreach (array_keys($this->images) as $file) {
2592 2592
             $this->putImage($this->images[$file]);
2593 2593
             unset($this->images[$file]['data']);
2594 2594
             unset($this->images[$file]['smask']);
@@ -2611,7 +2611,7 @@  discard block
 block discarded – undo
2611 2611
             $this->put('/ColorSpace [/Indexed /DeviceRGB ' . (strlen($info['pal']) / 3 - 1) . ' ' . ($this->n + 1) . ' 0 R]');
2612 2612
         } else {
2613 2613
             $this->put('/ColorSpace /' . $info['cs']);
2614
-            if($info['cs']=='DeviceCMYK') {
2614
+            if ($info['cs'] == 'DeviceCMYK') {
2615 2615
                 $this->put('/Decode [1 0 1 0 1 0 1 0]');
2616 2616
             }
2617 2617
         }
@@ -2622,7 +2622,7 @@  discard block
 block discarded – undo
2622 2622
         if (isset($info['dp'])) {
2623 2623
             $this->put('/DecodeParms <<' . $info['dp'] . '>>');
2624 2624
         }
2625
-        if (isset($info['trns']) && is_array($info['trns']))    {
2625
+        if (isset($info['trns']) && is_array($info['trns'])) {
2626 2626
             $trns = '';
2627 2627
             $cnt = count($info['trns']);
2628 2628
             for ($i = 0; $i < $cnt; $i++) {
@@ -2631,7 +2631,7 @@  discard block
 block discarded – undo
2631 2631
             $this->put('/Mask [' . $trns . ']');
2632 2632
         }
2633 2633
         if (isset($info['smask'])) {
2634
-            $this->put('/SMask ' . ($this->n+1) . ' 0 R');
2634
+            $this->put('/SMask ' . ($this->n + 1) . ' 0 R');
2635 2635
         }
2636 2636
         $this->put('/Length ' . strlen($info['data']) . '>>');
2637 2637
         $this->putStream($info['data']);
@@ -2712,13 +2712,13 @@  discard block
 block discarded – undo
2712 2712
     protected function putBookmarks() : void
2713 2713
     {
2714 2714
         $nb = count($this->outlines);
2715
-        if( $nb==0 ) {
2715
+        if ($nb == 0) {
2716 2716
             return;
2717 2717
         }
2718 2718
         $lru = array();
2719 2719
         $level = 0;
2720 2720
         foreach ($this->outlines as $i => $o) {
2721
-            if ($o['l']>0) {
2721
+            if ($o['l'] > 0) {
2722 2722
                 $parent = $lru[$o['l'] - 1];
2723 2723
                 // Set parent and last pointers
2724 2724
                 $this->outlines[$i]['parent'] = $parent;
@@ -2740,7 +2740,7 @@  discard block
 block discarded – undo
2740 2740
                 $level = $o['l'];
2741 2741
         }
2742 2742
         // Outline items
2743
-        $n = $this->n+1;
2743
+        $n = $this->n + 1;
2744 2744
         foreach ($this->outlines as $i=>$o) {
2745 2745
             $this->newObject();
2746 2746
             $this->put('<</Title ' . $this->textString($o['t']));
@@ -2765,7 +2765,7 @@  discard block
 block discarded – undo
2765 2765
         $this->newObject();
2766 2766
         $this->outlineRoot = $this->n;
2767 2767
         $this->put('<</Type /Outlines /First ' . $n . ' 0 R');
2768
-        $this->put('/Last ' . ($n+$lru[0]) . ' 0 R>>');
2768
+        $this->put('/Last ' . ($n + $lru[0]) . ' 0 R>>');
2769 2769
         $this->put('endobj');
2770 2770
     }
2771 2771
     
@@ -2799,24 +2799,24 @@  discard block
 block discarded – undo
2799 2799
         $n = $this->PageInfo[1]['n'];
2800 2800
         $this->put('/Type /Catalog');
2801 2801
         $this->put('/Pages 1 0 R');
2802
-        if($this->ZoomMode=='fullpage') {
2802
+        if ($this->ZoomMode == 'fullpage') {
2803 2803
             $this->put('/OpenAction [' . $n . ' 0 R /Fit]');
2804
-        } elseif ($this->ZoomMode=='fullwidth') {
2804
+        } elseif ($this->ZoomMode == 'fullwidth') {
2805 2805
             $this->put('/OpenAction [' . $n . ' 0 R /FitH null]');
2806
-        } elseif($this->ZoomMode=='real') {
2806
+        } elseif ($this->ZoomMode == 'real') {
2807 2807
             $this->put('/OpenAction [' . $n . ' 0 R /XYZ null null 1]');
2808
-        } elseif(!is_string($this->ZoomMode)) {
2808
+        } elseif (!is_string($this->ZoomMode)) {
2809 2809
             $this->put('/OpenAction [' . $n . ' 0 R /XYZ null null ' . sprintf('%.2F', $this->ZoomMode / 100) . ']');
2810 2810
         }
2811
-        if($this->LayoutMode=='single') {
2811
+        if ($this->LayoutMode == 'single') {
2812 2812
             $this->put('/PageLayout /SinglePage');
2813
-        } elseif($this->LayoutMode=='continuous') {
2813
+        } elseif ($this->LayoutMode == 'continuous') {
2814 2814
             $this->put('/PageLayout /OneColumn');
2815
-        } elseif($this->LayoutMode=='two') {
2815
+        } elseif ($this->LayoutMode == 'two') {
2816 2816
             $this->put('/PageLayout /TwoColumnLeft');
2817 2817
         }
2818 2818
         if (count($this->outlines) > 0) {
2819
-            $this->put('/Outlines ' . $this->outlineRoot.' 0 R');
2819
+            $this->put('/Outlines ' . $this->outlineRoot . ' 0 R');
2820 2820
             $this->put('/PageMode /UseOutlines');
2821 2821
         }
2822 2822
         
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2727,9 +2727,9 @@
 block discarded – undo
2727 2727
                     // Level increasing: set first pointer
2728 2728
                     $this->outlines[$parent]['first'] = $i;
2729 2729
                 }
2730
+            } else {
2731
+                            $this->outlines[$i]['parent'] = $nb;
2730 2732
             }
2731
-            else
2732
-                $this->outlines[$i]['parent'] = $nb;
2733 2733
                 if ($o['l'] <= $level && $i > 0) {
2734 2734
                     // Set prev and next pointers
2735 2735
                     $prev = $lru[$o['l']];
Please login to merge, or discard this patch.