@@ -292,7 +292,7 @@ |
||
| 292 | 292 | |
| 293 | 293 | /** |
| 294 | 294 | * Returns the image object. |
| 295 | - * @return object image. |
|
| 295 | + * @return resource image. |
|
| 296 | 296 | * @author Nicola Asuni |
| 297 | 297 | * @since 1.5.2 |
| 298 | 298 | */ |
@@ -346,9 +346,9 @@ |
||
| 346 | 346 | * @param int $xPos Horiziontal position. |
| 347 | 347 | * @param int $yPos Vertical position. |
| 348 | 348 | * @param int $xSize Horizontal size. |
| 349 | - * @param int $xSize Vertical size. |
|
| 350 | - * @return bool trur in case of success, false otherwise. |
|
| 351 | - * @access protected |
|
| 349 | + * @param int $xSize Vertical size. |
|
| 350 | + * @return bool trur in case of success, false otherwise. |
|
| 351 | + * @access protected |
|
| 352 | 352 | */ |
| 353 | 353 | function DrawSingleBar($xPos, $yPos, $xSize, $ySize) { |
| 354 | 354 | if ($xPos>=0 && $xPos<=$this->mWidth && ($xPos+$xSize)<=$this->mWidth && |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | * @param int $Height Image height in pixels. |
| 274 | 274 | * @param int $Style Barcode style. |
| 275 | 275 | */ |
| 276 | - function BarcodeObject($Width=BCD_DEFAULT_WIDTH, $Height=BCD_DEFAULT_HEIGHT, $Style=BCD_DEFAULT_STYLE) { |
|
| 276 | + function BarcodeObject($Width = BCD_DEFAULT_WIDTH, $Height = BCD_DEFAULT_HEIGHT, $Style = BCD_DEFAULT_STYLE) { |
|
| 277 | 277 | $this->mWidth = $Width; |
| 278 | 278 | $this->mHeight = $Height; |
| 279 | 279 | $this->mStyle = $Style; |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | * Abstract method used to draw the barcode image. |
| 305 | 305 | * @param int $xres Horizontal resolution. |
| 306 | 306 | */ |
| 307 | - function DrawObject($xres) { |
|
| 307 | + function DrawObject($xres) { |
|
| 308 | 308 | /* there is not implementation neded, is simply the asbsract function. */ |
| 309 | 309 | return false; |
| 310 | 310 | } |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | * @access protected |
| 315 | 315 | */ |
| 316 | 316 | function DrawBorder() { |
| 317 | - ImageRectangle($this->mImg, 0, 0, $this->mWidth-1, $this->mHeight-1, $this->mBrush); |
|
| 317 | + ImageRectangle($this->mImg, 0, 0, $this->mWidth - 1, $this->mHeight - 1, $this->mBrush); |
|
| 318 | 318 | } |
| 319 | 319 | |
| 320 | 320 | /** |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | * @access protected |
| 327 | 327 | */ |
| 328 | 328 | function DrawChar($Font, $xPos, $yPos, $Char) { |
| 329 | - ImageString($this->mImg,$Font,$xPos,$yPos,$Char,$this->mBrush); |
|
| 329 | + ImageString($this->mImg, $Font, $xPos, $yPos, $Char, $this->mBrush); |
|
| 330 | 330 | } |
| 331 | 331 | |
| 332 | 332 | /** |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | * @access protected |
| 339 | 339 | */ |
| 340 | 340 | function DrawText($Font, $xPos, $yPos, $Char) { |
| 341 | - ImageString($this->mImg,$Font,$xPos,$yPos,$Char,$this->mBrush); |
|
| 341 | + ImageString($this->mImg, $Font, $xPos, $yPos, $Char, $this->mBrush); |
|
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | /** |
@@ -351,10 +351,10 @@ discard block |
||
| 351 | 351 | * @access protected |
| 352 | 352 | */ |
| 353 | 353 | function DrawSingleBar($xPos, $yPos, $xSize, $ySize) { |
| 354 | - if ($xPos>=0 && $xPos<=$this->mWidth && ($xPos+$xSize)<=$this->mWidth && |
|
| 355 | - $yPos>=0 && $yPos<=$this->mHeight && ($yPos+$ySize)<=$this->mHeight) { |
|
| 356 | - for ($i=0;$i<$xSize;$i++) { |
|
| 357 | - ImageLine($this->mImg, $xPos+$i, $yPos, $xPos+$i, $yPos+$ySize, $this->mBrush); |
|
| 354 | + if ($xPos >= 0 && $xPos <= $this->mWidth && ($xPos + $xSize) <= $this->mWidth && |
|
| 355 | + $yPos >= 0 && $yPos <= $this->mHeight && ($yPos + $ySize) <= $this->mHeight) { |
|
| 356 | + for ($i = 0; $i < $xSize; $i++) { |
|
| 357 | + ImageLine($this->mImg, $xPos + $i, $yPos, $xPos + $i, $yPos + $ySize, $this->mBrush); |
|
| 358 | 358 | } |
| 359 | 359 | return true; |
| 360 | 360 | } |
@@ -407,7 +407,7 @@ discard block |
||
| 407 | 407 | * Set barcode style. |
| 408 | 408 | * @param int $Style barcode style. |
| 409 | 409 | */ |
| 410 | - function SetStyle ($Style) { |
|
| 410 | + function SetStyle($Style) { |
|
| 411 | 411 | $this->mStyle = $Style; |
| 412 | 412 | } |
| 413 | 413 | |
@@ -176,7 +176,7 @@ |
||
| 176 | 176 | |
| 177 | 177 | /** |
| 178 | 178 | * Returns the character index. |
| 179 | - * @param char $char character. |
|
| 179 | + * @param string $char character. |
|
| 180 | 180 | * @return int character index or -1 in case of error. |
| 181 | 181 | * @access private |
| 182 | 182 | */ |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | function C128CObject($Width, $Height, $Style, $Value) { |
| 59 | 59 | $this->BarcodeObject($Width, $Height, $Style); |
| 60 | 60 | $this->mValue = $Value; |
| 61 | - $this->mChars = array ( |
|
| 61 | + $this->mChars = array( |
|
| 62 | 62 | "00", "01", "02", "03", "04", "05", "06", "07", "08", "09", |
| 63 | 63 | "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", |
| 64 | 64 | "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", |
@@ -70,107 +70,107 @@ discard block |
||
| 70 | 70 | "80", "81", "82", "83", "84", "85", "86", "87", "88", "89", |
| 71 | 71 | "90", "91", "92", "93", "94", "95", "96", "97", "98", "99", |
| 72 | 72 | ); |
| 73 | - $this->mCharSet = array ( |
|
| 74 | - "212222", /* 00 */ |
|
| 75 | - "222122", /* 01 */ |
|
| 76 | - "222221", /* 02 */ |
|
| 77 | - "121223", /* 03 */ |
|
| 78 | - "121322", /* 04 */ |
|
| 79 | - "131222", /* 05 */ |
|
| 80 | - "122213", /* 06 */ |
|
| 81 | - "122312", /* 07 */ |
|
| 82 | - "132212", /* 08 */ |
|
| 83 | - "221213", /* 09 */ |
|
| 84 | - "221312", /* 10 */ |
|
| 85 | - "231212", /* 11 */ |
|
| 86 | - "112232", /* 12 */ |
|
| 87 | - "122132", /* 13 */ |
|
| 88 | - "122231", /* 14 */ |
|
| 89 | - "113222", /* 15 */ |
|
| 90 | - "123122", /* 16 */ |
|
| 91 | - "123221", /* 17 */ |
|
| 92 | - "223211", /* 18 */ |
|
| 93 | - "221132", /* 19 */ |
|
| 94 | - "221231", /* 20 */ |
|
| 95 | - "213212", /* 21 */ |
|
| 96 | - "223112", /* 22 */ |
|
| 97 | - "312131", /* 23 */ |
|
| 98 | - "311222", /* 24 */ |
|
| 99 | - "321122", /* 25 */ |
|
| 100 | - "321221", /* 26 */ |
|
| 101 | - "312212", /* 27 */ |
|
| 102 | - "322112", /* 28 */ |
|
| 103 | - "322211", /* 29 */ |
|
| 104 | - "212123", /* 30 */ |
|
| 105 | - "212321", /* 31 */ |
|
| 106 | - "232121", /* 32 */ |
|
| 107 | - "111323", /* 33 */ |
|
| 108 | - "131123", /* 34 */ |
|
| 109 | - "131321", /* 35 */ |
|
| 110 | - "112313", /* 36 */ |
|
| 111 | - "132113", /* 37 */ |
|
| 112 | - "132311", /* 38 */ |
|
| 113 | - "211313", /* 39 */ |
|
| 114 | - "231113", /* 40 */ |
|
| 115 | - "231311", /* 41 */ |
|
| 116 | - "112133", /* 42 */ |
|
| 117 | - "112331", /* 43 */ |
|
| 118 | - "132131", /* 44 */ |
|
| 119 | - "113123", /* 45 */ |
|
| 120 | - "113321", /* 46 */ |
|
| 121 | - "133121", /* 47 */ |
|
| 122 | - "313121", /* 48 */ |
|
| 123 | - "211331", /* 49 */ |
|
| 124 | - "231131", /* 50 */ |
|
| 125 | - "213113", /* 51 */ |
|
| 126 | - "213311", /* 52 */ |
|
| 127 | - "213131", /* 53 */ |
|
| 128 | - "311123", /* 54 */ |
|
| 129 | - "311321", /* 55 */ |
|
| 130 | - "331121", /* 56 */ |
|
| 131 | - "312113", /* 57 */ |
|
| 132 | - "312311", /* 58 */ |
|
| 133 | - "332111", /* 59 */ |
|
| 134 | - "314111", /* 60 */ |
|
| 135 | - "221411", /* 61 */ |
|
| 136 | - "431111", /* 62 */ |
|
| 137 | - "111224", /* 63 */ |
|
| 138 | - "111422", /* 64 */ |
|
| 139 | - "121124", /* 65 */ |
|
| 140 | - "121421", /* 66 */ |
|
| 141 | - "141122", /* 67 */ |
|
| 142 | - "141221", /* 68 */ |
|
| 143 | - "112214", /* 69 */ |
|
| 144 | - "112412", /* 70 */ |
|
| 145 | - "122114", /* 71 */ |
|
| 146 | - "122411", /* 72 */ |
|
| 147 | - "142112", /* 73 */ |
|
| 148 | - "142211", /* 74 */ |
|
| 149 | - "241211", /* 75 */ |
|
| 150 | - "221114", /* 76 */ |
|
| 151 | - "413111", /* 77 */ |
|
| 152 | - "241112", /* 78 */ |
|
| 153 | - "134111", /* 79 */ |
|
| 154 | - "111242", /* 80 */ |
|
| 155 | - "121142", /* 81 */ |
|
| 156 | - "121241", /* 82 */ |
|
| 157 | - "114212", /* 83 */ |
|
| 158 | - "124112", /* 84 */ |
|
| 159 | - "124211", /* 85 */ |
|
| 160 | - "411212", /* 86 */ |
|
| 161 | - "421112", /* 87 */ |
|
| 162 | - "421211", /* 88 */ |
|
| 163 | - "212141", /* 89 */ |
|
| 164 | - "214121", /* 90 */ |
|
| 165 | - "412121", /* 91 */ |
|
| 166 | - "111143", /* 92 */ |
|
| 167 | - "111341", /* 93 */ |
|
| 168 | - "131141", /* 94 */ |
|
| 169 | - "114113", /* 95 */ |
|
| 170 | - "114311", /* 96 */ |
|
| 171 | - "411113", /* 97 */ |
|
| 172 | - "411311", /* 98 */ |
|
| 173 | - "113141", /* 99 */ |
|
| 73 | + $this->mCharSet = array( |
|
| 74 | + "212222", /* 00 */ |
|
| 75 | + "222122", /* 01 */ |
|
| 76 | + "222221", /* 02 */ |
|
| 77 | + "121223", /* 03 */ |
|
| 78 | + "121322", /* 04 */ |
|
| 79 | + "131222", /* 05 */ |
|
| 80 | + "122213", /* 06 */ |
|
| 81 | + "122312", /* 07 */ |
|
| 82 | + "132212", /* 08 */ |
|
| 83 | + "221213", /* 09 */ |
|
| 84 | + "221312", /* 10 */ |
|
| 85 | + "231212", /* 11 */ |
|
| 86 | + "112232", /* 12 */ |
|
| 87 | + "122132", /* 13 */ |
|
| 88 | + "122231", /* 14 */ |
|
| 89 | + "113222", /* 15 */ |
|
| 90 | + "123122", /* 16 */ |
|
| 91 | + "123221", /* 17 */ |
|
| 92 | + "223211", /* 18 */ |
|
| 93 | + "221132", /* 19 */ |
|
| 94 | + "221231", /* 20 */ |
|
| 95 | + "213212", /* 21 */ |
|
| 96 | + "223112", /* 22 */ |
|
| 97 | + "312131", /* 23 */ |
|
| 98 | + "311222", /* 24 */ |
|
| 99 | + "321122", /* 25 */ |
|
| 100 | + "321221", /* 26 */ |
|
| 101 | + "312212", /* 27 */ |
|
| 102 | + "322112", /* 28 */ |
|
| 103 | + "322211", /* 29 */ |
|
| 104 | + "212123", /* 30 */ |
|
| 105 | + "212321", /* 31 */ |
|
| 106 | + "232121", /* 32 */ |
|
| 107 | + "111323", /* 33 */ |
|
| 108 | + "131123", /* 34 */ |
|
| 109 | + "131321", /* 35 */ |
|
| 110 | + "112313", /* 36 */ |
|
| 111 | + "132113", /* 37 */ |
|
| 112 | + "132311", /* 38 */ |
|
| 113 | + "211313", /* 39 */ |
|
| 114 | + "231113", /* 40 */ |
|
| 115 | + "231311", /* 41 */ |
|
| 116 | + "112133", /* 42 */ |
|
| 117 | + "112331", /* 43 */ |
|
| 118 | + "132131", /* 44 */ |
|
| 119 | + "113123", /* 45 */ |
|
| 120 | + "113321", /* 46 */ |
|
| 121 | + "133121", /* 47 */ |
|
| 122 | + "313121", /* 48 */ |
|
| 123 | + "211331", /* 49 */ |
|
| 124 | + "231131", /* 50 */ |
|
| 125 | + "213113", /* 51 */ |
|
| 126 | + "213311", /* 52 */ |
|
| 127 | + "213131", /* 53 */ |
|
| 128 | + "311123", /* 54 */ |
|
| 129 | + "311321", /* 55 */ |
|
| 130 | + "331121", /* 56 */ |
|
| 131 | + "312113", /* 57 */ |
|
| 132 | + "312311", /* 58 */ |
|
| 133 | + "332111", /* 59 */ |
|
| 134 | + "314111", /* 60 */ |
|
| 135 | + "221411", /* 61 */ |
|
| 136 | + "431111", /* 62 */ |
|
| 137 | + "111224", /* 63 */ |
|
| 138 | + "111422", /* 64 */ |
|
| 139 | + "121124", /* 65 */ |
|
| 140 | + "121421", /* 66 */ |
|
| 141 | + "141122", /* 67 */ |
|
| 142 | + "141221", /* 68 */ |
|
| 143 | + "112214", /* 69 */ |
|
| 144 | + "112412", /* 70 */ |
|
| 145 | + "122114", /* 71 */ |
|
| 146 | + "122411", /* 72 */ |
|
| 147 | + "142112", /* 73 */ |
|
| 148 | + "142211", /* 74 */ |
|
| 149 | + "241211", /* 75 */ |
|
| 150 | + "221114", /* 76 */ |
|
| 151 | + "413111", /* 77 */ |
|
| 152 | + "241112", /* 78 */ |
|
| 153 | + "134111", /* 79 */ |
|
| 154 | + "111242", /* 80 */ |
|
| 155 | + "121142", /* 81 */ |
|
| 156 | + "121241", /* 82 */ |
|
| 157 | + "114212", /* 83 */ |
|
| 158 | + "124112", /* 84 */ |
|
| 159 | + "124211", /* 85 */ |
|
| 160 | + "411212", /* 86 */ |
|
| 161 | + "421112", /* 87 */ |
|
| 162 | + "421211", /* 88 */ |
|
| 163 | + "212141", /* 89 */ |
|
| 164 | + "214121", /* 90 */ |
|
| 165 | + "412121", /* 91 */ |
|
| 166 | + "111143", /* 92 */ |
|
| 167 | + "111341", /* 93 */ |
|
| 168 | + "131141", /* 94 */ |
|
| 169 | + "114113", /* 95 */ |
|
| 170 | + "114311", /* 96 */ |
|
| 171 | + "411113", /* 97 */ |
|
| 172 | + "411311", /* 98 */ |
|
| 173 | + "113141", /* 99 */ |
|
| 174 | 174 | ); |
| 175 | 175 | } |
| 176 | 176 | |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | * @access private |
| 182 | 182 | */ |
| 183 | 183 | function GetCharIndex($char) { |
| 184 | - for ($i=0;$i<100;$i++) { |
|
| 184 | + for ($i = 0; $i < 100; $i++) { |
|
| 185 | 185 | if ($this->mChars[$i] == $char) { |
| 186 | 186 | return $i; |
| 187 | 187 | } |
@@ -230,26 +230,26 @@ discard block |
||
| 230 | 230 | function GetSize($xres) { |
| 231 | 231 | $len = strlen($this->mValue); |
| 232 | 232 | |
| 233 | - if ($len == 0) { |
|
| 233 | + if ($len == 0) { |
|
| 234 | 234 | $this->mError = "Null value"; |
| 235 | 235 | return false; |
| 236 | 236 | } |
| 237 | 237 | $ret = 0; |
| 238 | 238 | |
| 239 | - for ($i=0;$i<$len;$i++) { |
|
| 240 | - if ((ord($this->mValue[$i])<48) || (ord($this->mValue[$i])>57)) { |
|
| 239 | + for ($i = 0; $i < $len; $i++) { |
|
| 240 | + if ((ord($this->mValue[$i]) < 48) || (ord($this->mValue[$i]) > 57)) { |
|
| 241 | 241 | $this->mError = "Code-128C is numeric only"; |
| 242 | 242 | return false; |
| 243 | 243 | } |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | - if (($len%2) != 0) { |
|
| 246 | + if (($len % 2) != 0) { |
|
| 247 | 247 | $this->mError = "The length of barcode value must be even. You must pad the number with zeros."; |
| 248 | 248 | return false; |
| 249 | 249 | } |
| 250 | 250 | |
| 251 | - for ($i=0;$i<$len;$i+=2) { |
|
| 252 | - $id = $this->GetCharIndex($this->mValue[$i].$this->mValue[$i+1]); |
|
| 251 | + for ($i = 0; $i < $len; $i += 2) { |
|
| 252 | + $id = $this->GetCharIndex($this->mValue[$i].$this->mValue[$i + 1]); |
|
| 253 | 253 | $cset = $this->mCharSet[$id]; |
| 254 | 254 | $ret += $this->GetBarSize($xres, $cset[0]); |
| 255 | 255 | $ret += $this->GetBarSize($xres, $cset[1]); |
@@ -261,12 +261,12 @@ discard block |
||
| 261 | 261 | /* length of Check character */ |
| 262 | 262 | $cset = $this->GetCheckCharValue(); |
| 263 | 263 | $CheckSize = 0; |
| 264 | - for ($i=0;$i<6;$i++) { |
|
| 264 | + for ($i = 0; $i < 6; $i++) { |
|
| 265 | 265 | $CheckSize += $this->GetBarSize($cset[$i], $xres); |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | - $StartSize = 2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres; |
|
| 269 | - $StopSize = 2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + 2*BCD_C128_BAR_3*$xres; |
|
| 268 | + $StartSize = 2 * BCD_C128_BAR_2 * $xres + 3 * BCD_C128_BAR_1 * $xres + BCD_C128_BAR_4 * $xres; |
|
| 269 | + $StopSize = 2 * BCD_C128_BAR_2 * $xres + 3 * BCD_C128_BAR_1 * $xres + 2 * BCD_C128_BAR_3 * $xres; |
|
| 270 | 270 | return $StartSize + $ret + $CheckSize + $StopSize; |
| 271 | 271 | } |
| 272 | 272 | |
@@ -279,11 +279,11 @@ discard block |
||
| 279 | 279 | $len = strlen($this->mValue); |
| 280 | 280 | $sum = 105; // 'C' type; |
| 281 | 281 | $m = 0; |
| 282 | - for ($i=0;$i<$len;$i+=2) { |
|
| 282 | + for ($i = 0; $i < $len; $i += 2) { |
|
| 283 | 283 | $m++; |
| 284 | - $sum += $this->GetCharIndex($this->mValue[$i].$this->mValue[$i+1]) * $m; |
|
| 284 | + $sum += $this->GetCharIndex($this->mValue[$i].$this->mValue[$i + 1]) * $m; |
|
| 285 | 285 | } |
| 286 | - $check = $sum % 103; |
|
| 286 | + $check = $sum % 103; |
|
| 287 | 287 | return $this->mCharSet[$check]; |
| 288 | 288 | } |
| 289 | 289 | |
@@ -298,13 +298,13 @@ discard block |
||
| 298 | 298 | */ |
| 299 | 299 | function DrawStart($DrawPos, $yPos, $ySize, $xres) { |
| 300 | 300 | /* Start code is '211232' */ |
| 301 | - $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres) , $ySize); |
|
| 301 | + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres), $ySize); |
|
| 302 | 302 | $DrawPos += $this->GetBarSize('2', $xres); |
| 303 | 303 | $DrawPos += $this->GetBarSize('1', $xres); |
| 304 | - $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('1', $xres) , $ySize); |
|
| 304 | + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('1', $xres), $ySize); |
|
| 305 | 305 | $DrawPos += $this->GetBarSize('1', $xres); |
| 306 | 306 | $DrawPos += $this->GetBarSize('2', $xres); |
| 307 | - $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('3', $xres) , $ySize); |
|
| 307 | + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('3', $xres), $ySize); |
|
| 308 | 308 | $DrawPos += $this->GetBarSize('3', $xres); |
| 309 | 309 | $DrawPos += $this->GetBarSize('2', $xres); |
| 310 | 310 | return $DrawPos; |
@@ -321,16 +321,16 @@ discard block |
||
| 321 | 321 | */ |
| 322 | 322 | function DrawStop($DrawPos, $yPos, $ySize, $xres) { |
| 323 | 323 | /* Stop code is '2331112' */ |
| 324 | - $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres) , $ySize); |
|
| 324 | + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres), $ySize); |
|
| 325 | 325 | $DrawPos += $this->GetBarSize('2', $xres); |
| 326 | 326 | $DrawPos += $this->GetBarSize('3', $xres); |
| 327 | - $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('3', $xres) , $ySize); |
|
| 327 | + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('3', $xres), $ySize); |
|
| 328 | 328 | $DrawPos += $this->GetBarSize('3', $xres); |
| 329 | 329 | $DrawPos += $this->GetBarSize('1', $xres); |
| 330 | - $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('1', $xres) , $ySize); |
|
| 330 | + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('1', $xres), $ySize); |
|
| 331 | 331 | $DrawPos += $this->GetBarSize('1', $xres); |
| 332 | 332 | $DrawPos += $this->GetBarSize('1', $xres); |
| 333 | - $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres) , $ySize); |
|
| 333 | + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres), $ySize); |
|
| 334 | 334 | $DrawPos += $this->GetBarSize('2', $xres); |
| 335 | 335 | return $DrawPos; |
| 336 | 336 | } |
@@ -346,13 +346,13 @@ discard block |
||
| 346 | 346 | */ |
| 347 | 347 | function DrawCheckChar($DrawPos, $yPos, $ySize, $xres) { |
| 348 | 348 | $cset = $this->GetCheckCharValue(); |
| 349 | - $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[0], $xres) , $ySize); |
|
| 349 | + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[0], $xres), $ySize); |
|
| 350 | 350 | $DrawPos += $this->GetBarSize($cset[0], $xres); |
| 351 | 351 | $DrawPos += $this->GetBarSize($cset[1], $xres); |
| 352 | - $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[2], $xres) , $ySize); |
|
| 352 | + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[2], $xres), $ySize); |
|
| 353 | 353 | $DrawPos += $this->GetBarSize($cset[2], $xres); |
| 354 | 354 | $DrawPos += $this->GetBarSize($cset[3], $xres); |
| 355 | - $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[4], $xres) , $ySize); |
|
| 355 | + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[4], $xres), $ySize); |
|
| 356 | 356 | $DrawPos += $this->GetBarSize($cset[4], $xres); |
| 357 | 357 | $DrawPos += $this->GetBarSize($cset[5], $xres); |
| 358 | 358 | return $DrawPos; |
@@ -365,11 +365,11 @@ discard block |
||
| 365 | 365 | */ |
| 366 | 366 | function DrawObject($xres) { |
| 367 | 367 | $len = strlen($this->mValue); |
| 368 | - if (($size = $this->GetSize($xres))==0) { |
|
| 368 | + if (($size = $this->GetSize($xres)) == 0) { |
|
| 369 | 369 | return false; |
| 370 | 370 | } |
| 371 | 371 | |
| 372 | - if ($this->mStyle & BCS_ALIGN_CENTER) $sPos = (integer)(($this->mWidth - $size ) / 2); |
|
| 372 | + if ($this->mStyle & BCS_ALIGN_CENTER) $sPos = (integer)(($this->mWidth - $size) / 2); |
|
| 373 | 373 | else if ($this->mStyle & BCS_ALIGN_RIGHT) $sPos = $this->mWidth - $size; |
| 374 | 374 | else $sPos = 0; |
| 375 | 375 | |
@@ -380,35 +380,35 @@ discard block |
||
| 380 | 380 | /* Draw text */ |
| 381 | 381 | if ($this->mStyle & BCS_DRAW_TEXT) { |
| 382 | 382 | if ($this->mStyle & BCS_STRETCH_TEXT) { |
| 383 | - for ($i=0;$i<$len;$i++) { |
|
| 384 | - $this->DrawChar($this->mFont, $sPos+(2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres)+($size/$len)*$i, |
|
| 383 | + for ($i = 0; $i < $len; $i++) { |
|
| 384 | + $this->DrawChar($this->mFont, $sPos + (2 * BCD_C128_BAR_2 * $xres + 3 * BCD_C128_BAR_1 * $xres + BCD_C128_BAR_4 * $xres) + ($size / $len) * $i, |
|
| 385 | 385 | $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET, $this->mValue[$i]); |
| 386 | 386 | } |
| 387 | 387 | } else {/* Center */ |
| 388 | 388 | $text_width = $this->GetFontWidth($this->mFont) * strlen($this->mValue); |
| 389 | - $this->DrawText($this->mFont, $sPos+(($size-$text_width)/2)+(2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres), |
|
| 389 | + $this->DrawText($this->mFont, $sPos + (($size - $text_width) / 2) + (2 * BCD_C128_BAR_2 * $xres + 3 * BCD_C128_BAR_1 * $xres + BCD_C128_BAR_4 * $xres), |
|
| 390 | 390 | $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET, $this->mValue); |
| 391 | 391 | } |
| 392 | 392 | } |
| 393 | 393 | |
| 394 | 394 | $cPos = 0; |
| 395 | - $DrawPos = $this->DrawStart($sPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres); |
|
| 395 | + $DrawPos = $this->DrawStart($sPos, BCD_DEFAULT_MAR_Y1, $ysize, $xres); |
|
| 396 | 396 | do { |
| 397 | - $c = $this->GetCharIndex($this->mValue[$cPos].$this->mValue[$cPos+1]); |
|
| 397 | + $c = $this->GetCharIndex($this->mValue[$cPos].$this->mValue[$cPos + 1]); |
|
| 398 | 398 | $cset = $this->mCharSet[$c]; |
| 399 | - $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[0], $xres) , $ysize); |
|
| 399 | + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[0], $xres), $ysize); |
|
| 400 | 400 | $DrawPos += $this->GetBarSize($cset[0], $xres); |
| 401 | 401 | $DrawPos += $this->GetBarSize($cset[1], $xres); |
| 402 | - $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[2], $xres) , $ysize); |
|
| 402 | + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[2], $xres), $ysize); |
|
| 403 | 403 | $DrawPos += $this->GetBarSize($cset[2], $xres); |
| 404 | 404 | $DrawPos += $this->GetBarSize($cset[3], $xres); |
| 405 | - $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[4], $xres) , $ysize); |
|
| 405 | + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[4], $xres), $ysize); |
|
| 406 | 406 | $DrawPos += $this->GetBarSize($cset[4], $xres); |
| 407 | 407 | $DrawPos += $this->GetBarSize($cset[5], $xres); |
| 408 | 408 | $cPos += 2; |
| 409 | - } while ($cPos<$len); |
|
| 410 | - $DrawPos = $this->DrawCheckChar($DrawPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres); |
|
| 411 | - $DrawPos = $this->DrawStop($DrawPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres); |
|
| 409 | + } while ($cPos < $len); |
|
| 410 | + $DrawPos = $this->DrawCheckChar($DrawPos, BCD_DEFAULT_MAR_Y1, $ysize, $xres); |
|
| 411 | + $DrawPos = $this->DrawStop($DrawPos, BCD_DEFAULT_MAR_Y1, $ysize, $xres); |
|
| 412 | 412 | return true; |
| 413 | 413 | } |
| 414 | 414 | } |
@@ -349,13 +349,20 @@ |
||
| 349 | 349 | return false; |
| 350 | 350 | } |
| 351 | 351 | |
| 352 | - if ($this->mStyle & BCS_ALIGN_CENTER) $sPos = (integer)(($this->mWidth - $size ) / 2); |
|
| 353 | - else if ($this->mStyle & BCS_ALIGN_RIGHT) $sPos = $this->mWidth - $size; |
|
| 354 | - else $sPos = 0; |
|
| 352 | + if ($this->mStyle & BCS_ALIGN_CENTER) { |
|
| 353 | + $sPos = (integer)(($this->mWidth - $size ) / 2); |
|
| 354 | + } else if ($this->mStyle & BCS_ALIGN_RIGHT) { |
|
| 355 | + $sPos = $this->mWidth - $size; |
|
| 356 | + } else { |
|
| 357 | + $sPos = 0; |
|
| 358 | + } |
|
| 355 | 359 | |
| 356 | 360 | /* Total height of bar code -Bars only- */ |
| 357 | - if ($this->mStyle & BCS_DRAW_TEXT) $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2 - $this->GetFontHeight($this->mFont); |
|
| 358 | - else $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2; |
|
| 361 | + if ($this->mStyle & BCS_DRAW_TEXT) { |
|
| 362 | + $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2 - $this->GetFontHeight($this->mFont); |
|
| 363 | + } else { |
|
| 364 | + $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2; |
|
| 365 | + } |
|
| 359 | 366 | |
| 360 | 367 | /* Draw text */ |
| 361 | 368 | if ($this->mStyle & BCS_DRAW_TEXT) { |
@@ -5,6 +5,9 @@ discard block |
||
| 5 | 5 | * Date: 2004-12-31 * |
| 6 | 6 | *******************************************************************************/ |
| 7 | 7 | |
| 8 | +/** |
|
| 9 | + * @param string $enc |
|
| 10 | + */ |
|
| 8 | 11 | function ReadMap($enc) |
| 9 | 12 | { |
| 10 | 13 | //Read a map file |
@@ -132,6 +135,9 @@ discard block |
||
| 132 | 135 | return $fm; |
| 133 | 136 | } |
| 134 | 137 | |
| 138 | +/** |
|
| 139 | + * @param boolean $symbolic |
|
| 140 | + */ |
|
| 135 | 141 | function MakeFontDescriptor($fm,$symbolic) |
| 136 | 142 | { |
| 137 | 143 | //Ascent |
@@ -227,6 +233,10 @@ discard block |
||
| 227 | 233 | return rtrim($s); |
| 228 | 234 | } |
| 229 | 235 | |
| 236 | +/** |
|
| 237 | + * @param string $file |
|
| 238 | + * @param string $s |
|
| 239 | + */ |
|
| 230 | 240 | function SaveToFile($file,$s,$mode='t') |
| 231 | 241 | { |
| 232 | 242 | $f=fopen($file,'w'.$mode); |
@@ -5,6 +5,9 @@ discard block |
||
| 5 | 5 | * Date: 2003-12-30 * |
| 6 | 6 | *******************************************************************************/ |
| 7 | 7 | |
| 8 | +/** |
|
| 9 | + * @param string $cidtogidmap |
|
| 10 | + */ |
|
| 8 | 11 | function ReadUFM($file, &$cidtogidmap) |
| 9 | 12 | { |
| 10 | 13 | //Prepare empty CIDToGIDMap |
@@ -143,6 +146,10 @@ discard block |
||
| 143 | 146 | return $s; |
| 144 | 147 | } |
| 145 | 148 | |
| 149 | +/** |
|
| 150 | + * @param string $file |
|
| 151 | + * @param string $s |
|
| 152 | + */ |
|
| 146 | 153 | function SaveToFile($file,$s,$mode='t') |
| 147 | 154 | { |
| 148 | 155 | $f=fopen($file,'w'.$mode); |
@@ -13,66 +13,66 @@ discard block |
||
| 13 | 13 | //Read a font metric file |
| 14 | 14 | $a=file($file); |
| 15 | 15 | if(empty($a)) |
| 16 | - die('File not found'); |
|
| 16 | + die('File not found'); |
|
| 17 | 17 | $widths=array(); |
| 18 | 18 | $fm=array(); |
| 19 | 19 | foreach($a as $l) |
| 20 | 20 | { |
| 21 | - $e=explode(' ',chop($l)); |
|
| 22 | - if(count($e)<2) |
|
| 23 | - continue; |
|
| 24 | - $code=$e[0]; |
|
| 25 | - $param=$e[1]; |
|
| 26 | - if($code=='U') |
|
| 27 | - { |
|
| 28 | - // U 827 ; WX 0 ; N squaresubnosp ; G 675 ; |
|
| 29 | - //Character metrics |
|
| 30 | - $cc=(int)$e[1]; |
|
| 31 | - if ($cc != -1) { |
|
| 32 | - $gn = $e[7]; |
|
| 33 | - $w = $e[4]; |
|
| 34 | - $glyph = $e[10]; |
|
| 35 | - $widths[$cc] = $w; |
|
| 36 | - if($cc == ord('X')) |
|
| 37 | - $fm['CapXHeight'] = $e[13]; |
|
| 21 | + $e=explode(' ',chop($l)); |
|
| 22 | + if(count($e)<2) |
|
| 23 | + continue; |
|
| 24 | + $code=$e[0]; |
|
| 25 | + $param=$e[1]; |
|
| 26 | + if($code=='U') |
|
| 27 | + { |
|
| 28 | + // U 827 ; WX 0 ; N squaresubnosp ; G 675 ; |
|
| 29 | + //Character metrics |
|
| 30 | + $cc=(int)$e[1]; |
|
| 31 | + if ($cc != -1) { |
|
| 32 | + $gn = $e[7]; |
|
| 33 | + $w = $e[4]; |
|
| 34 | + $glyph = $e[10]; |
|
| 35 | + $widths[$cc] = $w; |
|
| 36 | + if($cc == ord('X')) |
|
| 37 | + $fm['CapXHeight'] = $e[13]; |
|
| 38 | 38 | |
| 39 | - // Set GID |
|
| 40 | - if ($cc >= 0 && $cc < 0xFFFF && $glyph) { |
|
| 41 | - $cidtogidmap{$cc*2} = chr($glyph >> 8); |
|
| 42 | - $cidtogidmap{$cc*2 + 1} = chr($glyph & 0xFF); |
|
| 43 | - } |
|
| 44 | - } |
|
| 45 | - if($gn=='.notdef' && !isset($fm['MissingWidth'])) |
|
| 46 | - $fm['MissingWidth']=$w; |
|
| 47 | - } |
|
| 48 | - elseif($code=='FontName') |
|
| 49 | - $fm['FontName']=$param; |
|
| 50 | - elseif($code=='Weight') |
|
| 51 | - $fm['Weight']=$param; |
|
| 52 | - elseif($code=='ItalicAngle') |
|
| 53 | - $fm['ItalicAngle']=(double)$param; |
|
| 54 | - elseif($code=='Ascender') |
|
| 55 | - $fm['Ascender']=(int)$param; |
|
| 56 | - elseif($code=='Descender') |
|
| 57 | - $fm['Descender']=(int)$param; |
|
| 58 | - elseif($code=='UnderlineThickness') |
|
| 59 | - $fm['UnderlineThickness']=(int)$param; |
|
| 60 | - elseif($code=='UnderlinePosition') |
|
| 61 | - $fm['UnderlinePosition']=(int)$param; |
|
| 62 | - elseif($code=='IsFixedPitch') |
|
| 63 | - $fm['IsFixedPitch']=($param=='true'); |
|
| 64 | - elseif($code=='FontBBox') |
|
| 65 | - $fm['FontBBox']=array($e[1],$e[2],$e[3],$e[4]); |
|
| 66 | - elseif($code=='CapHeight') |
|
| 67 | - $fm['CapHeight']=(int)$param; |
|
| 68 | - elseif($code=='StdVW') |
|
| 69 | - $fm['StdVW']=(int)$param; |
|
| 39 | + // Set GID |
|
| 40 | + if ($cc >= 0 && $cc < 0xFFFF && $glyph) { |
|
| 41 | + $cidtogidmap{$cc*2} = chr($glyph >> 8); |
|
| 42 | + $cidtogidmap{$cc*2 + 1} = chr($glyph & 0xFF); |
|
| 43 | + } |
|
| 44 | + } |
|
| 45 | + if($gn=='.notdef' && !isset($fm['MissingWidth'])) |
|
| 46 | + $fm['MissingWidth']=$w; |
|
| 47 | + } |
|
| 48 | + elseif($code=='FontName') |
|
| 49 | + $fm['FontName']=$param; |
|
| 50 | + elseif($code=='Weight') |
|
| 51 | + $fm['Weight']=$param; |
|
| 52 | + elseif($code=='ItalicAngle') |
|
| 53 | + $fm['ItalicAngle']=(double)$param; |
|
| 54 | + elseif($code=='Ascender') |
|
| 55 | + $fm['Ascender']=(int)$param; |
|
| 56 | + elseif($code=='Descender') |
|
| 57 | + $fm['Descender']=(int)$param; |
|
| 58 | + elseif($code=='UnderlineThickness') |
|
| 59 | + $fm['UnderlineThickness']=(int)$param; |
|
| 60 | + elseif($code=='UnderlinePosition') |
|
| 61 | + $fm['UnderlinePosition']=(int)$param; |
|
| 62 | + elseif($code=='IsFixedPitch') |
|
| 63 | + $fm['IsFixedPitch']=($param=='true'); |
|
| 64 | + elseif($code=='FontBBox') |
|
| 65 | + $fm['FontBBox']=array($e[1],$e[2],$e[3],$e[4]); |
|
| 66 | + elseif($code=='CapHeight') |
|
| 67 | + $fm['CapHeight']=(int)$param; |
|
| 68 | + elseif($code=='StdVW') |
|
| 69 | + $fm['StdVW']=(int)$param; |
|
| 70 | 70 | } |
| 71 | 71 | if(!isset($fm['MissingWidth'])) |
| 72 | - $fm['MissingWidth']=600; |
|
| 72 | + $fm['MissingWidth']=600; |
|
| 73 | 73 | |
| 74 | 74 | if(!isset($fm['FontName'])) |
| 75 | - die('FontName not found'); |
|
| 75 | + die('FontName not found'); |
|
| 76 | 76 | |
| 77 | 77 | $fm['Widths']=$widths; |
| 78 | 78 | |
@@ -89,40 +89,40 @@ discard block |
||
| 89 | 89 | $fd.=",'Descent'=>".$desc; |
| 90 | 90 | //CapHeight |
| 91 | 91 | if(isset($fm['CapHeight'])) |
| 92 | - $ch=$fm['CapHeight']; |
|
| 92 | + $ch=$fm['CapHeight']; |
|
| 93 | 93 | elseif(isset($fm['CapXHeight'])) |
| 94 | - $ch=$fm['CapXHeight']; |
|
| 94 | + $ch=$fm['CapXHeight']; |
|
| 95 | 95 | else |
| 96 | - $ch=$asc; |
|
| 96 | + $ch=$asc; |
|
| 97 | 97 | $fd.=",'CapHeight'=>".$ch; |
| 98 | 98 | //Flags |
| 99 | 99 | $flags=0; |
| 100 | 100 | if(isset($fm['IsFixedPitch']) and $fm['IsFixedPitch']) |
| 101 | - $flags+=1<<0; |
|
| 101 | + $flags+=1<<0; |
|
| 102 | 102 | $flags+=1<<5; |
| 103 | 103 | if(isset($fm['ItalicAngle']) and $fm['ItalicAngle']!=0) |
| 104 | - $flags+=1<<6; |
|
| 104 | + $flags+=1<<6; |
|
| 105 | 105 | $fd.=",'Flags'=>".$flags; |
| 106 | 106 | //FontBBox |
| 107 | 107 | if(isset($fm['FontBBox'])) |
| 108 | - $fbb=$fm['FontBBox']; |
|
| 108 | + $fbb=$fm['FontBBox']; |
|
| 109 | 109 | else |
| 110 | - $fbb=array(0,$des-100,1000,$asc+100); |
|
| 110 | + $fbb=array(0,$des-100,1000,$asc+100); |
|
| 111 | 111 | $fd.=",'FontBBox'=>'[".$fbb[0].' '.$fbb[1].' '.$fbb[2].' '.$fbb[3]."]'"; |
| 112 | 112 | //ItalicAngle |
| 113 | 113 | $ia=(isset($fm['ItalicAngle']) ? $fm['ItalicAngle'] : 0); |
| 114 | 114 | $fd.=",'ItalicAngle'=>".$ia; |
| 115 | 115 | //StemV |
| 116 | 116 | if(isset($fm['StdVW'])) |
| 117 | - $stemv=$fm['StdVW']; |
|
| 117 | + $stemv=$fm['StdVW']; |
|
| 118 | 118 | elseif(isset($fm['Weight']) and eregi('(bold|black)',$fm['Weight'])) |
| 119 | - $stemv=120; |
|
| 119 | + $stemv=120; |
|
| 120 | 120 | else |
| 121 | - $stemv=70; |
|
| 121 | + $stemv=70; |
|
| 122 | 122 | $fd.=",'StemV'=>".$stemv; |
| 123 | 123 | //MissingWidth |
| 124 | 124 | if(isset($fm['MissingWidth'])) |
| 125 | - $fd.=",'MissingWidth'=>".$fm['MissingWidth']; |
|
| 125 | + $fd.=",'MissingWidth'=>".$fm['MissingWidth']; |
|
| 126 | 126 | $fd.=')'; |
| 127 | 127 | return $fd; |
| 128 | 128 | } |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | $c=0; |
| 137 | 137 | foreach ($cw as $i => $w) |
| 138 | 138 | { |
| 139 | - $els[] = ((($c++)%16==0)?"\n\t":'').$i.'=>'.$w; |
|
| 139 | + $els[] = ((($c++)%16==0)?"\n\t":'').$i.'=>'.$w; |
|
| 140 | 140 | } |
| 141 | 141 | $s .= implode(', ', $els); |
| 142 | 142 | $s.=')'; |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | { |
| 148 | 148 | $f=fopen($file,'w'.$mode); |
| 149 | 149 | if(!$f) |
| 150 | - die('Can\'t write to file '.$file); |
|
| 150 | + die('Can\'t write to file '.$file); |
|
| 151 | 151 | fwrite($f,$s,strlen($s)); |
| 152 | 152 | fclose($f); |
| 153 | 153 | } |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | //Check if font license allows embedding |
| 170 | 170 | $f=fopen($file,'rb'); |
| 171 | 171 | if(!$f) |
| 172 | - die('<B>Error:</B> Can\'t open '.$file); |
|
| 172 | + die('<B>Error:</B> Can\'t open '.$file); |
|
| 173 | 173 | //Extract number of tables |
| 174 | 174 | fseek($f,4,SEEK_CUR); |
| 175 | 175 | $nb=ReadShort($f); |
@@ -178,17 +178,17 @@ discard block |
||
| 178 | 178 | $found=false; |
| 179 | 179 | for($i=0;$i<$nb;$i++) |
| 180 | 180 | { |
| 181 | - if(fread($f,4)=='OS/2') |
|
| 182 | - { |
|
| 183 | - $found=true; |
|
| 184 | - break; |
|
| 185 | - } |
|
| 186 | - fseek($f,12,SEEK_CUR); |
|
| 181 | + if(fread($f,4)=='OS/2') |
|
| 182 | + { |
|
| 183 | + $found=true; |
|
| 184 | + break; |
|
| 185 | + } |
|
| 186 | + fseek($f,12,SEEK_CUR); |
|
| 187 | 187 | } |
| 188 | 188 | if(!$found) |
| 189 | 189 | { |
| 190 | - fclose($f); |
|
| 191 | - return; |
|
| 190 | + fclose($f); |
|
| 191 | + return; |
|
| 192 | 192 | } |
| 193 | 193 | fseek($f,4,SEEK_CUR); |
| 194 | 194 | $offset=ReadLong($f); |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | $e=($fsType & 0x08)!=0; |
| 202 | 202 | fclose($f); |
| 203 | 203 | if($rl and !$pp and !$e) |
| 204 | - echo '<B>Warning:</B> font license does not allow embedding'; |
|
| 204 | + echo '<B>Warning:</B> font license does not allow embedding'; |
|
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | /******************************************************************************* |
@@ -213,23 +213,23 @@ discard block |
||
| 213 | 213 | //Generate a font definition file |
| 214 | 214 | set_magic_quotes_runtime(0); |
| 215 | 215 | if(!file_exists($ufmfile)) |
| 216 | - die('<B>Error:</B> UFM file not found: '.$ufmfile); |
|
| 216 | + die('<B>Error:</B> UFM file not found: '.$ufmfile); |
|
| 217 | 217 | $cidtogidmap = ''; |
| 218 | 218 | $fm=ReadUFM($ufmfile, $cidtogidmap); |
| 219 | 219 | $fd=MakeFontDescriptor($fm); |
| 220 | 220 | //Find font type |
| 221 | 221 | if($fontfile) |
| 222 | 222 | { |
| 223 | - $ext=strtolower(substr($fontfile,-3)); |
|
| 224 | - if($ext=='ttf') |
|
| 225 | - $type='TrueTypeUnicode'; |
|
| 226 | - else |
|
| 227 | - die('<B>Error:</B> not a truetype font: '.$ext); |
|
| 223 | + $ext=strtolower(substr($fontfile,-3)); |
|
| 224 | + if($ext=='ttf') |
|
| 225 | + $type='TrueTypeUnicode'; |
|
| 226 | + else |
|
| 227 | + die('<B>Error:</B> not a truetype font: '.$ext); |
|
| 228 | 228 | } |
| 229 | 229 | else |
| 230 | 230 | { |
| 231 | - if($type!='TrueTypeUnicode') |
|
| 232 | - die('<B>Error:</B> incorrect font type: '.$type); |
|
| 231 | + if($type!='TrueTypeUnicode') |
|
| 232 | + die('<B>Error:</B> incorrect font type: '.$type); |
|
| 233 | 233 | } |
| 234 | 234 | //Start generation |
| 235 | 235 | $s='<?php'."\n"; |
@@ -237,9 +237,9 @@ discard block |
||
| 237 | 237 | $s.='$name=\''.$fm['FontName']."';\n"; |
| 238 | 238 | $s.='$desc='.$fd.";\n"; |
| 239 | 239 | if(!isset($fm['UnderlinePosition'])) |
| 240 | - $fm['UnderlinePosition']=-100; |
|
| 240 | + $fm['UnderlinePosition']=-100; |
|
| 241 | 241 | if(!isset($fm['UnderlineThickness'])) |
| 242 | - $fm['UnderlineThickness']=50; |
|
| 242 | + $fm['UnderlineThickness']=50; |
|
| 243 | 243 | $s.='$up='.$fm['UnderlinePosition'].";\n"; |
| 244 | 244 | $s.='$ut='.$fm['UnderlineThickness'].";\n"; |
| 245 | 245 | $w=MakeWidthArray($fm); |
@@ -249,51 +249,51 @@ discard block |
||
| 249 | 249 | $basename=substr(basename($ufmfile),0,-4); |
| 250 | 250 | if($fontfile) |
| 251 | 251 | { |
| 252 | - //Embedded font |
|
| 253 | - if(!file_exists($fontfile)) |
|
| 254 | - die('<B>Error:</B> font file not found: '.$fontfile); |
|
| 255 | - CheckTTF($fontfile); |
|
| 256 | - $f=fopen($fontfile,'rb'); |
|
| 257 | - if(!$f) |
|
| 258 | - die('<B>Error:</B> Can\'t open '.$fontfile); |
|
| 259 | - $file=fread($f,filesize($fontfile)); |
|
| 260 | - fclose($f); |
|
| 261 | - if(function_exists('gzcompress')) |
|
| 262 | - { |
|
| 263 | - $cmp=$basename.'.z'; |
|
| 264 | - SaveToFile($cmp,gzcompress($file),'b'); |
|
| 265 | - $s.='$file=\''.$cmp."';\n"; |
|
| 266 | - echo 'Font file compressed ('.$cmp.')<BR>'; |
|
| 252 | + //Embedded font |
|
| 253 | + if(!file_exists($fontfile)) |
|
| 254 | + die('<B>Error:</B> font file not found: '.$fontfile); |
|
| 255 | + CheckTTF($fontfile); |
|
| 256 | + $f=fopen($fontfile,'rb'); |
|
| 257 | + if(!$f) |
|
| 258 | + die('<B>Error:</B> Can\'t open '.$fontfile); |
|
| 259 | + $file=fread($f,filesize($fontfile)); |
|
| 260 | + fclose($f); |
|
| 261 | + if(function_exists('gzcompress')) |
|
| 262 | + { |
|
| 263 | + $cmp=$basename.'.z'; |
|
| 264 | + SaveToFile($cmp,gzcompress($file),'b'); |
|
| 265 | + $s.='$file=\''.$cmp."';\n"; |
|
| 266 | + echo 'Font file compressed ('.$cmp.')<BR>'; |
|
| 267 | 267 | |
| 268 | - $cmp=$basename.'.ctg.z'; |
|
| 269 | - SaveToFile($cmp,gzcompress($cidtogidmap),'b'); |
|
| 270 | - echo 'CIDToGIDMap created and compressed ('.$cmp.')<BR>'; |
|
| 271 | - $s.='$ctg=\''.$cmp."';\n"; |
|
| 272 | - } |
|
| 273 | - else |
|
| 274 | - { |
|
| 275 | - $s.='$file=\''.basename($fontfile)."';\n"; |
|
| 276 | - echo '<B>Notice:</B> font file could not be compressed (gzcompress not available)<BR>'; |
|
| 268 | + $cmp=$basename.'.ctg.z'; |
|
| 269 | + SaveToFile($cmp,gzcompress($cidtogidmap),'b'); |
|
| 270 | + echo 'CIDToGIDMap created and compressed ('.$cmp.')<BR>'; |
|
| 271 | + $s.='$ctg=\''.$cmp."';\n"; |
|
| 272 | + } |
|
| 273 | + else |
|
| 274 | + { |
|
| 275 | + $s.='$file=\''.basename($fontfile)."';\n"; |
|
| 276 | + echo '<B>Notice:</B> font file could not be compressed (gzcompress not available)<BR>'; |
|
| 277 | 277 | |
| 278 | - $cmp=$basename.'.ctg'; |
|
| 279 | - $f = fopen($cmp, 'wb'); |
|
| 280 | - fwrite($f, $cidtogidmap); |
|
| 281 | - fclose($f); |
|
| 282 | - echo 'CIDToGIDMap created ('.$cmp.')<BR>'; |
|
| 283 | - $s.='$ctg=\''.$cmp."';\n"; |
|
| 284 | - } |
|
| 285 | - if($type=='Type1') |
|
| 286 | - { |
|
| 287 | - $s.='$size1='.$size1.";\n"; |
|
| 288 | - $s.='$size2='.$size2.";\n"; |
|
| 289 | - } |
|
| 290 | - else |
|
| 291 | - $s.='$originalsize='.filesize($fontfile).";\n"; |
|
| 278 | + $cmp=$basename.'.ctg'; |
|
| 279 | + $f = fopen($cmp, 'wb'); |
|
| 280 | + fwrite($f, $cidtogidmap); |
|
| 281 | + fclose($f); |
|
| 282 | + echo 'CIDToGIDMap created ('.$cmp.')<BR>'; |
|
| 283 | + $s.='$ctg=\''.$cmp."';\n"; |
|
| 284 | + } |
|
| 285 | + if($type=='Type1') |
|
| 286 | + { |
|
| 287 | + $s.='$size1='.$size1.";\n"; |
|
| 288 | + $s.='$size2='.$size2.";\n"; |
|
| 289 | + } |
|
| 290 | + else |
|
| 291 | + $s.='$originalsize='.filesize($fontfile).";\n"; |
|
| 292 | 292 | } |
| 293 | 293 | else |
| 294 | 294 | { |
| 295 | - //Not embedded font |
|
| 296 | - $s.='$file='."'';\n"; |
|
| 295 | + //Not embedded font |
|
| 296 | + $s.='$file='."'';\n"; |
|
| 297 | 297 | } |
| 298 | 298 | $s.="?>\n"; |
| 299 | 299 | SaveToFile($basename.'.php',$s); |
@@ -8,73 +8,73 @@ discard block |
||
| 8 | 8 | function ReadUFM($file, &$cidtogidmap) |
| 9 | 9 | { |
| 10 | 10 | //Prepare empty CIDToGIDMap |
| 11 | - $cidtogidmap = str_pad('', 256*256*2, "\x00"); |
|
| 11 | + $cidtogidmap = str_pad('', 256 * 256 * 2, "\x00"); |
|
| 12 | 12 | |
| 13 | 13 | //Read a font metric file |
| 14 | - $a=file($file); |
|
| 15 | - if(empty($a)) |
|
| 14 | + $a = file($file); |
|
| 15 | + if (empty($a)) |
|
| 16 | 16 | die('File not found'); |
| 17 | - $widths=array(); |
|
| 18 | - $fm=array(); |
|
| 19 | - foreach($a as $l) |
|
| 17 | + $widths = array(); |
|
| 18 | + $fm = array(); |
|
| 19 | + foreach ($a as $l) |
|
| 20 | 20 | { |
| 21 | - $e=explode(' ',chop($l)); |
|
| 22 | - if(count($e)<2) |
|
| 21 | + $e = explode(' ', chop($l)); |
|
| 22 | + if (count($e) < 2) |
|
| 23 | 23 | continue; |
| 24 | - $code=$e[0]; |
|
| 25 | - $param=$e[1]; |
|
| 26 | - if($code=='U') |
|
| 24 | + $code = $e[0]; |
|
| 25 | + $param = $e[1]; |
|
| 26 | + if ($code == 'U') |
|
| 27 | 27 | { |
| 28 | 28 | // U 827 ; WX 0 ; N squaresubnosp ; G 675 ; |
| 29 | 29 | //Character metrics |
| 30 | - $cc=(int)$e[1]; |
|
| 30 | + $cc = (int)$e[1]; |
|
| 31 | 31 | if ($cc != -1) { |
| 32 | 32 | $gn = $e[7]; |
| 33 | 33 | $w = $e[4]; |
| 34 | 34 | $glyph = $e[10]; |
| 35 | 35 | $widths[$cc] = $w; |
| 36 | - if($cc == ord('X')) |
|
| 36 | + if ($cc == ord('X')) |
|
| 37 | 37 | $fm['CapXHeight'] = $e[13]; |
| 38 | 38 | |
| 39 | 39 | // Set GID |
| 40 | 40 | if ($cc >= 0 && $cc < 0xFFFF && $glyph) { |
| 41 | - $cidtogidmap{$cc*2} = chr($glyph >> 8); |
|
| 42 | - $cidtogidmap{$cc*2 + 1} = chr($glyph & 0xFF); |
|
| 41 | + $cidtogidmap{$cc * 2} = chr($glyph >> 8); |
|
| 42 | + $cidtogidmap{$cc * 2 + 1} = chr($glyph & 0xFF); |
|
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | - if($gn=='.notdef' && !isset($fm['MissingWidth'])) |
|
| 46 | - $fm['MissingWidth']=$w; |
|
| 45 | + if ($gn == '.notdef' && !isset($fm['MissingWidth'])) |
|
| 46 | + $fm['MissingWidth'] = $w; |
|
| 47 | 47 | } |
| 48 | - elseif($code=='FontName') |
|
| 49 | - $fm['FontName']=$param; |
|
| 50 | - elseif($code=='Weight') |
|
| 51 | - $fm['Weight']=$param; |
|
| 52 | - elseif($code=='ItalicAngle') |
|
| 53 | - $fm['ItalicAngle']=(double)$param; |
|
| 54 | - elseif($code=='Ascender') |
|
| 55 | - $fm['Ascender']=(int)$param; |
|
| 56 | - elseif($code=='Descender') |
|
| 57 | - $fm['Descender']=(int)$param; |
|
| 58 | - elseif($code=='UnderlineThickness') |
|
| 59 | - $fm['UnderlineThickness']=(int)$param; |
|
| 60 | - elseif($code=='UnderlinePosition') |
|
| 61 | - $fm['UnderlinePosition']=(int)$param; |
|
| 62 | - elseif($code=='IsFixedPitch') |
|
| 63 | - $fm['IsFixedPitch']=($param=='true'); |
|
| 64 | - elseif($code=='FontBBox') |
|
| 65 | - $fm['FontBBox']=array($e[1],$e[2],$e[3],$e[4]); |
|
| 66 | - elseif($code=='CapHeight') |
|
| 67 | - $fm['CapHeight']=(int)$param; |
|
| 68 | - elseif($code=='StdVW') |
|
| 69 | - $fm['StdVW']=(int)$param; |
|
| 48 | + elseif ($code == 'FontName') |
|
| 49 | + $fm['FontName'] = $param; |
|
| 50 | + elseif ($code == 'Weight') |
|
| 51 | + $fm['Weight'] = $param; |
|
| 52 | + elseif ($code == 'ItalicAngle') |
|
| 53 | + $fm['ItalicAngle'] = (double)$param; |
|
| 54 | + elseif ($code == 'Ascender') |
|
| 55 | + $fm['Ascender'] = (int)$param; |
|
| 56 | + elseif ($code == 'Descender') |
|
| 57 | + $fm['Descender'] = (int)$param; |
|
| 58 | + elseif ($code == 'UnderlineThickness') |
|
| 59 | + $fm['UnderlineThickness'] = (int)$param; |
|
| 60 | + elseif ($code == 'UnderlinePosition') |
|
| 61 | + $fm['UnderlinePosition'] = (int)$param; |
|
| 62 | + elseif ($code == 'IsFixedPitch') |
|
| 63 | + $fm['IsFixedPitch'] = ($param == 'true'); |
|
| 64 | + elseif ($code == 'FontBBox') |
|
| 65 | + $fm['FontBBox'] = array($e[1], $e[2], $e[3], $e[4]); |
|
| 66 | + elseif ($code == 'CapHeight') |
|
| 67 | + $fm['CapHeight'] = (int)$param; |
|
| 68 | + elseif ($code == 'StdVW') |
|
| 69 | + $fm['StdVW'] = (int)$param; |
|
| 70 | 70 | } |
| 71 | - if(!isset($fm['MissingWidth'])) |
|
| 72 | - $fm['MissingWidth']=600; |
|
| 71 | + if (!isset($fm['MissingWidth'])) |
|
| 72 | + $fm['MissingWidth'] = 600; |
|
| 73 | 73 | |
| 74 | - if(!isset($fm['FontName'])) |
|
| 74 | + if (!isset($fm['FontName'])) |
|
| 75 | 75 | die('FontName not found'); |
| 76 | 76 | |
| 77 | - $fm['Widths']=$widths; |
|
| 77 | + $fm['Widths'] = $widths; |
|
| 78 | 78 | |
| 79 | 79 | return $fm; |
| 80 | 80 | } |
@@ -82,125 +82,125 @@ discard block |
||
| 82 | 82 | function MakeFontDescriptor($fm) |
| 83 | 83 | { |
| 84 | 84 | //Ascent |
| 85 | - $asc=(isset($fm['Ascender']) ? $fm['Ascender'] : 1000); |
|
| 86 | - $fd="array('Ascent'=>".$asc; |
|
| 85 | + $asc = (isset($fm['Ascender']) ? $fm['Ascender'] : 1000); |
|
| 86 | + $fd = "array('Ascent'=>".$asc; |
|
| 87 | 87 | //Descent |
| 88 | - $desc=(isset($fm['Descender']) ? $fm['Descender'] : -200); |
|
| 89 | - $fd.=",'Descent'=>".$desc; |
|
| 88 | + $desc = (isset($fm['Descender']) ? $fm['Descender'] : -200); |
|
| 89 | + $fd .= ",'Descent'=>".$desc; |
|
| 90 | 90 | //CapHeight |
| 91 | - if(isset($fm['CapHeight'])) |
|
| 92 | - $ch=$fm['CapHeight']; |
|
| 93 | - elseif(isset($fm['CapXHeight'])) |
|
| 94 | - $ch=$fm['CapXHeight']; |
|
| 91 | + if (isset($fm['CapHeight'])) |
|
| 92 | + $ch = $fm['CapHeight']; |
|
| 93 | + elseif (isset($fm['CapXHeight'])) |
|
| 94 | + $ch = $fm['CapXHeight']; |
|
| 95 | 95 | else |
| 96 | - $ch=$asc; |
|
| 97 | - $fd.=",'CapHeight'=>".$ch; |
|
| 96 | + $ch = $asc; |
|
| 97 | + $fd .= ",'CapHeight'=>".$ch; |
|
| 98 | 98 | //Flags |
| 99 | - $flags=0; |
|
| 100 | - if(isset($fm['IsFixedPitch']) and $fm['IsFixedPitch']) |
|
| 101 | - $flags+=1<<0; |
|
| 102 | - $flags+=1<<5; |
|
| 103 | - if(isset($fm['ItalicAngle']) and $fm['ItalicAngle']!=0) |
|
| 104 | - $flags+=1<<6; |
|
| 105 | - $fd.=",'Flags'=>".$flags; |
|
| 99 | + $flags = 0; |
|
| 100 | + if (isset($fm['IsFixedPitch']) and $fm['IsFixedPitch']) |
|
| 101 | + $flags += 1 << 0; |
|
| 102 | + $flags += 1 << 5; |
|
| 103 | + if (isset($fm['ItalicAngle']) and $fm['ItalicAngle'] != 0) |
|
| 104 | + $flags += 1 << 6; |
|
| 105 | + $fd .= ",'Flags'=>".$flags; |
|
| 106 | 106 | //FontBBox |
| 107 | - if(isset($fm['FontBBox'])) |
|
| 108 | - $fbb=$fm['FontBBox']; |
|
| 107 | + if (isset($fm['FontBBox'])) |
|
| 108 | + $fbb = $fm['FontBBox']; |
|
| 109 | 109 | else |
| 110 | - $fbb=array(0,$des-100,1000,$asc+100); |
|
| 111 | - $fd.=",'FontBBox'=>'[".$fbb[0].' '.$fbb[1].' '.$fbb[2].' '.$fbb[3]."]'"; |
|
| 110 | + $fbb = array(0, $des - 100, 1000, $asc + 100); |
|
| 111 | + $fd .= ",'FontBBox'=>'[".$fbb[0].' '.$fbb[1].' '.$fbb[2].' '.$fbb[3]."]'"; |
|
| 112 | 112 | //ItalicAngle |
| 113 | - $ia=(isset($fm['ItalicAngle']) ? $fm['ItalicAngle'] : 0); |
|
| 114 | - $fd.=",'ItalicAngle'=>".$ia; |
|
| 113 | + $ia = (isset($fm['ItalicAngle']) ? $fm['ItalicAngle'] : 0); |
|
| 114 | + $fd .= ",'ItalicAngle'=>".$ia; |
|
| 115 | 115 | //StemV |
| 116 | - if(isset($fm['StdVW'])) |
|
| 117 | - $stemv=$fm['StdVW']; |
|
| 118 | - elseif(isset($fm['Weight']) and eregi('(bold|black)',$fm['Weight'])) |
|
| 119 | - $stemv=120; |
|
| 116 | + if (isset($fm['StdVW'])) |
|
| 117 | + $stemv = $fm['StdVW']; |
|
| 118 | + elseif (isset($fm['Weight']) and eregi('(bold|black)', $fm['Weight'])) |
|
| 119 | + $stemv = 120; |
|
| 120 | 120 | else |
| 121 | - $stemv=70; |
|
| 122 | - $fd.=",'StemV'=>".$stemv; |
|
| 121 | + $stemv = 70; |
|
| 122 | + $fd .= ",'StemV'=>".$stemv; |
|
| 123 | 123 | //MissingWidth |
| 124 | - if(isset($fm['MissingWidth'])) |
|
| 125 | - $fd.=",'MissingWidth'=>".$fm['MissingWidth']; |
|
| 126 | - $fd.=')'; |
|
| 124 | + if (isset($fm['MissingWidth'])) |
|
| 125 | + $fd .= ",'MissingWidth'=>".$fm['MissingWidth']; |
|
| 126 | + $fd .= ')'; |
|
| 127 | 127 | return $fd; |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | function MakeWidthArray($fm) |
| 131 | 131 | { |
| 132 | 132 | //Make character width array |
| 133 | - $s="array("; |
|
| 134 | - $cw=$fm['Widths']; |
|
| 135 | - $els=array(); |
|
| 136 | - $c=0; |
|
| 133 | + $s = "array("; |
|
| 134 | + $cw = $fm['Widths']; |
|
| 135 | + $els = array(); |
|
| 136 | + $c = 0; |
|
| 137 | 137 | foreach ($cw as $i => $w) |
| 138 | 138 | { |
| 139 | - $els[] = ((($c++)%16==0)?"\n\t":'').$i.'=>'.$w; |
|
| 139 | + $els[] = ((($c++) % 16 == 0) ? "\n\t" : '').$i.'=>'.$w; |
|
| 140 | 140 | } |
| 141 | 141 | $s .= implode(', ', $els); |
| 142 | - $s.=')'; |
|
| 142 | + $s .= ')'; |
|
| 143 | 143 | return $s; |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | -function SaveToFile($file,$s,$mode='t') |
|
| 146 | +function SaveToFile($file, $s, $mode = 't') |
|
| 147 | 147 | { |
| 148 | - $f=fopen($file,'w'.$mode); |
|
| 149 | - if(!$f) |
|
| 148 | + $f = fopen($file, 'w'.$mode); |
|
| 149 | + if (!$f) |
|
| 150 | 150 | die('Can\'t write to file '.$file); |
| 151 | - fwrite($f,$s,strlen($s)); |
|
| 151 | + fwrite($f, $s, strlen($s)); |
|
| 152 | 152 | fclose($f); |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | function ReadShort($f) |
| 156 | 156 | { |
| 157 | - $a=unpack('n1n',fread($f,2)); |
|
| 157 | + $a = unpack('n1n', fread($f, 2)); |
|
| 158 | 158 | return $a['n']; |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | function ReadLong($f) |
| 162 | 162 | { |
| 163 | - $a=unpack('N1N',fread($f,4)); |
|
| 163 | + $a = unpack('N1N', fread($f, 4)); |
|
| 164 | 164 | return $a['N']; |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | function CheckTTF($file) |
| 168 | 168 | { |
| 169 | 169 | //Check if font license allows embedding |
| 170 | - $f=fopen($file,'rb'); |
|
| 171 | - if(!$f) |
|
| 170 | + $f = fopen($file, 'rb'); |
|
| 171 | + if (!$f) |
|
| 172 | 172 | die('<B>Error:</B> Can\'t open '.$file); |
| 173 | 173 | //Extract number of tables |
| 174 | - fseek($f,4,SEEK_CUR); |
|
| 175 | - $nb=ReadShort($f); |
|
| 176 | - fseek($f,6,SEEK_CUR); |
|
| 174 | + fseek($f, 4, SEEK_CUR); |
|
| 175 | + $nb = ReadShort($f); |
|
| 176 | + fseek($f, 6, SEEK_CUR); |
|
| 177 | 177 | //Seek OS/2 table |
| 178 | - $found=false; |
|
| 179 | - for($i=0;$i<$nb;$i++) |
|
| 178 | + $found = false; |
|
| 179 | + for ($i = 0; $i < $nb; $i++) |
|
| 180 | 180 | { |
| 181 | - if(fread($f,4)=='OS/2') |
|
| 181 | + if (fread($f, 4) == 'OS/2') |
|
| 182 | 182 | { |
| 183 | - $found=true; |
|
| 183 | + $found = true; |
|
| 184 | 184 | break; |
| 185 | 185 | } |
| 186 | - fseek($f,12,SEEK_CUR); |
|
| 186 | + fseek($f, 12, SEEK_CUR); |
|
| 187 | 187 | } |
| 188 | - if(!$found) |
|
| 188 | + if (!$found) |
|
| 189 | 189 | { |
| 190 | 190 | fclose($f); |
| 191 | 191 | return; |
| 192 | 192 | } |
| 193 | - fseek($f,4,SEEK_CUR); |
|
| 194 | - $offset=ReadLong($f); |
|
| 195 | - fseek($f,$offset,SEEK_SET); |
|
| 193 | + fseek($f, 4, SEEK_CUR); |
|
| 194 | + $offset = ReadLong($f); |
|
| 195 | + fseek($f, $offset, SEEK_SET); |
|
| 196 | 196 | //Extract fsType flags |
| 197 | - fseek($f,8,SEEK_CUR); |
|
| 198 | - $fsType=ReadShort($f); |
|
| 199 | - $rl=($fsType & 0x02)!=0; |
|
| 200 | - $pp=($fsType & 0x04)!=0; |
|
| 201 | - $e=($fsType & 0x08)!=0; |
|
| 197 | + fseek($f, 8, SEEK_CUR); |
|
| 198 | + $fsType = ReadShort($f); |
|
| 199 | + $rl = ($fsType & 0x02) != 0; |
|
| 200 | + $pp = ($fsType & 0x04) != 0; |
|
| 201 | + $e = ($fsType & 0x08) != 0; |
|
| 202 | 202 | fclose($f); |
| 203 | - if($rl and !$pp and !$e) |
|
| 203 | + if ($rl and !$pp and !$e) |
|
| 204 | 204 | echo '<B>Warning:</B> font license does not allow embedding'; |
| 205 | 205 | } |
| 206 | 206 | |
@@ -208,95 +208,95 @@ discard block |
||
| 208 | 208 | * $fontfile: path to TTF file (or empty string if not to be embedded) * |
| 209 | 209 | * $ufmfile: path to UFM file * |
| 210 | 210 | *******************************************************************************/ |
| 211 | -function MakeFont($fontfile,$ufmfile) |
|
| 211 | +function MakeFont($fontfile, $ufmfile) |
|
| 212 | 212 | { |
| 213 | 213 | //Generate a font definition file |
| 214 | 214 | set_magic_quotes_runtime(0); |
| 215 | - if(!file_exists($ufmfile)) |
|
| 215 | + if (!file_exists($ufmfile)) |
|
| 216 | 216 | die('<B>Error:</B> UFM file not found: '.$ufmfile); |
| 217 | 217 | $cidtogidmap = ''; |
| 218 | - $fm=ReadUFM($ufmfile, $cidtogidmap); |
|
| 219 | - $fd=MakeFontDescriptor($fm); |
|
| 218 | + $fm = ReadUFM($ufmfile, $cidtogidmap); |
|
| 219 | + $fd = MakeFontDescriptor($fm); |
|
| 220 | 220 | //Find font type |
| 221 | - if($fontfile) |
|
| 221 | + if ($fontfile) |
|
| 222 | 222 | { |
| 223 | - $ext=strtolower(substr($fontfile,-3)); |
|
| 224 | - if($ext=='ttf') |
|
| 225 | - $type='TrueTypeUnicode'; |
|
| 223 | + $ext = strtolower(substr($fontfile, -3)); |
|
| 224 | + if ($ext == 'ttf') |
|
| 225 | + $type = 'TrueTypeUnicode'; |
|
| 226 | 226 | else |
| 227 | 227 | die('<B>Error:</B> not a truetype font: '.$ext); |
| 228 | 228 | } |
| 229 | 229 | else |
| 230 | 230 | { |
| 231 | - if($type!='TrueTypeUnicode') |
|
| 231 | + if ($type != 'TrueTypeUnicode') |
|
| 232 | 232 | die('<B>Error:</B> incorrect font type: '.$type); |
| 233 | 233 | } |
| 234 | 234 | //Start generation |
| 235 | - $s='<?php'."\n"; |
|
| 236 | - $s.='$type=\''.$type."';\n"; |
|
| 237 | - $s.='$name=\''.$fm['FontName']."';\n"; |
|
| 238 | - $s.='$desc='.$fd.";\n"; |
|
| 239 | - if(!isset($fm['UnderlinePosition'])) |
|
| 240 | - $fm['UnderlinePosition']=-100; |
|
| 241 | - if(!isset($fm['UnderlineThickness'])) |
|
| 242 | - $fm['UnderlineThickness']=50; |
|
| 243 | - $s.='$up='.$fm['UnderlinePosition'].";\n"; |
|
| 244 | - $s.='$ut='.$fm['UnderlineThickness'].";\n"; |
|
| 245 | - $w=MakeWidthArray($fm); |
|
| 246 | - $s.='$cw='.$w.";\n"; |
|
| 247 | - $s.="\$enc='';\n"; |
|
| 248 | - $s.="\$diff='';\n"; |
|
| 249 | - $basename=substr(basename($ufmfile),0,-4); |
|
| 250 | - if($fontfile) |
|
| 235 | + $s = '<?php'."\n"; |
|
| 236 | + $s .= '$type=\''.$type."';\n"; |
|
| 237 | + $s .= '$name=\''.$fm['FontName']."';\n"; |
|
| 238 | + $s .= '$desc='.$fd.";\n"; |
|
| 239 | + if (!isset($fm['UnderlinePosition'])) |
|
| 240 | + $fm['UnderlinePosition'] = -100; |
|
| 241 | + if (!isset($fm['UnderlineThickness'])) |
|
| 242 | + $fm['UnderlineThickness'] = 50; |
|
| 243 | + $s .= '$up='.$fm['UnderlinePosition'].";\n"; |
|
| 244 | + $s .= '$ut='.$fm['UnderlineThickness'].";\n"; |
|
| 245 | + $w = MakeWidthArray($fm); |
|
| 246 | + $s .= '$cw='.$w.";\n"; |
|
| 247 | + $s .= "\$enc='';\n"; |
|
| 248 | + $s .= "\$diff='';\n"; |
|
| 249 | + $basename = substr(basename($ufmfile), 0, -4); |
|
| 250 | + if ($fontfile) |
|
| 251 | 251 | { |
| 252 | 252 | //Embedded font |
| 253 | - if(!file_exists($fontfile)) |
|
| 253 | + if (!file_exists($fontfile)) |
|
| 254 | 254 | die('<B>Error:</B> font file not found: '.$fontfile); |
| 255 | 255 | CheckTTF($fontfile); |
| 256 | - $f=fopen($fontfile,'rb'); |
|
| 257 | - if(!$f) |
|
| 256 | + $f = fopen($fontfile, 'rb'); |
|
| 257 | + if (!$f) |
|
| 258 | 258 | die('<B>Error:</B> Can\'t open '.$fontfile); |
| 259 | - $file=fread($f,filesize($fontfile)); |
|
| 259 | + $file = fread($f, filesize($fontfile)); |
|
| 260 | 260 | fclose($f); |
| 261 | - if(function_exists('gzcompress')) |
|
| 261 | + if (function_exists('gzcompress')) |
|
| 262 | 262 | { |
| 263 | - $cmp=$basename.'.z'; |
|
| 264 | - SaveToFile($cmp,gzcompress($file),'b'); |
|
| 265 | - $s.='$file=\''.$cmp."';\n"; |
|
| 263 | + $cmp = $basename.'.z'; |
|
| 264 | + SaveToFile($cmp, gzcompress($file), 'b'); |
|
| 265 | + $s .= '$file=\''.$cmp."';\n"; |
|
| 266 | 266 | echo 'Font file compressed ('.$cmp.')<BR>'; |
| 267 | 267 | |
| 268 | - $cmp=$basename.'.ctg.z'; |
|
| 269 | - SaveToFile($cmp,gzcompress($cidtogidmap),'b'); |
|
| 268 | + $cmp = $basename.'.ctg.z'; |
|
| 269 | + SaveToFile($cmp, gzcompress($cidtogidmap), 'b'); |
|
| 270 | 270 | echo 'CIDToGIDMap created and compressed ('.$cmp.')<BR>'; |
| 271 | - $s.='$ctg=\''.$cmp."';\n"; |
|
| 271 | + $s .= '$ctg=\''.$cmp."';\n"; |
|
| 272 | 272 | } |
| 273 | 273 | else |
| 274 | 274 | { |
| 275 | - $s.='$file=\''.basename($fontfile)."';\n"; |
|
| 275 | + $s .= '$file=\''.basename($fontfile)."';\n"; |
|
| 276 | 276 | echo '<B>Notice:</B> font file could not be compressed (gzcompress not available)<BR>'; |
| 277 | 277 | |
| 278 | - $cmp=$basename.'.ctg'; |
|
| 278 | + $cmp = $basename.'.ctg'; |
|
| 279 | 279 | $f = fopen($cmp, 'wb'); |
| 280 | 280 | fwrite($f, $cidtogidmap); |
| 281 | 281 | fclose($f); |
| 282 | 282 | echo 'CIDToGIDMap created ('.$cmp.')<BR>'; |
| 283 | - $s.='$ctg=\''.$cmp."';\n"; |
|
| 283 | + $s .= '$ctg=\''.$cmp."';\n"; |
|
| 284 | 284 | } |
| 285 | - if($type=='Type1') |
|
| 285 | + if ($type == 'Type1') |
|
| 286 | 286 | { |
| 287 | - $s.='$size1='.$size1.";\n"; |
|
| 288 | - $s.='$size2='.$size2.";\n"; |
|
| 287 | + $s .= '$size1='.$size1.";\n"; |
|
| 288 | + $s .= '$size2='.$size2.";\n"; |
|
| 289 | 289 | } |
| 290 | 290 | else |
| 291 | - $s.='$originalsize='.filesize($fontfile).";\n"; |
|
| 291 | + $s .= '$originalsize='.filesize($fontfile).";\n"; |
|
| 292 | 292 | } |
| 293 | 293 | else |
| 294 | 294 | { |
| 295 | 295 | //Not embedded font |
| 296 | - $s.='$file='."'';\n"; |
|
| 296 | + $s .= '$file='."'';\n"; |
|
| 297 | 297 | } |
| 298 | - $s.="?>\n"; |
|
| 299 | - SaveToFile($basename.'.php',$s); |
|
| 298 | + $s .= "?>\n"; |
|
| 299 | + SaveToFile($basename.'.php', $s); |
|
| 300 | 300 | echo 'Font definition file generated ('.$basename.'.php'.')<BR>'; |
| 301 | 301 | } |
| 302 | 302 | |
@@ -12,15 +12,17 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | //Read a font metric file |
| 14 | 14 | $a=file($file); |
| 15 | - if(empty($a)) |
|
| 16 | - die('File not found'); |
|
| 15 | + if(empty($a)) { |
|
| 16 | + die('File not found'); |
|
| 17 | + } |
|
| 17 | 18 | $widths=array(); |
| 18 | 19 | $fm=array(); |
| 19 | 20 | foreach($a as $l) |
| 20 | 21 | { |
| 21 | 22 | $e=explode(' ',chop($l)); |
| 22 | - if(count($e)<2) |
|
| 23 | - continue; |
|
| 23 | + if(count($e)<2) { |
|
| 24 | + continue; |
|
| 25 | + } |
|
| 24 | 26 | $code=$e[0]; |
| 25 | 27 | $param=$e[1]; |
| 26 | 28 | if($code=='U') |
@@ -33,8 +35,9 @@ discard block |
||
| 33 | 35 | $w = $e[4]; |
| 34 | 36 | $glyph = $e[10]; |
| 35 | 37 | $widths[$cc] = $w; |
| 36 | - if($cc == ord('X')) |
|
| 37 | - $fm['CapXHeight'] = $e[13]; |
|
| 38 | + if($cc == ord('X')) { |
|
| 39 | + $fm['CapXHeight'] = $e[13]; |
|
| 40 | + } |
|
| 38 | 41 | |
| 39 | 42 | // Set GID |
| 40 | 43 | if ($cc >= 0 && $cc < 0xFFFF && $glyph) { |
@@ -42,37 +45,40 @@ discard block |
||
| 42 | 45 | $cidtogidmap{$cc*2 + 1} = chr($glyph & 0xFF); |
| 43 | 46 | } |
| 44 | 47 | } |
| 45 | - if($gn=='.notdef' && !isset($fm['MissingWidth'])) |
|
| 46 | - $fm['MissingWidth']=$w; |
|
| 48 | + if($gn=='.notdef' && !isset($fm['MissingWidth'])) { |
|
| 49 | + $fm['MissingWidth']=$w; |
|
| 50 | + } |
|
| 51 | + } elseif($code=='FontName') { |
|
| 52 | + $fm['FontName']=$param; |
|
| 53 | + } elseif($code=='Weight') { |
|
| 54 | + $fm['Weight']=$param; |
|
| 55 | + } elseif($code=='ItalicAngle') { |
|
| 56 | + $fm['ItalicAngle']=(double)$param; |
|
| 57 | + } elseif($code=='Ascender') { |
|
| 58 | + $fm['Ascender']=(int)$param; |
|
| 59 | + } elseif($code=='Descender') { |
|
| 60 | + $fm['Descender']=(int)$param; |
|
| 61 | + } elseif($code=='UnderlineThickness') { |
|
| 62 | + $fm['UnderlineThickness']=(int)$param; |
|
| 63 | + } elseif($code=='UnderlinePosition') { |
|
| 64 | + $fm['UnderlinePosition']=(int)$param; |
|
| 65 | + } elseif($code=='IsFixedPitch') { |
|
| 66 | + $fm['IsFixedPitch']=($param=='true'); |
|
| 67 | + } elseif($code=='FontBBox') { |
|
| 68 | + $fm['FontBBox']=array($e[1],$e[2],$e[3],$e[4]); |
|
| 69 | + } elseif($code=='CapHeight') { |
|
| 70 | + $fm['CapHeight']=(int)$param; |
|
| 71 | + } elseif($code=='StdVW') { |
|
| 72 | + $fm['StdVW']=(int)$param; |
|
| 47 | 73 | } |
| 48 | - elseif($code=='FontName') |
|
| 49 | - $fm['FontName']=$param; |
|
| 50 | - elseif($code=='Weight') |
|
| 51 | - $fm['Weight']=$param; |
|
| 52 | - elseif($code=='ItalicAngle') |
|
| 53 | - $fm['ItalicAngle']=(double)$param; |
|
| 54 | - elseif($code=='Ascender') |
|
| 55 | - $fm['Ascender']=(int)$param; |
|
| 56 | - elseif($code=='Descender') |
|
| 57 | - $fm['Descender']=(int)$param; |
|
| 58 | - elseif($code=='UnderlineThickness') |
|
| 59 | - $fm['UnderlineThickness']=(int)$param; |
|
| 60 | - elseif($code=='UnderlinePosition') |
|
| 61 | - $fm['UnderlinePosition']=(int)$param; |
|
| 62 | - elseif($code=='IsFixedPitch') |
|
| 63 | - $fm['IsFixedPitch']=($param=='true'); |
|
| 64 | - elseif($code=='FontBBox') |
|
| 65 | - $fm['FontBBox']=array($e[1],$e[2],$e[3],$e[4]); |
|
| 66 | - elseif($code=='CapHeight') |
|
| 67 | - $fm['CapHeight']=(int)$param; |
|
| 68 | - elseif($code=='StdVW') |
|
| 69 | - $fm['StdVW']=(int)$param; |
|
| 70 | 74 | } |
| 71 | - if(!isset($fm['MissingWidth'])) |
|
| 72 | - $fm['MissingWidth']=600; |
|
| 75 | + if(!isset($fm['MissingWidth'])) { |
|
| 76 | + $fm['MissingWidth']=600; |
|
| 77 | + } |
|
| 73 | 78 | |
| 74 | - if(!isset($fm['FontName'])) |
|
| 75 | - die('FontName not found'); |
|
| 79 | + if(!isset($fm['FontName'])) { |
|
| 80 | + die('FontName not found'); |
|
| 81 | + } |
|
| 76 | 82 | |
| 77 | 83 | $fm['Widths']=$widths; |
| 78 | 84 | |
@@ -88,41 +94,47 @@ discard block |
||
| 88 | 94 | $desc=(isset($fm['Descender']) ? $fm['Descender'] : -200); |
| 89 | 95 | $fd.=",'Descent'=>".$desc; |
| 90 | 96 | //CapHeight |
| 91 | - if(isset($fm['CapHeight'])) |
|
| 92 | - $ch=$fm['CapHeight']; |
|
| 93 | - elseif(isset($fm['CapXHeight'])) |
|
| 94 | - $ch=$fm['CapXHeight']; |
|
| 95 | - else |
|
| 96 | - $ch=$asc; |
|
| 97 | + if(isset($fm['CapHeight'])) { |
|
| 98 | + $ch=$fm['CapHeight']; |
|
| 99 | + } elseif(isset($fm['CapXHeight'])) { |
|
| 100 | + $ch=$fm['CapXHeight']; |
|
| 101 | + } else { |
|
| 102 | + $ch=$asc; |
|
| 103 | + } |
|
| 97 | 104 | $fd.=",'CapHeight'=>".$ch; |
| 98 | 105 | //Flags |
| 99 | 106 | $flags=0; |
| 100 | - if(isset($fm['IsFixedPitch']) and $fm['IsFixedPitch']) |
|
| 101 | - $flags+=1<<0; |
|
| 107 | + if(isset($fm['IsFixedPitch']) and $fm['IsFixedPitch']) { |
|
| 108 | + $flags+=1<<0; |
|
| 109 | + } |
|
| 102 | 110 | $flags+=1<<5; |
| 103 | - if(isset($fm['ItalicAngle']) and $fm['ItalicAngle']!=0) |
|
| 104 | - $flags+=1<<6; |
|
| 111 | + if(isset($fm['ItalicAngle']) and $fm['ItalicAngle']!=0) { |
|
| 112 | + $flags+=1<<6; |
|
| 113 | + } |
|
| 105 | 114 | $fd.=",'Flags'=>".$flags; |
| 106 | 115 | //FontBBox |
| 107 | - if(isset($fm['FontBBox'])) |
|
| 108 | - $fbb=$fm['FontBBox']; |
|
| 109 | - else |
|
| 110 | - $fbb=array(0,$des-100,1000,$asc+100); |
|
| 116 | + if(isset($fm['FontBBox'])) { |
|
| 117 | + $fbb=$fm['FontBBox']; |
|
| 118 | + } else { |
|
| 119 | + $fbb=array(0,$des-100,1000,$asc+100); |
|
| 120 | + } |
|
| 111 | 121 | $fd.=",'FontBBox'=>'[".$fbb[0].' '.$fbb[1].' '.$fbb[2].' '.$fbb[3]."]'"; |
| 112 | 122 | //ItalicAngle |
| 113 | 123 | $ia=(isset($fm['ItalicAngle']) ? $fm['ItalicAngle'] : 0); |
| 114 | 124 | $fd.=",'ItalicAngle'=>".$ia; |
| 115 | 125 | //StemV |
| 116 | - if(isset($fm['StdVW'])) |
|
| 117 | - $stemv=$fm['StdVW']; |
|
| 118 | - elseif(isset($fm['Weight']) and eregi('(bold|black)',$fm['Weight'])) |
|
| 119 | - $stemv=120; |
|
| 120 | - else |
|
| 121 | - $stemv=70; |
|
| 126 | + if(isset($fm['StdVW'])) { |
|
| 127 | + $stemv=$fm['StdVW']; |
|
| 128 | + } elseif(isset($fm['Weight']) and eregi('(bold|black)',$fm['Weight'])) { |
|
| 129 | + $stemv=120; |
|
| 130 | + } else { |
|
| 131 | + $stemv=70; |
|
| 132 | + } |
|
| 122 | 133 | $fd.=",'StemV'=>".$stemv; |
| 123 | 134 | //MissingWidth |
| 124 | - if(isset($fm['MissingWidth'])) |
|
| 125 | - $fd.=",'MissingWidth'=>".$fm['MissingWidth']; |
|
| 135 | + if(isset($fm['MissingWidth'])) { |
|
| 136 | + $fd.=",'MissingWidth'=>".$fm['MissingWidth']; |
|
| 137 | + } |
|
| 126 | 138 | $fd.=')'; |
| 127 | 139 | return $fd; |
| 128 | 140 | } |
@@ -146,8 +158,9 @@ discard block |
||
| 146 | 158 | function SaveToFile($file,$s,$mode='t') |
| 147 | 159 | { |
| 148 | 160 | $f=fopen($file,'w'.$mode); |
| 149 | - if(!$f) |
|
| 150 | - die('Can\'t write to file '.$file); |
|
| 161 | + if(!$f) { |
|
| 162 | + die('Can\'t write to file '.$file); |
|
| 163 | + } |
|
| 151 | 164 | fwrite($f,$s,strlen($s)); |
| 152 | 165 | fclose($f); |
| 153 | 166 | } |
@@ -168,8 +181,9 @@ discard block |
||
| 168 | 181 | { |
| 169 | 182 | //Check if font license allows embedding |
| 170 | 183 | $f=fopen($file,'rb'); |
| 171 | - if(!$f) |
|
| 172 | - die('<B>Error:</B> Can\'t open '.$file); |
|
| 184 | + if(!$f) { |
|
| 185 | + die('<B>Error:</B> Can\'t open '.$file); |
|
| 186 | + } |
|
| 173 | 187 | //Extract number of tables |
| 174 | 188 | fseek($f,4,SEEK_CUR); |
| 175 | 189 | $nb=ReadShort($f); |
@@ -200,9 +214,10 @@ discard block |
||
| 200 | 214 | $pp=($fsType & 0x04)!=0; |
| 201 | 215 | $e=($fsType & 0x08)!=0; |
| 202 | 216 | fclose($f); |
| 203 | - if($rl and !$pp and !$e) |
|
| 204 | - echo '<B>Warning:</B> font license does not allow embedding'; |
|
| 205 | -} |
|
| 217 | + if($rl and !$pp and !$e) { |
|
| 218 | + echo '<B>Warning:</B> font license does not allow embedding'; |
|
| 219 | + } |
|
| 220 | + } |
|
| 206 | 221 | |
| 207 | 222 | /******************************************************************************* |
| 208 | 223 | * $fontfile: path to TTF file (or empty string if not to be embedded) * |
@@ -212,8 +227,9 @@ discard block |
||
| 212 | 227 | { |
| 213 | 228 | //Generate a font definition file |
| 214 | 229 | set_magic_quotes_runtime(0); |
| 215 | - if(!file_exists($ufmfile)) |
|
| 216 | - die('<B>Error:</B> UFM file not found: '.$ufmfile); |
|
| 230 | + if(!file_exists($ufmfile)) { |
|
| 231 | + die('<B>Error:</B> UFM file not found: '.$ufmfile); |
|
| 232 | + } |
|
| 217 | 233 | $cidtogidmap = ''; |
| 218 | 234 | $fm=ReadUFM($ufmfile, $cidtogidmap); |
| 219 | 235 | $fd=MakeFontDescriptor($fm); |
@@ -221,25 +237,28 @@ discard block |
||
| 221 | 237 | if($fontfile) |
| 222 | 238 | { |
| 223 | 239 | $ext=strtolower(substr($fontfile,-3)); |
| 224 | - if($ext=='ttf') |
|
| 225 | - $type='TrueTypeUnicode'; |
|
| 226 | - else |
|
| 227 | - die('<B>Error:</B> not a truetype font: '.$ext); |
|
| 228 | - } |
|
| 229 | - else |
|
| 240 | + if($ext=='ttf') { |
|
| 241 | + $type='TrueTypeUnicode'; |
|
| 242 | + } else { |
|
| 243 | + die('<B>Error:</B> not a truetype font: '.$ext); |
|
| 244 | + } |
|
| 245 | + } else |
|
| 230 | 246 | { |
| 231 | - if($type!='TrueTypeUnicode') |
|
| 232 | - die('<B>Error:</B> incorrect font type: '.$type); |
|
| 247 | + if($type!='TrueTypeUnicode') { |
|
| 248 | + die('<B>Error:</B> incorrect font type: '.$type); |
|
| 249 | + } |
|
| 233 | 250 | } |
| 234 | 251 | //Start generation |
| 235 | 252 | $s='<?php'."\n"; |
| 236 | 253 | $s.='$type=\''.$type."';\n"; |
| 237 | 254 | $s.='$name=\''.$fm['FontName']."';\n"; |
| 238 | 255 | $s.='$desc='.$fd.";\n"; |
| 239 | - if(!isset($fm['UnderlinePosition'])) |
|
| 240 | - $fm['UnderlinePosition']=-100; |
|
| 241 | - if(!isset($fm['UnderlineThickness'])) |
|
| 242 | - $fm['UnderlineThickness']=50; |
|
| 256 | + if(!isset($fm['UnderlinePosition'])) { |
|
| 257 | + $fm['UnderlinePosition']=-100; |
|
| 258 | + } |
|
| 259 | + if(!isset($fm['UnderlineThickness'])) { |
|
| 260 | + $fm['UnderlineThickness']=50; |
|
| 261 | + } |
|
| 243 | 262 | $s.='$up='.$fm['UnderlinePosition'].";\n"; |
| 244 | 263 | $s.='$ut='.$fm['UnderlineThickness'].";\n"; |
| 245 | 264 | $w=MakeWidthArray($fm); |
@@ -250,12 +269,14 @@ discard block |
||
| 250 | 269 | if($fontfile) |
| 251 | 270 | { |
| 252 | 271 | //Embedded font |
| 253 | - if(!file_exists($fontfile)) |
|
| 254 | - die('<B>Error:</B> font file not found: '.$fontfile); |
|
| 272 | + if(!file_exists($fontfile)) { |
|
| 273 | + die('<B>Error:</B> font file not found: '.$fontfile); |
|
| 274 | + } |
|
| 255 | 275 | CheckTTF($fontfile); |
| 256 | 276 | $f=fopen($fontfile,'rb'); |
| 257 | - if(!$f) |
|
| 258 | - die('<B>Error:</B> Can\'t open '.$fontfile); |
|
| 277 | + if(!$f) { |
|
| 278 | + die('<B>Error:</B> Can\'t open '.$fontfile); |
|
| 279 | + } |
|
| 259 | 280 | $file=fread($f,filesize($fontfile)); |
| 260 | 281 | fclose($f); |
| 261 | 282 | if(function_exists('gzcompress')) |
@@ -269,8 +290,7 @@ discard block |
||
| 269 | 290 | SaveToFile($cmp,gzcompress($cidtogidmap),'b'); |
| 270 | 291 | echo 'CIDToGIDMap created and compressed ('.$cmp.')<BR>'; |
| 271 | 292 | $s.='$ctg=\''.$cmp."';\n"; |
| 272 | - } |
|
| 273 | - else |
|
| 293 | + } else |
|
| 274 | 294 | { |
| 275 | 295 | $s.='$file=\''.basename($fontfile)."';\n"; |
| 276 | 296 | echo '<B>Notice:</B> font file could not be compressed (gzcompress not available)<BR>'; |
@@ -286,11 +306,10 @@ discard block |
||
| 286 | 306 | { |
| 287 | 307 | $s.='$size1='.$size1.";\n"; |
| 288 | 308 | $s.='$size2='.$size2.";\n"; |
| 309 | + } else { |
|
| 310 | + $s.='$originalsize='.filesize($fontfile).";\n"; |
|
| 289 | 311 | } |
| 290 | - else |
|
| 291 | - $s.='$originalsize='.filesize($fontfile).";\n"; |
|
| 292 | - } |
|
| 293 | - else |
|
| 312 | + } else |
|
| 294 | 313 | { |
| 295 | 314 | //Not embedded font |
| 296 | 315 | $s.='$file='."'';\n"; |
@@ -307,8 +326,7 @@ discard block |
||
| 307 | 326 | MakeFont($arg[0], $arg[1]); |
| 308 | 327 | $t = ob_get_clean(); |
| 309 | 328 | print preg_replace('!<BR( /)?>!i', "\n", $t); |
| 310 | -} |
|
| 311 | -else { |
|
| 329 | +} else { |
|
| 312 | 330 | print "Usage: makefontuni.php <ttf-file> <ufm-file>\n"; |
| 313 | 331 | } |
| 314 | 332 | ?> |
| 315 | 333 | \ No newline at end of file |
@@ -981,7 +981,7 @@ discard block |
||
| 981 | 981 | * Defines the left, top and right margins. By default, they equal 1 cm. Call this method to change them. |
| 982 | 982 | * @param float $left Left margin. |
| 983 | 983 | * @param float $top Top margin. |
| 984 | - * @param float $right Right margin. Default value is the left one. |
|
| 984 | + * @param integer $right Right margin. Default value is the left one. |
|
| 985 | 985 | * @since 1.0 |
| 986 | 986 | * @see SetLeftMargin(), SetTopMargin(), SetRightMargin(), SetAutoPageBreak() |
| 987 | 987 | */ |
@@ -1034,7 +1034,7 @@ discard block |
||
| 1034 | 1034 | /** |
| 1035 | 1035 | * Enables or disables the automatic page breaking mode. When enabling, the second parameter is the distance from the bottom of the page that defines the triggering limit. By default, the mode is on and the margin is 2 cm. |
| 1036 | 1036 | * @param boolean $auto Boolean indicating if mode should be on or off. |
| 1037 | - * @param float $margin Distance from the bottom of the page. |
|
| 1037 | + * @param integer $margin Distance from the bottom of the page. |
|
| 1038 | 1038 | * @since 1.0 |
| 1039 | 1039 | * @see Cell(), MultiCell(), AcceptPageBreak() |
| 1040 | 1040 | */ |
@@ -1047,7 +1047,7 @@ discard block |
||
| 1047 | 1047 | |
| 1048 | 1048 | /** |
| 1049 | 1049 | * Defines the way the document is to be displayed by the viewer. The zoom level can be set: pages can be displayed entirely on screen, occupy the full width of the window, use real size, be scaled by a specific zooming factor or use viewer default (configured in the Preferences menu of Acrobat). The page layout can be specified too: single at once, continuous display, two columns or viewer default. By default, documents use the full width mode with continuous display. |
| 1050 | - * @param mixed $zoom The zoom to use. It can be one of the following string values or a number indicating the zooming factor to use. <ul><li>fullpage: displays the entire page on screen </li><li>fullwidth: uses maximum width of window</li><li>real: uses real size (equivalent to 100% zoom)</li><li>default: uses viewer default mode</li></ul> |
|
| 1050 | + * @param string $zoom The zoom to use. It can be one of the following string values or a number indicating the zooming factor to use. <ul><li>fullpage: displays the entire page on screen </li><li>fullwidth: uses maximum width of window</li><li>real: uses real size (equivalent to 100% zoom)</li><li>default: uses viewer default mode</li></ul> |
|
| 1051 | 1051 | * @param string $layout The page layout. Possible values are:<ul><li>single: displays one page at once</li><li>continuous: displays pages continuously (default)</li><li>two: displays two pages on two columns</li><li>default: uses viewer default mode</li></ul> |
| 1052 | 1052 | * @since 1.2 |
| 1053 | 1053 | */ |
@@ -1289,7 +1289,7 @@ discard block |
||
| 1289 | 1289 | /** |
| 1290 | 1290 | * Set header data. |
| 1291 | 1291 | * @param string $ln header image logo |
| 1292 | - * @param string $lw header image logo width in mm |
|
| 1292 | + * @param integer $lw header image logo width in mm |
|
| 1293 | 1293 | * @param string $ht string to print as title on document header |
| 1294 | 1294 | * @param string $hs string to print on document header |
| 1295 | 1295 | */ |
@@ -1328,7 +1328,7 @@ discard block |
||
| 1328 | 1328 | |
| 1329 | 1329 | /** |
| 1330 | 1330 | * Set a flag to print page footer. |
| 1331 | - * @param boolean $value set to true to print the page footer (default), false otherwise. |
|
| 1331 | + * @param boolean $val set to true to print the page footer (default), false otherwise. |
|
| 1332 | 1332 | */ |
| 1333 | 1333 | function setPrintFooter($val=true) { |
| 1334 | 1334 | $this->print_footer = $val; |
@@ -1713,7 +1713,7 @@ discard block |
||
| 1713 | 1713 | * If the file corresponding to the requested font is not found, the error "Could not include font metric file" is generated. |
| 1714 | 1714 | * @param string $family Family font. It can be either a name defined by AddFont() or one of the standard families (case insensitive):<ul><li>Courier (fixed-width)</li><li>Helvetica or Arial (synonymous; sans serif)</li><li>Times (serif)</li><li>Symbol (symbolic)</li><li>ZapfDingbats (symbolic)</li></ul>It is also possible to pass an empty string. In that case, the current family is retained. |
| 1715 | 1715 | * @param string $style Font style. Possible values are (case insensitive):<ul><li>empty string: regular</li><li>B: bold</li><li>I: italic</li><li>U: underline</li></ul>or any combination. The default value is regular. Bold and italic styles do not apply to Symbol and ZapfDingbats |
| 1716 | - * @param float $size Font size in points. The default value is the current size. If no size has been specified since the beginning of the document, the value taken is 12 |
|
| 1716 | + * @param integer $size Font size in points. The default value is the current size. If no size has been specified since the beginning of the document, the value taken is 12 |
|
| 1717 | 1717 | * @since 1.0 |
| 1718 | 1718 | * @see AddFont(), SetFontSize(), Cell(), MultiCell(), Write() |
| 1719 | 1719 | */ |
@@ -1844,7 +1844,7 @@ discard block |
||
| 1844 | 1844 | /** |
| 1845 | 1845 | * Defines the page and position a link points to |
| 1846 | 1846 | * @param int $link The link identifier returned by AddLink() |
| 1847 | - * @param float $y Ordinate of target position; -1 indicates the current position. The default value is 0 (top of page) |
|
| 1847 | + * @param integer $y Ordinate of target position; -1 indicates the current position. The default value is 0 (top of page) |
|
| 1848 | 1848 | * @param int $page Number of target page; -1 indicates the current page. This is the default value |
| 1849 | 1849 | * @since 1.5 |
| 1850 | 1850 | * @see AddLink() |
@@ -1949,9 +1949,9 @@ discard block |
||
| 1949 | 1949 | * Prints a cell (rectangular area) with optional borders, background color and character string. The upper-left corner of the cell corresponds to the current position. The text can be aligned or centered. After the call, the current position moves to the right or to the next line. It is possible to put a link on the text.<br /> |
| 1950 | 1950 | * If automatic page breaking is enabled and the cell goes beyond the limit, a page break is done before outputting. |
| 1951 | 1951 | * @param float $w Cell width. If 0, the cell extends up to the right margin. |
| 1952 | - * @param float $h Cell height. Default value: 0. |
|
| 1952 | + * @param integer $h Cell height. Default value: 0. |
|
| 1953 | 1953 | * @param string $txt String to print. Default value: empty string. |
| 1954 | - * @param mixed $border Indicates if borders must be drawn around the cell. The value can be either a number:<ul><li>0: no border (default)</li><li>1: frame</li></ul>or a string containing some or all of the following characters (in any order):<ul><li>L: left</li><li>T: top</li><li>R: right</li><li>B: bottom</li></ul> |
|
| 1954 | + * @param integer $border Indicates if borders must be drawn around the cell. The value can be either a number:<ul><li>0: no border (default)</li><li>1: frame</li></ul>or a string containing some or all of the following characters (in any order):<ul><li>L: left</li><li>T: top</li><li>R: right</li><li>B: bottom</li></ul> |
|
| 1955 | 1955 | * @param int $ln Indicates where the current position should go after the call. Possible values are:<ul><li>0: to the right</li><li>1: to the beginning of the next line</li><li>2: below</li></ul> |
| 1956 | 1956 | Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: 0. |
| 1957 | 1957 | * @param string $align Allows to center or align the text. Possible values are:<ul><li>L or empty string: left align (default value)</li><li>C: center</li><li>R: right align</li></ul> |
@@ -2055,7 +2055,7 @@ discard block |
||
| 2055 | 2055 | * @param float $w Width of cells. If 0, they extend up to the right margin of the page. |
| 2056 | 2056 | * @param float $h Height of cells. |
| 2057 | 2057 | * @param string $txt String to print |
| 2058 | - * @param mixed $border Indicates if borders must be drawn around the cell block. The value can be either a number:<ul><li>0: no border (default)</li><li>1: frame</li></ul>or a string containing some or all of the following characters (in any order):<ul><li>L: left</li><li>T: top</li><li>R: right</li><li>B: bottom</li></ul> |
|
| 2058 | + * @param integer $border Indicates if borders must be drawn around the cell block. The value can be either a number:<ul><li>0: no border (default)</li><li>1: frame</li></ul>or a string containing some or all of the following characters (in any order):<ul><li>L: left</li><li>T: top</li><li>R: right</li><li>B: bottom</li></ul> |
|
| 2059 | 2059 | * @param string $align Allows to center or align the text. Possible values are:<ul><li>L or empty string: left align</li><li>C: center</li><li>R: right align</li><li>J: justification (default value)</li></ul> |
| 2060 | 2060 | * @param int $fill Indicates if the cell background must be painted (1) or transparent (0). Default value: 0. |
| 2061 | 2061 | * @param int $ln Indicates where the current position should go after the call. Possible values are:<ul><li>0: to the right</li><li>1: to the beginning of the next line [DEFAULT]</li><li>2: below</li></ul> |
@@ -2205,7 +2205,7 @@ discard block |
||
| 2205 | 2205 | * </pre> |
| 2206 | 2206 | * @param float $h Line height |
| 2207 | 2207 | * @param string $txt String to print |
| 2208 | - * @param mixed $link URL or identifier returned by AddLink() |
|
| 2208 | + * @param string $link URL or identifier returned by AddLink() |
|
| 2209 | 2209 | * @param int $fill Indicates if the background must be painted (1) or transparent (0). Default value: 0. |
| 2210 | 2210 | * @since 1.5 |
| 2211 | 2211 | * @see SetFont(), SetTextColor(), AddLink(), MultiCell(), SetAutoPageBreak() |
@@ -2311,8 +2311,8 @@ discard block |
||
| 2311 | 2311 | * @param string $file Name of the file containing the image. |
| 2312 | 2312 | * @param float $x Abscissa of the upper-left corner. |
| 2313 | 2313 | * @param float $y Ordinate of the upper-left corner. |
| 2314 | - * @param float $w Width of the image in the page. If not specified or equal to zero, it is automatically calculated. |
|
| 2315 | - * @param float $h Height of the image in the page. If not specified or equal to zero, it is automatically calculated. |
|
| 2314 | + * @param integer $w Width of the image in the page. If not specified or equal to zero, it is automatically calculated. |
|
| 2315 | + * @param integer $h Height of the image in the page. If not specified or equal to zero, it is automatically calculated. |
|
| 2316 | 2316 | * @param string $type Image format. Possible values are (case insensitive): JPG, JPEG, PNG. If not specified, the type is inferred from the file extension. |
| 2317 | 2317 | * @param mixed $link URL or identifier returned by AddLink(). |
| 2318 | 2318 | * @since 1.1 |
@@ -2983,6 +2983,7 @@ discard block |
||
| 2983 | 2983 | /** |
| 2984 | 2984 | * _beginpage |
| 2985 | 2985 | * @access protected |
| 2986 | + * @param string $orientation |
|
| 2986 | 2987 | */ |
| 2987 | 2988 | function _beginpage($orientation) { |
| 2988 | 2989 | $this->page++; |
@@ -3041,6 +3042,8 @@ discard block |
||
| 3041 | 3042 | /** |
| 3042 | 3043 | * Underline text |
| 3043 | 3044 | * @access protected |
| 3045 | + * @param double $y |
|
| 3046 | + * @param string $txt |
|
| 3044 | 3047 | */ |
| 3045 | 3048 | function _dounderline($x,$y,$txt) { |
| 3046 | 3049 | $up = $this->CurrentFont['up']; |
@@ -3052,6 +3055,7 @@ discard block |
||
| 3052 | 3055 | /** |
| 3053 | 3056 | * Extract info from a JPEG file |
| 3054 | 3057 | * @access protected |
| 3058 | + * @param string $file |
|
| 3055 | 3059 | */ |
| 3056 | 3060 | function _parsejpg($file) { |
| 3057 | 3061 | $a=GetImageSize($file); |
@@ -3084,6 +3088,7 @@ discard block |
||
| 3084 | 3088 | /** |
| 3085 | 3089 | * Extract info from a PNG file |
| 3086 | 3090 | * @access protected |
| 3091 | + * @param string $file |
|
| 3087 | 3092 | */ |
| 3088 | 3093 | function _parsepng($file) { |
| 3089 | 3094 | $f=fopen($file,'rb'); |
@@ -3181,6 +3186,7 @@ discard block |
||
| 3181 | 3186 | /** |
| 3182 | 3187 | * Read a 4-byte integer from file |
| 3183 | 3188 | * @access protected |
| 3189 | + * @param resource $f |
|
| 3184 | 3190 | */ |
| 3185 | 3191 | function _freadint($f) { |
| 3186 | 3192 | //Read a 4-byte integer from file |
@@ -3203,6 +3209,7 @@ discard block |
||
| 3203 | 3209 | /** |
| 3204 | 3210 | * Format a text string |
| 3205 | 3211 | * @access protected |
| 3212 | + * @param string $s |
|
| 3206 | 3213 | */ |
| 3207 | 3214 | function _escapetext($s) { |
| 3208 | 3215 | if($this->isunicode) { |
@@ -3722,7 +3729,7 @@ discard block |
||
| 3722 | 3729 | * @param float $x upper-left corner X coordinate |
| 3723 | 3730 | * @param float $y upper-left corner Y coordinate |
| 3724 | 3731 | * @param string $html html text to print. Default value: empty string. |
| 3725 | - * @param mixed $border Indicates if borders must be drawn around the cell. The value can be either a number:<ul><li>0: no border (default)</li><li>1: frame</li></ul>or a string containing some or all of the following characters (in any order):<ul><li>L: left</li><li>T: top</li><li>R: right</li><li>B: bottom</li></ul> |
|
| 3732 | + * @param integer $border Indicates if borders must be drawn around the cell. The value can be either a number:<ul><li>0: no border (default)</li><li>1: frame</li></ul>or a string containing some or all of the following characters (in any order):<ul><li>L: left</li><li>T: top</li><li>R: right</li><li>B: bottom</li></ul> |
|
| 3726 | 3733 | * @param int $ln Indicates where the current position should go after the call. Possible values are:<ul><li>0: to the right</li><li>1: to the beginning of the next line</li><li>2: below</li></ul> |
| 3727 | 3734 | Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: 0. |
| 3728 | 3735 | * @param int $fill Indicates if the cell background must be painted (1) or transparent (0). Default value: 0. |
@@ -73,400 +73,400 @@ discard block |
||
| 73 | 73 | define('PDF_PRODUCER','Instant Zero (http://www.instant-zero.com)'); |
| 74 | 74 | |
| 75 | 75 | /** |
| 76 | - * This is a PHP4 class for generating PDF files on-the-fly without requiring external extensions.<br> |
|
| 77 | - * This class is an extension and improvement of the FPDF class by Olivier Plathey (http://www.fpdf.org).<br> |
|
| 78 | - * This version contains some changes: [porting to PHP4, support for UTF-8 Unicode, code style and formatting, php documentation (www.phpdoc.org), ISO page formats, minor improvements, image scale factor]<br> |
|
| 79 | - * TCPDF project (http://tcpdf.sourceforge.net) is based on the public Domain FPDF class by Olivier Plathey (http://www.fpdf.org).<br> |
|
| 80 | - * To add your own TTF fonts please read /fonts/README.TXT |
|
| 81 | - * @name TCPDF |
|
| 82 | - * @package com.tecnick.tcpdf |
|
| 83 | - * @version 1.53.0.TC031_PHP4 |
|
| 84 | - * @author Nicola Asuni |
|
| 85 | - * @link http://tcpdf.sourceforge.net |
|
| 86 | - * @license http://www.gnu.org/copyleft/lesser.html LGPL |
|
| 87 | - */ |
|
| 76 | + * This is a PHP4 class for generating PDF files on-the-fly without requiring external extensions.<br> |
|
| 77 | + * This class is an extension and improvement of the FPDF class by Olivier Plathey (http://www.fpdf.org).<br> |
|
| 78 | + * This version contains some changes: [porting to PHP4, support for UTF-8 Unicode, code style and formatting, php documentation (www.phpdoc.org), ISO page formats, minor improvements, image scale factor]<br> |
|
| 79 | + * TCPDF project (http://tcpdf.sourceforge.net) is based on the public Domain FPDF class by Olivier Plathey (http://www.fpdf.org).<br> |
|
| 80 | + * To add your own TTF fonts please read /fonts/README.TXT |
|
| 81 | + * @name TCPDF |
|
| 82 | + * @package com.tecnick.tcpdf |
|
| 83 | + * @version 1.53.0.TC031_PHP4 |
|
| 84 | + * @author Nicola Asuni |
|
| 85 | + * @link http://tcpdf.sourceforge.net |
|
| 86 | + * @license http://www.gnu.org/copyleft/lesser.html LGPL |
|
| 87 | + */ |
|
| 88 | 88 | class TCPDF { |
| 89 | 89 | //var properties |
| 90 | 90 | |
| 91 | 91 | /** |
| 92 | - * @var current page number |
|
| 93 | - * @access protected |
|
| 94 | - */ |
|
| 92 | + * @var current page number |
|
| 93 | + * @access protected |
|
| 94 | + */ |
|
| 95 | 95 | var $page; |
| 96 | 96 | |
| 97 | 97 | /** |
| 98 | - * @var current object number |
|
| 99 | - * @access protected |
|
| 100 | - */ |
|
| 98 | + * @var current object number |
|
| 99 | + * @access protected |
|
| 100 | + */ |
|
| 101 | 101 | var $n; |
| 102 | 102 | |
| 103 | 103 | /** |
| 104 | - * @var array of object offsets |
|
| 105 | - * @access protected |
|
| 106 | - */ |
|
| 104 | + * @var array of object offsets |
|
| 105 | + * @access protected |
|
| 106 | + */ |
|
| 107 | 107 | var $offsets; |
| 108 | 108 | |
| 109 | 109 | /** |
| 110 | - * @var buffer holding in-memory PDF |
|
| 111 | - * @access protected |
|
| 112 | - */ |
|
| 110 | + * @var buffer holding in-memory PDF |
|
| 111 | + * @access protected |
|
| 112 | + */ |
|
| 113 | 113 | var $buffer; |
| 114 | 114 | |
| 115 | 115 | /** |
| 116 | - * @var array containing pages |
|
| 117 | - * @access protected |
|
| 118 | - */ |
|
| 116 | + * @var array containing pages |
|
| 117 | + * @access protected |
|
| 118 | + */ |
|
| 119 | 119 | var $pages; |
| 120 | 120 | |
| 121 | 121 | /** |
| 122 | - * @var current document state |
|
| 123 | - * @access protected |
|
| 124 | - */ |
|
| 122 | + * @var current document state |
|
| 123 | + * @access protected |
|
| 124 | + */ |
|
| 125 | 125 | var $state; |
| 126 | 126 | |
| 127 | 127 | /** |
| 128 | - * @var compression flag |
|
| 129 | - * @access protected |
|
| 130 | - */ |
|
| 128 | + * @var compression flag |
|
| 129 | + * @access protected |
|
| 130 | + */ |
|
| 131 | 131 | var $compress; |
| 132 | 132 | |
| 133 | 133 | /** |
| 134 | - * @var default orientation |
|
| 135 | - * @access protected |
|
| 136 | - */ |
|
| 134 | + * @var default orientation |
|
| 135 | + * @access protected |
|
| 136 | + */ |
|
| 137 | 137 | var $DefOrientation; |
| 138 | 138 | |
| 139 | 139 | /** |
| 140 | - * @var current orientation |
|
| 141 | - * @access protected |
|
| 142 | - */ |
|
| 140 | + * @var current orientation |
|
| 141 | + * @access protected |
|
| 142 | + */ |
|
| 143 | 143 | var $CurOrientation; |
| 144 | 144 | |
| 145 | 145 | /** |
| 146 | - * @var array indicating orientation changes |
|
| 147 | - * @access protected |
|
| 148 | - */ |
|
| 146 | + * @var array indicating orientation changes |
|
| 147 | + * @access protected |
|
| 148 | + */ |
|
| 149 | 149 | var $OrientationChanges; |
| 150 | 150 | |
| 151 | 151 | /** |
| 152 | - * @var scale factor (number of points in user unit) |
|
| 153 | - * @access protected |
|
| 154 | - */ |
|
| 152 | + * @var scale factor (number of points in user unit) |
|
| 153 | + * @access protected |
|
| 154 | + */ |
|
| 155 | 155 | var $k; |
| 156 | 156 | |
| 157 | 157 | /** |
| 158 | - * @var width of page format in points |
|
| 159 | - * @access protected |
|
| 160 | - */ |
|
| 158 | + * @var width of page format in points |
|
| 159 | + * @access protected |
|
| 160 | + */ |
|
| 161 | 161 | var $fwPt; |
| 162 | 162 | |
| 163 | 163 | /** |
| 164 | - * @var height of page format in points |
|
| 165 | - * @access protected |
|
| 166 | - */ |
|
| 164 | + * @var height of page format in points |
|
| 165 | + * @access protected |
|
| 166 | + */ |
|
| 167 | 167 | var $fhPt; |
| 168 | 168 | |
| 169 | 169 | /** |
| 170 | - * @var width of page format in user unit |
|
| 171 | - * @access protected |
|
| 172 | - */ |
|
| 170 | + * @var width of page format in user unit |
|
| 171 | + * @access protected |
|
| 172 | + */ |
|
| 173 | 173 | var $fw; |
| 174 | 174 | |
| 175 | 175 | /** |
| 176 | - * @var height of page format in user unit |
|
| 177 | - * @access protected |
|
| 178 | - */ |
|
| 176 | + * @var height of page format in user unit |
|
| 177 | + * @access protected |
|
| 178 | + */ |
|
| 179 | 179 | var $fh; |
| 180 | 180 | |
| 181 | 181 | /** |
| 182 | - * @var current width of page in points |
|
| 183 | - * @access protected |
|
| 184 | - */ |
|
| 182 | + * @var current width of page in points |
|
| 183 | + * @access protected |
|
| 184 | + */ |
|
| 185 | 185 | var $wPt; |
| 186 | 186 | |
| 187 | 187 | /** |
| 188 | - * @var current height of page in points |
|
| 189 | - * @access protected |
|
| 190 | - */ |
|
| 188 | + * @var current height of page in points |
|
| 189 | + * @access protected |
|
| 190 | + */ |
|
| 191 | 191 | var $hPt; |
| 192 | 192 | |
| 193 | 193 | /** |
| 194 | - * @var current width of page in user unit |
|
| 195 | - * @access protected |
|
| 196 | - */ |
|
| 194 | + * @var current width of page in user unit |
|
| 195 | + * @access protected |
|
| 196 | + */ |
|
| 197 | 197 | var $w; |
| 198 | 198 | |
| 199 | 199 | /** |
| 200 | - * @var current height of page in user unit |
|
| 201 | - * @access protected |
|
| 202 | - */ |
|
| 200 | + * @var current height of page in user unit |
|
| 201 | + * @access protected |
|
| 202 | + */ |
|
| 203 | 203 | var $h; |
| 204 | 204 | |
| 205 | 205 | /** |
| 206 | - * @var left margin |
|
| 207 | - * @access protected |
|
| 208 | - */ |
|
| 206 | + * @var left margin |
|
| 207 | + * @access protected |
|
| 208 | + */ |
|
| 209 | 209 | var $lMargin; |
| 210 | 210 | |
| 211 | 211 | /** |
| 212 | - * @var top margin |
|
| 213 | - * @access protected |
|
| 214 | - */ |
|
| 212 | + * @var top margin |
|
| 213 | + * @access protected |
|
| 214 | + */ |
|
| 215 | 215 | var $tMargin; |
| 216 | 216 | |
| 217 | 217 | /** |
| 218 | - * @var right margin |
|
| 219 | - * @access protected |
|
| 220 | - */ |
|
| 218 | + * @var right margin |
|
| 219 | + * @access protected |
|
| 220 | + */ |
|
| 221 | 221 | var $rMargin; |
| 222 | 222 | |
| 223 | 223 | /** |
| 224 | - * @var page break margin |
|
| 225 | - * @access protected |
|
| 226 | - */ |
|
| 224 | + * @var page break margin |
|
| 225 | + * @access protected |
|
| 226 | + */ |
|
| 227 | 227 | var $bMargin; |
| 228 | 228 | |
| 229 | 229 | /** |
| 230 | - * @var cell margin |
|
| 231 | - * @access protected |
|
| 232 | - */ |
|
| 230 | + * @var cell margin |
|
| 231 | + * @access protected |
|
| 232 | + */ |
|
| 233 | 233 | var $cMargin; |
| 234 | 234 | |
| 235 | 235 | /** |
| 236 | - * @var current horizontal position in user unit for cell positioning |
|
| 237 | - * @access protected |
|
| 238 | - */ |
|
| 236 | + * @var current horizontal position in user unit for cell positioning |
|
| 237 | + * @access protected |
|
| 238 | + */ |
|
| 239 | 239 | var $x; |
| 240 | 240 | |
| 241 | 241 | /** |
| 242 | - * @var current vertical position in user unit for cell positioning |
|
| 243 | - * @access protected |
|
| 244 | - */ |
|
| 242 | + * @var current vertical position in user unit for cell positioning |
|
| 243 | + * @access protected |
|
| 244 | + */ |
|
| 245 | 245 | var $y; |
| 246 | 246 | |
| 247 | 247 | /** |
| 248 | - * @var height of last cell printed |
|
| 249 | - * @access protected |
|
| 250 | - */ |
|
| 248 | + * @var height of last cell printed |
|
| 249 | + * @access protected |
|
| 250 | + */ |
|
| 251 | 251 | var $lasth; |
| 252 | 252 | |
| 253 | 253 | /** |
| 254 | - * @var line width in user unit |
|
| 255 | - * @access protected |
|
| 256 | - */ |
|
| 254 | + * @var line width in user unit |
|
| 255 | + * @access protected |
|
| 256 | + */ |
|
| 257 | 257 | var $LineWidth; |
| 258 | 258 | |
| 259 | 259 | /** |
| 260 | - * @var array of standard font names |
|
| 261 | - * @access protected |
|
| 262 | - */ |
|
| 260 | + * @var array of standard font names |
|
| 261 | + * @access protected |
|
| 262 | + */ |
|
| 263 | 263 | var $CoreFonts; |
| 264 | 264 | |
| 265 | 265 | /** |
| 266 | - * @var array of used fonts |
|
| 267 | - * @access protected |
|
| 268 | - */ |
|
| 266 | + * @var array of used fonts |
|
| 267 | + * @access protected |
|
| 268 | + */ |
|
| 269 | 269 | var $fonts; |
| 270 | 270 | |
| 271 | 271 | /** |
| 272 | - * @var array of font files |
|
| 273 | - * @access protected |
|
| 274 | - */ |
|
| 272 | + * @var array of font files |
|
| 273 | + * @access protected |
|
| 274 | + */ |
|
| 275 | 275 | var $FontFiles; |
| 276 | 276 | |
| 277 | 277 | /** |
| 278 | - * @var array of encoding differences |
|
| 279 | - * @access protected |
|
| 280 | - */ |
|
| 278 | + * @var array of encoding differences |
|
| 279 | + * @access protected |
|
| 280 | + */ |
|
| 281 | 281 | var $diffs; |
| 282 | 282 | |
| 283 | 283 | /** |
| 284 | - * @var array of used images |
|
| 285 | - * @access protected |
|
| 286 | - */ |
|
| 284 | + * @var array of used images |
|
| 285 | + * @access protected |
|
| 286 | + */ |
|
| 287 | 287 | var $images; |
| 288 | 288 | |
| 289 | 289 | /** |
| 290 | - * @var array of links in pages |
|
| 291 | - * @access protected |
|
| 292 | - */ |
|
| 290 | + * @var array of links in pages |
|
| 291 | + * @access protected |
|
| 292 | + */ |
|
| 293 | 293 | var $PageLinks; |
| 294 | 294 | |
| 295 | 295 | /** |
| 296 | - * @var array of internal links |
|
| 297 | - * @access protected |
|
| 298 | - */ |
|
| 296 | + * @var array of internal links |
|
| 297 | + * @access protected |
|
| 298 | + */ |
|
| 299 | 299 | var $links; |
| 300 | 300 | |
| 301 | 301 | /** |
| 302 | - * @var current font family |
|
| 303 | - * @access protected |
|
| 304 | - */ |
|
| 302 | + * @var current font family |
|
| 303 | + * @access protected |
|
| 304 | + */ |
|
| 305 | 305 | var $FontFamily; |
| 306 | 306 | |
| 307 | 307 | /** |
| 308 | - * @var current font style |
|
| 309 | - * @access protected |
|
| 310 | - */ |
|
| 308 | + * @var current font style |
|
| 309 | + * @access protected |
|
| 310 | + */ |
|
| 311 | 311 | var $FontStyle; |
| 312 | 312 | |
| 313 | 313 | /** |
| 314 | - * @var underlining flag |
|
| 315 | - * @access protected |
|
| 316 | - */ |
|
| 314 | + * @var underlining flag |
|
| 315 | + * @access protected |
|
| 316 | + */ |
|
| 317 | 317 | var $underline; |
| 318 | 318 | |
| 319 | 319 | /** |
| 320 | - * @var current font info |
|
| 321 | - * @access protected |
|
| 322 | - */ |
|
| 320 | + * @var current font info |
|
| 321 | + * @access protected |
|
| 322 | + */ |
|
| 323 | 323 | var $CurrentFont; |
| 324 | 324 | |
| 325 | 325 | /** |
| 326 | - * @var current font size in points |
|
| 327 | - * @access protected |
|
| 328 | - */ |
|
| 326 | + * @var current font size in points |
|
| 327 | + * @access protected |
|
| 328 | + */ |
|
| 329 | 329 | var $FontSizePt; |
| 330 | 330 | |
| 331 | 331 | /** |
| 332 | - * @var current font size in user unit |
|
| 333 | - * @access protected |
|
| 334 | - */ |
|
| 332 | + * @var current font size in user unit |
|
| 333 | + * @access protected |
|
| 334 | + */ |
|
| 335 | 335 | var $FontSize; |
| 336 | 336 | |
| 337 | 337 | /** |
| 338 | - * @var commands for drawing color |
|
| 339 | - * @access protected |
|
| 340 | - */ |
|
| 338 | + * @var commands for drawing color |
|
| 339 | + * @access protected |
|
| 340 | + */ |
|
| 341 | 341 | var $DrawColor; |
| 342 | 342 | |
| 343 | 343 | /** |
| 344 | - * @var commands for filling color |
|
| 345 | - * @access protected |
|
| 346 | - */ |
|
| 344 | + * @var commands for filling color |
|
| 345 | + * @access protected |
|
| 346 | + */ |
|
| 347 | 347 | var $FillColor; |
| 348 | 348 | |
| 349 | 349 | /** |
| 350 | - * @var commands for text color |
|
| 351 | - * @access protected |
|
| 352 | - */ |
|
| 350 | + * @var commands for text color |
|
| 351 | + * @access protected |
|
| 352 | + */ |
|
| 353 | 353 | var $TextColor; |
| 354 | 354 | |
| 355 | 355 | /** |
| 356 | - * @var indicates whether fill and text colors are different |
|
| 357 | - * @access protected |
|
| 358 | - */ |
|
| 356 | + * @var indicates whether fill and text colors are different |
|
| 357 | + * @access protected |
|
| 358 | + */ |
|
| 359 | 359 | var $ColorFlag; |
| 360 | 360 | |
| 361 | 361 | /** |
| 362 | - * @var word spacing |
|
| 363 | - * @access protected |
|
| 364 | - */ |
|
| 362 | + * @var word spacing |
|
| 363 | + * @access protected |
|
| 364 | + */ |
|
| 365 | 365 | var $ws; |
| 366 | 366 | |
| 367 | 367 | /** |
| 368 | - * @var automatic page breaking |
|
| 369 | - * @access protected |
|
| 370 | - */ |
|
| 368 | + * @var automatic page breaking |
|
| 369 | + * @access protected |
|
| 370 | + */ |
|
| 371 | 371 | var $AutoPageBreak; |
| 372 | 372 | |
| 373 | 373 | /** |
| 374 | - * @var threshold used to trigger page breaks |
|
| 375 | - * @access protected |
|
| 376 | - */ |
|
| 374 | + * @var threshold used to trigger page breaks |
|
| 375 | + * @access protected |
|
| 376 | + */ |
|
| 377 | 377 | var $PageBreakTrigger; |
| 378 | 378 | |
| 379 | 379 | /** |
| 380 | - * @var flag set when processing footer |
|
| 381 | - * @access protected |
|
| 382 | - */ |
|
| 380 | + * @var flag set when processing footer |
|
| 381 | + * @access protected |
|
| 382 | + */ |
|
| 383 | 383 | var $InFooter; |
| 384 | 384 | |
| 385 | 385 | /** |
| 386 | - * @var zoom display mode |
|
| 387 | - * @access protected |
|
| 388 | - */ |
|
| 386 | + * @var zoom display mode |
|
| 387 | + * @access protected |
|
| 388 | + */ |
|
| 389 | 389 | var $ZoomMode; |
| 390 | 390 | |
| 391 | 391 | /** |
| 392 | - * @var layout display mode |
|
| 393 | - * @access protected |
|
| 394 | - */ |
|
| 392 | + * @var layout display mode |
|
| 393 | + * @access protected |
|
| 394 | + */ |
|
| 395 | 395 | var $LayoutMode; |
| 396 | 396 | |
| 397 | 397 | /** |
| 398 | - * @var title |
|
| 399 | - * @access protected |
|
| 400 | - */ |
|
| 398 | + * @var title |
|
| 399 | + * @access protected |
|
| 400 | + */ |
|
| 401 | 401 | var $title; |
| 402 | 402 | |
| 403 | 403 | /** |
| 404 | - * @var subject |
|
| 405 | - * @access protected |
|
| 406 | - */ |
|
| 404 | + * @var subject |
|
| 405 | + * @access protected |
|
| 406 | + */ |
|
| 407 | 407 | var $subject; |
| 408 | 408 | |
| 409 | 409 | /** |
| 410 | - * @var author |
|
| 411 | - * @access protected |
|
| 412 | - */ |
|
| 410 | + * @var author |
|
| 411 | + * @access protected |
|
| 412 | + */ |
|
| 413 | 413 | var $author; |
| 414 | 414 | |
| 415 | 415 | /** |
| 416 | - * @var keywords |
|
| 417 | - * @access protected |
|
| 418 | - */ |
|
| 416 | + * @var keywords |
|
| 417 | + * @access protected |
|
| 418 | + */ |
|
| 419 | 419 | var $keywords; |
| 420 | 420 | |
| 421 | 421 | /** |
| 422 | - * @var creator |
|
| 423 | - * @access protected |
|
| 424 | - */ |
|
| 422 | + * @var creator |
|
| 423 | + * @access protected |
|
| 424 | + */ |
|
| 425 | 425 | var $creator; |
| 426 | 426 | |
| 427 | 427 | /** |
| 428 | - * @var alias for total number of pages |
|
| 429 | - * @access protected |
|
| 430 | - */ |
|
| 428 | + * @var alias for total number of pages |
|
| 429 | + * @access protected |
|
| 430 | + */ |
|
| 431 | 431 | var $AliasNbPages; |
| 432 | 432 | |
| 433 | 433 | /** |
| 434 | - * @var right-bottom corner X coordinate of inserted image |
|
| 435 | - * @since 2002-07-31 |
|
| 436 | - * @author Nicola Asuni |
|
| 437 | - * @access protected |
|
| 438 | - */ |
|
| 434 | + * @var right-bottom corner X coordinate of inserted image |
|
| 435 | + * @since 2002-07-31 |
|
| 436 | + * @author Nicola Asuni |
|
| 437 | + * @access protected |
|
| 438 | + */ |
|
| 439 | 439 | var $img_rb_x; |
| 440 | 440 | |
| 441 | 441 | /** |
| 442 | - * @var right-bottom corner Y coordinate of inserted image |
|
| 443 | - * @since 2002-07-31 |
|
| 444 | - * @author Nicola Asuni |
|
| 445 | - * @access protected |
|
| 446 | - */ |
|
| 442 | + * @var right-bottom corner Y coordinate of inserted image |
|
| 443 | + * @since 2002-07-31 |
|
| 444 | + * @author Nicola Asuni |
|
| 445 | + * @access protected |
|
| 446 | + */ |
|
| 447 | 447 | var $img_rb_y; |
| 448 | 448 | |
| 449 | 449 | /** |
| 450 | - * @var image scale factor |
|
| 451 | - * @since 2004-06-14 |
|
| 452 | - * @author Nicola Asuni |
|
| 453 | - * @access protected |
|
| 454 | - */ |
|
| 450 | + * @var image scale factor |
|
| 451 | + * @since 2004-06-14 |
|
| 452 | + * @author Nicola Asuni |
|
| 453 | + * @access protected |
|
| 454 | + */ |
|
| 455 | 455 | var $imgscale = 1; |
| 456 | 456 | |
| 457 | 457 | /** |
| 458 | - * @var boolean set to true when the input text is unicode (require unicode fonts) |
|
| 459 | - * @since 2005-01-02 |
|
| 460 | - * @author Nicola Asuni |
|
| 461 | - * @access protected |
|
| 462 | - */ |
|
| 458 | + * @var boolean set to true when the input text is unicode (require unicode fonts) |
|
| 459 | + * @since 2005-01-02 |
|
| 460 | + * @author Nicola Asuni |
|
| 461 | + * @access protected |
|
| 462 | + */ |
|
| 463 | 463 | var $isunicode = false; |
| 464 | 464 | |
| 465 | 465 | /** |
| 466 | - * @var PDF version |
|
| 467 | - * @since 1.5.3 |
|
| 468 | - * @access protected |
|
| 469 | - */ |
|
| 466 | + * @var PDF version |
|
| 467 | + * @since 1.5.3 |
|
| 468 | + * @access protected |
|
| 469 | + */ |
|
| 470 | 470 | var $PDFVersion = "1.3"; |
| 471 | 471 | |
| 472 | 472 | |
@@ -918,73 +918,73 @@ discard block |
||
| 918 | 918 | } |
| 919 | 919 | |
| 920 | 920 | /** |
| 921 | - * Set the image scale. |
|
| 922 | - * @param float $scale image scale. |
|
| 923 | - * @author Nicola Asuni |
|
| 924 | - * @since 1.5.2 |
|
| 925 | - */ |
|
| 921 | + * Set the image scale. |
|
| 922 | + * @param float $scale image scale. |
|
| 923 | + * @author Nicola Asuni |
|
| 924 | + * @since 1.5.2 |
|
| 925 | + */ |
|
| 926 | 926 | function setImageScale($scale) { |
| 927 | 927 | $this->imgscale=$scale; |
| 928 | 928 | } |
| 929 | 929 | |
| 930 | 930 | /** |
| 931 | - * Returns the image scale. |
|
| 932 | - * @return float image scale. |
|
| 933 | - * @author Nicola Asuni |
|
| 934 | - * @since 1.5.2 |
|
| 935 | - */ |
|
| 931 | + * Returns the image scale. |
|
| 932 | + * @return float image scale. |
|
| 933 | + * @author Nicola Asuni |
|
| 934 | + * @since 1.5.2 |
|
| 935 | + */ |
|
| 936 | 936 | function getImageScale() { |
| 937 | 937 | return $this->imgscale; |
| 938 | 938 | } |
| 939 | 939 | |
| 940 | 940 | /** |
| 941 | - * Returns the page width in units. |
|
| 942 | - * @return int page width. |
|
| 943 | - * @author Nicola Asuni |
|
| 944 | - * @since 1.5.2 |
|
| 945 | - */ |
|
| 941 | + * Returns the page width in units. |
|
| 942 | + * @return int page width. |
|
| 943 | + * @author Nicola Asuni |
|
| 944 | + * @since 1.5.2 |
|
| 945 | + */ |
|
| 946 | 946 | function getPageWidth() { |
| 947 | 947 | return $this->w; |
| 948 | 948 | } |
| 949 | 949 | |
| 950 | 950 | /** |
| 951 | - * Returns the page height in units. |
|
| 952 | - * @return int page height. |
|
| 953 | - * @author Nicola Asuni |
|
| 954 | - * @since 1.5.2 |
|
| 955 | - */ |
|
| 951 | + * Returns the page height in units. |
|
| 952 | + * @return int page height. |
|
| 953 | + * @author Nicola Asuni |
|
| 954 | + * @since 1.5.2 |
|
| 955 | + */ |
|
| 956 | 956 | function getPageHeight() { |
| 957 | 957 | return $this->h; |
| 958 | 958 | } |
| 959 | 959 | |
| 960 | 960 | /** |
| 961 | - * Returns the page break margin. |
|
| 962 | - * @return int page break margin. |
|
| 963 | - * @author Nicola Asuni |
|
| 964 | - * @since 1.5.2 |
|
| 965 | - */ |
|
| 961 | + * Returns the page break margin. |
|
| 962 | + * @return int page break margin. |
|
| 963 | + * @author Nicola Asuni |
|
| 964 | + * @since 1.5.2 |
|
| 965 | + */ |
|
| 966 | 966 | function getBreakMargin() { |
| 967 | 967 | return $this->bMargin; |
| 968 | 968 | } |
| 969 | 969 | |
| 970 | 970 | /** |
| 971 | - * Returns the scale factor (number of points in user unit). |
|
| 972 | - * @return int scale factor. |
|
| 973 | - * @author Nicola Asuni |
|
| 974 | - * @since 1.5.2 |
|
| 975 | - */ |
|
| 971 | + * Returns the scale factor (number of points in user unit). |
|
| 972 | + * @return int scale factor. |
|
| 973 | + * @author Nicola Asuni |
|
| 974 | + * @since 1.5.2 |
|
| 975 | + */ |
|
| 976 | 976 | function getScaleFactor() { |
| 977 | 977 | return $this->k; |
| 978 | 978 | } |
| 979 | 979 | |
| 980 | 980 | /** |
| 981 | - * Defines the left, top and right margins. By default, they equal 1 cm. Call this method to change them. |
|
| 982 | - * @param float $left Left margin. |
|
| 983 | - * @param float $top Top margin. |
|
| 984 | - * @param float $right Right margin. Default value is the left one. |
|
| 985 | - * @since 1.0 |
|
| 986 | - * @see SetLeftMargin(), SetTopMargin(), SetRightMargin(), SetAutoPageBreak() |
|
| 987 | - */ |
|
| 981 | + * Defines the left, top and right margins. By default, they equal 1 cm. Call this method to change them. |
|
| 982 | + * @param float $left Left margin. |
|
| 983 | + * @param float $top Top margin. |
|
| 984 | + * @param float $right Right margin. Default value is the left one. |
|
| 985 | + * @since 1.0 |
|
| 986 | + * @see SetLeftMargin(), SetTopMargin(), SetRightMargin(), SetAutoPageBreak() |
|
| 987 | + */ |
|
| 988 | 988 | function SetMargins($left, $top, $right=-1) { |
| 989 | 989 | //Set left, top and right margins |
| 990 | 990 | $this->lMargin=$left; |
@@ -996,11 +996,11 @@ discard block |
||
| 996 | 996 | } |
| 997 | 997 | |
| 998 | 998 | /** |
| 999 | - * Defines the left margin. The method can be called before creating the first page. If the current abscissa gets out of page, it is brought back to the margin. |
|
| 1000 | - * @param float $margin The margin. |
|
| 1001 | - * @since 1.4 |
|
| 1002 | - * @see SetTopMargin(), SetRightMargin(), SetAutoPageBreak(), SetMargins() |
|
| 1003 | - */ |
|
| 999 | + * Defines the left margin. The method can be called before creating the first page. If the current abscissa gets out of page, it is brought back to the margin. |
|
| 1000 | + * @param float $margin The margin. |
|
| 1001 | + * @since 1.4 |
|
| 1002 | + * @see SetTopMargin(), SetRightMargin(), SetAutoPageBreak(), SetMargins() |
|
| 1003 | + */ |
|
| 1004 | 1004 | function SetLeftMargin($margin) { |
| 1005 | 1005 | //Set left margin |
| 1006 | 1006 | $this->lMargin=$margin; |
@@ -1010,34 +1010,34 @@ discard block |
||
| 1010 | 1010 | } |
| 1011 | 1011 | |
| 1012 | 1012 | /** |
| 1013 | - * Defines the top margin. The method can be called before creating the first page. |
|
| 1014 | - * @param float $margin The margin. |
|
| 1015 | - * @since 1.5 |
|
| 1016 | - * @see SetLeftMargin(), SetRightMargin(), SetAutoPageBreak(), SetMargins() |
|
| 1017 | - */ |
|
| 1013 | + * Defines the top margin. The method can be called before creating the first page. |
|
| 1014 | + * @param float $margin The margin. |
|
| 1015 | + * @since 1.5 |
|
| 1016 | + * @see SetLeftMargin(), SetRightMargin(), SetAutoPageBreak(), SetMargins() |
|
| 1017 | + */ |
|
| 1018 | 1018 | function SetTopMargin($margin) { |
| 1019 | 1019 | //Set top margin |
| 1020 | 1020 | $this->tMargin=$margin; |
| 1021 | 1021 | } |
| 1022 | 1022 | |
| 1023 | 1023 | /** |
| 1024 | - * Defines the right margin. The method can be called before creating the first page. |
|
| 1025 | - * @param float $margin The margin. |
|
| 1026 | - * @since 1.5 |
|
| 1027 | - * @see SetLeftMargin(), SetTopMargin(), SetAutoPageBreak(), SetMargins() |
|
| 1028 | - */ |
|
| 1024 | + * Defines the right margin. The method can be called before creating the first page. |
|
| 1025 | + * @param float $margin The margin. |
|
| 1026 | + * @since 1.5 |
|
| 1027 | + * @see SetLeftMargin(), SetTopMargin(), SetAutoPageBreak(), SetMargins() |
|
| 1028 | + */ |
|
| 1029 | 1029 | function SetRightMargin($margin) { |
| 1030 | 1030 | //Set right margin |
| 1031 | 1031 | $this->rMargin=$margin; |
| 1032 | 1032 | } |
| 1033 | 1033 | |
| 1034 | 1034 | /** |
| 1035 | - * Enables or disables the automatic page breaking mode. When enabling, the second parameter is the distance from the bottom of the page that defines the triggering limit. By default, the mode is on and the margin is 2 cm. |
|
| 1036 | - * @param boolean $auto Boolean indicating if mode should be on or off. |
|
| 1037 | - * @param float $margin Distance from the bottom of the page. |
|
| 1038 | - * @since 1.0 |
|
| 1039 | - * @see Cell(), MultiCell(), AcceptPageBreak() |
|
| 1040 | - */ |
|
| 1035 | + * Enables or disables the automatic page breaking mode. When enabling, the second parameter is the distance from the bottom of the page that defines the triggering limit. By default, the mode is on and the margin is 2 cm. |
|
| 1036 | + * @param boolean $auto Boolean indicating if mode should be on or off. |
|
| 1037 | + * @param float $margin Distance from the bottom of the page. |
|
| 1038 | + * @since 1.0 |
|
| 1039 | + * @see Cell(), MultiCell(), AcceptPageBreak() |
|
| 1040 | + */ |
|
| 1041 | 1041 | function SetAutoPageBreak($auto, $margin=0) { |
| 1042 | 1042 | //Set auto page break mode and triggering margin |
| 1043 | 1043 | $this->AutoPageBreak=$auto; |
@@ -1046,11 +1046,11 @@ discard block |
||
| 1046 | 1046 | } |
| 1047 | 1047 | |
| 1048 | 1048 | /** |
| 1049 | - * Defines the way the document is to be displayed by the viewer. The zoom level can be set: pages can be displayed entirely on screen, occupy the full width of the window, use real size, be scaled by a specific zooming factor or use viewer default (configured in the Preferences menu of Acrobat). The page layout can be specified too: single at once, continuous display, two columns or viewer default. By default, documents use the full width mode with continuous display. |
|
| 1050 | - * @param mixed $zoom The zoom to use. It can be one of the following string values or a number indicating the zooming factor to use. <ul><li>fullpage: displays the entire page on screen </li><li>fullwidth: uses maximum width of window</li><li>real: uses real size (equivalent to 100% zoom)</li><li>default: uses viewer default mode</li></ul> |
|
| 1051 | - * @param string $layout The page layout. Possible values are:<ul><li>single: displays one page at once</li><li>continuous: displays pages continuously (default)</li><li>two: displays two pages on two columns</li><li>default: uses viewer default mode</li></ul> |
|
| 1052 | - * @since 1.2 |
|
| 1053 | - */ |
|
| 1049 | + * Defines the way the document is to be displayed by the viewer. The zoom level can be set: pages can be displayed entirely on screen, occupy the full width of the window, use real size, be scaled by a specific zooming factor or use viewer default (configured in the Preferences menu of Acrobat). The page layout can be specified too: single at once, continuous display, two columns or viewer default. By default, documents use the full width mode with continuous display. |
|
| 1050 | + * @param mixed $zoom The zoom to use. It can be one of the following string values or a number indicating the zooming factor to use. <ul><li>fullpage: displays the entire page on screen </li><li>fullwidth: uses maximum width of window</li><li>real: uses real size (equivalent to 100% zoom)</li><li>default: uses viewer default mode</li></ul> |
|
| 1051 | + * @param string $layout The page layout. Possible values are:<ul><li>single: displays one page at once</li><li>continuous: displays pages continuously (default)</li><li>two: displays two pages on two columns</li><li>default: uses viewer default mode</li></ul> |
|
| 1052 | + * @since 1.2 |
|
| 1053 | + */ |
|
| 1054 | 1054 | function SetDisplayMode($zoom, $layout='continuous') { |
| 1055 | 1055 | //Set display mode in viewer |
| 1056 | 1056 | if($zoom=='fullpage' or $zoom=='fullwidth' or $zoom=='real' or $zoom=='default' or !is_string($zoom)) { |
@@ -1068,11 +1068,11 @@ discard block |
||
| 1068 | 1068 | } |
| 1069 | 1069 | |
| 1070 | 1070 | /** |
| 1071 | - * Activates or deactivates page compression. When activated, the internal representation of each page is compressed, which leads to a compression ratio of about 2 for the resulting document. Compression is on by default. |
|
| 1072 | - * Note: the Zlib extension is required for this feature. If not present, compression will be turned off. |
|
| 1073 | - * @param boolean $compress Boolean indicating if compression must be enabled. |
|
| 1074 | - * @since 1.4 |
|
| 1075 | - */ |
|
| 1071 | + * Activates or deactivates page compression. When activated, the internal representation of each page is compressed, which leads to a compression ratio of about 2 for the resulting document. Compression is on by default. |
|
| 1072 | + * Note: the Zlib extension is required for this feature. If not present, compression will be turned off. |
|
| 1073 | + * @param boolean $compress Boolean indicating if compression must be enabled. |
|
| 1074 | + * @since 1.4 |
|
| 1075 | + */ |
|
| 1076 | 1076 | function SetCompression($compress) { |
| 1077 | 1077 | //Set page compression |
| 1078 | 1078 | if(function_exists('gzcompress')) { |
@@ -1084,113 +1084,113 @@ discard block |
||
| 1084 | 1084 | } |
| 1085 | 1085 | |
| 1086 | 1086 | /** |
| 1087 | - * Defines the title of the document. |
|
| 1088 | - * @param string $title The title. |
|
| 1089 | - * @since 1.2 |
|
| 1090 | - * @see SetAuthor(), SetCreator(), SetKeywords(), SetSubject() |
|
| 1091 | - */ |
|
| 1087 | + * Defines the title of the document. |
|
| 1088 | + * @param string $title The title. |
|
| 1089 | + * @since 1.2 |
|
| 1090 | + * @see SetAuthor(), SetCreator(), SetKeywords(), SetSubject() |
|
| 1091 | + */ |
|
| 1092 | 1092 | function SetTitle($title) { |
| 1093 | 1093 | //Title of document |
| 1094 | 1094 | $this->title=$title; |
| 1095 | 1095 | } |
| 1096 | 1096 | |
| 1097 | 1097 | /** |
| 1098 | - * Defines the subject of the document. |
|
| 1099 | - * @param string $subject The subject. |
|
| 1100 | - * @since 1.2 |
|
| 1101 | - * @see SetAuthor(), SetCreator(), SetKeywords(), SetTitle() |
|
| 1102 | - */ |
|
| 1098 | + * Defines the subject of the document. |
|
| 1099 | + * @param string $subject The subject. |
|
| 1100 | + * @since 1.2 |
|
| 1101 | + * @see SetAuthor(), SetCreator(), SetKeywords(), SetTitle() |
|
| 1102 | + */ |
|
| 1103 | 1103 | function SetSubject($subject) { |
| 1104 | 1104 | //Subject of document |
| 1105 | 1105 | $this->subject=$subject; |
| 1106 | 1106 | } |
| 1107 | 1107 | |
| 1108 | 1108 | /** |
| 1109 | - * Defines the author of the document. |
|
| 1110 | - * @param string $author The name of the author. |
|
| 1111 | - * @since 1.2 |
|
| 1112 | - * @see SetCreator(), SetKeywords(), SetSubject(), SetTitle() |
|
| 1113 | - */ |
|
| 1109 | + * Defines the author of the document. |
|
| 1110 | + * @param string $author The name of the author. |
|
| 1111 | + * @since 1.2 |
|
| 1112 | + * @see SetCreator(), SetKeywords(), SetSubject(), SetTitle() |
|
| 1113 | + */ |
|
| 1114 | 1114 | function SetAuthor($author) { |
| 1115 | 1115 | //Author of document |
| 1116 | 1116 | $this->author=$author; |
| 1117 | 1117 | } |
| 1118 | 1118 | |
| 1119 | 1119 | /** |
| 1120 | - * Associates keywords with the document, generally in the form 'keyword1 keyword2 ...'. |
|
| 1121 | - * @param string $keywords The list of keywords. |
|
| 1122 | - * @since 1.2 |
|
| 1123 | - * @see SetAuthor(), SetCreator(), SetSubject(), SetTitle() |
|
| 1124 | - */ |
|
| 1120 | + * Associates keywords with the document, generally in the form 'keyword1 keyword2 ...'. |
|
| 1121 | + * @param string $keywords The list of keywords. |
|
| 1122 | + * @since 1.2 |
|
| 1123 | + * @see SetAuthor(), SetCreator(), SetSubject(), SetTitle() |
|
| 1124 | + */ |
|
| 1125 | 1125 | function SetKeywords($keywords) { |
| 1126 | 1126 | //Keywords of document |
| 1127 | 1127 | $this->keywords=$keywords; |
| 1128 | 1128 | } |
| 1129 | 1129 | |
| 1130 | 1130 | /** |
| 1131 | - * Defines the creator of the document. This is typically the name of the application that generates the PDF. |
|
| 1132 | - * @param string $creator The name of the creator. |
|
| 1133 | - * @since 1.2 |
|
| 1134 | - * @see SetAuthor(), SetKeywords(), SetSubject(), SetTitle() |
|
| 1135 | - */ |
|
| 1131 | + * Defines the creator of the document. This is typically the name of the application that generates the PDF. |
|
| 1132 | + * @param string $creator The name of the creator. |
|
| 1133 | + * @since 1.2 |
|
| 1134 | + * @see SetAuthor(), SetKeywords(), SetSubject(), SetTitle() |
|
| 1135 | + */ |
|
| 1136 | 1136 | function SetCreator($creator) { |
| 1137 | 1137 | //Creator of document |
| 1138 | 1138 | $this->creator=$creator; |
| 1139 | 1139 | } |
| 1140 | 1140 | |
| 1141 | 1141 | /** |
| 1142 | - * Defines an alias for the total number of pages. It will be substituted as the document is closed.<br /> |
|
| 1143 | - * <b>Example:</b><br /> |
|
| 1144 | - * <pre> |
|
| 1145 | - * class PDF extends TCPDF { |
|
| 1146 | - * function Footer() { |
|
| 1147 | - * //Go to 1.5 cm from bottom |
|
| 1148 | - * $this->SetY(-15); |
|
| 1149 | - * //Select Arial italic 8 |
|
| 1150 | - * $this->SetFont('Arial','I',8); |
|
| 1151 | - * //Print current and total page numbers |
|
| 1152 | - * $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C'); |
|
| 1153 | - * } |
|
| 1154 | - * } |
|
| 1155 | - * $pdf=new PDF(); |
|
| 1156 | - * $pdf->AliasNbPages(); |
|
| 1157 | - * </pre> |
|
| 1158 | - * @param string $alias The alias. Default value: {nb}. |
|
| 1159 | - * @since 1.4 |
|
| 1160 | - * @see PageNo(), Footer() |
|
| 1161 | - */ |
|
| 1142 | + * Defines an alias for the total number of pages. It will be substituted as the document is closed.<br /> |
|
| 1143 | + * <b>Example:</b><br /> |
|
| 1144 | + * <pre> |
|
| 1145 | + * class PDF extends TCPDF { |
|
| 1146 | + * function Footer() { |
|
| 1147 | + * //Go to 1.5 cm from bottom |
|
| 1148 | + * $this->SetY(-15); |
|
| 1149 | + * //Select Arial italic 8 |
|
| 1150 | + * $this->SetFont('Arial','I',8); |
|
| 1151 | + * //Print current and total page numbers |
|
| 1152 | + * $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C'); |
|
| 1153 | + * } |
|
| 1154 | + * } |
|
| 1155 | + * $pdf=new PDF(); |
|
| 1156 | + * $pdf->AliasNbPages(); |
|
| 1157 | + * </pre> |
|
| 1158 | + * @param string $alias The alias. Default value: {nb}. |
|
| 1159 | + * @since 1.4 |
|
| 1160 | + * @see PageNo(), Footer() |
|
| 1161 | + */ |
|
| 1162 | 1162 | function AliasNbPages($alias='{nb}') { |
| 1163 | 1163 | //Define an alias for total number of pages |
| 1164 | 1164 | $this->AliasNbPages = $this->_escapetext($alias); |
| 1165 | 1165 | } |
| 1166 | 1166 | |
| 1167 | 1167 | /** |
| 1168 | - * This method is automatically called in case of fatal error; it simply outputs the message and halts the execution. An inherited class may override it to customize the error handling but should always halt the script, or the resulting document would probably be invalid. |
|
| 1169 | - * 2004-06-11 :: Nicola Asuni : changed bold tag with strong |
|
| 1170 | - * @param string $msg The error message |
|
| 1171 | - * @since 1.0 |
|
| 1172 | - */ |
|
| 1168 | + * This method is automatically called in case of fatal error; it simply outputs the message and halts the execution. An inherited class may override it to customize the error handling but should always halt the script, or the resulting document would probably be invalid. |
|
| 1169 | + * 2004-06-11 :: Nicola Asuni : changed bold tag with strong |
|
| 1170 | + * @param string $msg The error message |
|
| 1171 | + * @since 1.0 |
|
| 1172 | + */ |
|
| 1173 | 1173 | function Error($msg) { |
| 1174 | 1174 | //Fatal error |
| 1175 | 1175 | die('<strong>TCPDF error: </strong>'.$msg); |
| 1176 | 1176 | } |
| 1177 | 1177 | |
| 1178 | 1178 | /** |
| 1179 | - * This method begins the generation of the PDF document. It is not necessary to call it explicitly because AddPage() does it automatically. |
|
| 1180 | - * Note: no page is created by this method |
|
| 1181 | - * @since 1.0 |
|
| 1182 | - * @see AddPage(), Close() |
|
| 1183 | - */ |
|
| 1179 | + * This method begins the generation of the PDF document. It is not necessary to call it explicitly because AddPage() does it automatically. |
|
| 1180 | + * Note: no page is created by this method |
|
| 1181 | + * @since 1.0 |
|
| 1182 | + * @see AddPage(), Close() |
|
| 1183 | + */ |
|
| 1184 | 1184 | function Open() { |
| 1185 | 1185 | //Begin document |
| 1186 | 1186 | $this->state=1; |
| 1187 | 1187 | } |
| 1188 | 1188 | |
| 1189 | 1189 | /** |
| 1190 | - * Terminates the PDF document. It is not necessary to call this method explicitly because Output() does it automatically. If the document contains no page, AddPage() is called to prevent from getting an invalid document. |
|
| 1191 | - * @since 1.0 |
|
| 1192 | - * @see Open(), Output() |
|
| 1193 | - */ |
|
| 1190 | + * Terminates the PDF document. It is not necessary to call this method explicitly because Output() does it automatically. If the document contains no page, AddPage() is called to prevent from getting an invalid document. |
|
| 1191 | + * @since 1.0 |
|
| 1192 | + * @see Open(), Output() |
|
| 1193 | + */ |
|
| 1194 | 1194 | function Close() { |
| 1195 | 1195 | //Terminate document |
| 1196 | 1196 | if($this->state==3) { |
@@ -1210,13 +1210,13 @@ discard block |
||
| 1210 | 1210 | } |
| 1211 | 1211 | |
| 1212 | 1212 | /** |
| 1213 | - * Adds a new page to the document. If a page is already present, the Footer() method is called first to output the footer. Then the page is added, the current position set to the top-left corner according to the left and top margins, and Header() is called to display the header. |
|
| 1214 | - * The font which was set before calling is automatically restored. There is no need to call SetFont() again if you want to continue with the same font. The same is true for colors and line width. |
|
| 1215 | - * The origin of the coordinate system is at the top-left corner and increasing ordinates go downwards. |
|
| 1216 | - * @param string $orientation Page orientation. Possible values are (case insensitive):<ul><li>P or Portrait</li><li>L or Landscape</li></ul> The default value is the one passed to the constructor. |
|
| 1217 | - * @since 1.0 |
|
| 1218 | - * @see TCPDF(), Header(), Footer(), SetMargins() |
|
| 1219 | - */ |
|
| 1213 | + * Adds a new page to the document. If a page is already present, the Footer() method is called first to output the footer. Then the page is added, the current position set to the top-left corner according to the left and top margins, and Header() is called to display the header. |
|
| 1214 | + * The font which was set before calling is automatically restored. There is no need to call SetFont() again if you want to continue with the same font. The same is true for colors and line width. |
|
| 1215 | + * The origin of the coordinate system is at the top-left corner and increasing ordinates go downwards. |
|
| 1216 | + * @param string $orientation Page orientation. Possible values are (case insensitive):<ul><li>P or Portrait</li><li>L or Landscape</li></ul> The default value is the one passed to the constructor. |
|
| 1217 | + * @since 1.0 |
|
| 1218 | + * @see TCPDF(), Header(), Footer(), SetMargins() |
|
| 1219 | + */ |
|
| 1220 | 1220 | function AddPage($orientation='') { |
| 1221 | 1221 | //Start a new page |
| 1222 | 1222 | if($this->state==0) { |
@@ -1287,12 +1287,12 @@ discard block |
||
| 1287 | 1287 | |
| 1288 | 1288 | |
| 1289 | 1289 | /** |
| 1290 | - * Set header data. |
|
| 1290 | + * Set header data. |
|
| 1291 | 1291 | * @param string $ln header image logo |
| 1292 | 1292 | * @param string $lw header image logo width in mm |
| 1293 | 1293 | * @param string $ht string to print as title on document header |
| 1294 | 1294 | * @param string $hs string to print on document header |
| 1295 | - */ |
|
| 1295 | + */ |
|
| 1296 | 1296 | function setHeaderData($ln="", $lw=0, $ht="", $hs="") { |
| 1297 | 1297 | $this->header_logo = $ln; |
| 1298 | 1298 | $this->header_logo_width = $lw; |
@@ -1301,42 +1301,42 @@ discard block |
||
| 1301 | 1301 | } |
| 1302 | 1302 | |
| 1303 | 1303 | /** |
| 1304 | - * Set header margin. |
|
| 1304 | + * Set header margin. |
|
| 1305 | 1305 | * (minimum distance between header and top page margin) |
| 1306 | 1306 | * @param int $hm distance in millimeters |
| 1307 | - */ |
|
| 1307 | + */ |
|
| 1308 | 1308 | function setHeaderMargin($hm=10) { |
| 1309 | 1309 | $this->header_margin = $hm; |
| 1310 | 1310 | } |
| 1311 | 1311 | |
| 1312 | 1312 | /** |
| 1313 | - * Set footer margin. |
|
| 1313 | + * Set footer margin. |
|
| 1314 | 1314 | * (minimum distance between footer and bottom page margin) |
| 1315 | 1315 | * @param int $fm distance in millimeters |
| 1316 | - */ |
|
| 1316 | + */ |
|
| 1317 | 1317 | function setFooterMargin($fm=10) { |
| 1318 | 1318 | $this->footer_margin = $fm; |
| 1319 | 1319 | } |
| 1320 | 1320 | |
| 1321 | 1321 | /** |
| 1322 | - * Set a flag to print page header. |
|
| 1322 | + * Set a flag to print page header. |
|
| 1323 | 1323 | * @param boolean $val set to true to print the page header (default), false otherwise. |
| 1324 | - */ |
|
| 1324 | + */ |
|
| 1325 | 1325 | function setPrintHeader($val=true) { |
| 1326 | 1326 | $this->print_header = $val; |
| 1327 | 1327 | } |
| 1328 | 1328 | |
| 1329 | 1329 | /** |
| 1330 | - * Set a flag to print page footer. |
|
| 1330 | + * Set a flag to print page footer. |
|
| 1331 | 1331 | * @param boolean $value set to true to print the page footer (default), false otherwise. |
| 1332 | - */ |
|
| 1332 | + */ |
|
| 1333 | 1333 | function setPrintFooter($val=true) { |
| 1334 | 1334 | $this->print_footer = $val; |
| 1335 | 1335 | } |
| 1336 | 1336 | |
| 1337 | 1337 | /** |
| 1338 | - * This method is used to render the page header. |
|
| 1339 | - * It is automatically called by AddPage() and could be overwritten in your own inherited class. |
|
| 1338 | + * This method is used to render the page header. |
|
| 1339 | + * It is automatically called by AddPage() and could be overwritten in your own inherited class. |
|
| 1340 | 1340 | */ |
| 1341 | 1341 | function Header() { |
| 1342 | 1342 | if ($this->print_header) { |
@@ -1388,8 +1388,8 @@ discard block |
||
| 1388 | 1388 | } |
| 1389 | 1389 | |
| 1390 | 1390 | /** |
| 1391 | - * This method is used to render the page footer. |
|
| 1392 | - * It is automatically called by AddPage() and could be overwritten in your own inherited class. |
|
| 1391 | + * This method is used to render the page footer. |
|
| 1392 | + * It is automatically called by AddPage() and could be overwritten in your own inherited class. |
|
| 1393 | 1393 | */ |
| 1394 | 1394 | function Footer() { |
| 1395 | 1395 | if ($this->print_footer) { |
@@ -1429,24 +1429,24 @@ discard block |
||
| 1429 | 1429 | } |
| 1430 | 1430 | |
| 1431 | 1431 | /** |
| 1432 | - * Returns the current page number. |
|
| 1433 | - * @return int page number |
|
| 1434 | - * @since 1.0 |
|
| 1435 | - * @see AliasNbPages() |
|
| 1436 | - */ |
|
| 1432 | + * Returns the current page number. |
|
| 1433 | + * @return int page number |
|
| 1434 | + * @since 1.0 |
|
| 1435 | + * @see AliasNbPages() |
|
| 1436 | + */ |
|
| 1437 | 1437 | function PageNo() { |
| 1438 | 1438 | //Get current page number |
| 1439 | 1439 | return $this->page; |
| 1440 | 1440 | } |
| 1441 | 1441 | |
| 1442 | 1442 | /** |
| 1443 | - * Defines the color used for all drawing operations (lines, rectangles and cell borders). It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page. |
|
| 1444 | - * @param int $r If g et b are given, red component; if not, indicates the gray level. Value between 0 and 255 |
|
| 1445 | - * @param int $g Green component (between 0 and 255) |
|
| 1446 | - * @param int $b Blue component (between 0 and 255) |
|
| 1447 | - * @since 1.3 |
|
| 1448 | - * @see SetFillColor(), SetTextColor(), Line(), Rect(), Cell(), MultiCell() |
|
| 1449 | - */ |
|
| 1443 | + * Defines the color used for all drawing operations (lines, rectangles and cell borders). It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page. |
|
| 1444 | + * @param int $r If g et b are given, red component; if not, indicates the gray level. Value between 0 and 255 |
|
| 1445 | + * @param int $g Green component (between 0 and 255) |
|
| 1446 | + * @param int $b Blue component (between 0 and 255) |
|
| 1447 | + * @since 1.3 |
|
| 1448 | + * @see SetFillColor(), SetTextColor(), Line(), Rect(), Cell(), MultiCell() |
|
| 1449 | + */ |
|
| 1450 | 1450 | function SetDrawColor($r, $g=-1, $b=-1) { |
| 1451 | 1451 | //Set color for all stroking operations |
| 1452 | 1452 | if(($r==0 and $g==0 and $b==0) or $g==-1) { |
@@ -1461,14 +1461,14 @@ discard block |
||
| 1461 | 1461 | } |
| 1462 | 1462 | |
| 1463 | 1463 | /** |
| 1464 | - * Defines the color used for all filling operations (filled rectangles and cell backgrounds). It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page. |
|
| 1465 | - * @param int $r If g et b are given, red component; if not, indicates the gray level. Value between 0 and 255 |
|
| 1466 | - * @param int $g Green component (between 0 and 255) |
|
| 1467 | - * @param int $b Blue component (between 0 and 255) |
|
| 1468 | - * @param boolean $storeprev if true stores the RGB array on $prevFillColor variable. |
|
| 1469 | - * @since 1.3 |
|
| 1470 | - * @see SetDrawColor(), SetTextColor(), Rect(), Cell(), MultiCell() |
|
| 1471 | - */ |
|
| 1464 | + * Defines the color used for all filling operations (filled rectangles and cell backgrounds). It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page. |
|
| 1465 | + * @param int $r If g et b are given, red component; if not, indicates the gray level. Value between 0 and 255 |
|
| 1466 | + * @param int $g Green component (between 0 and 255) |
|
| 1467 | + * @param int $b Blue component (between 0 and 255) |
|
| 1468 | + * @param boolean $storeprev if true stores the RGB array on $prevFillColor variable. |
|
| 1469 | + * @since 1.3 |
|
| 1470 | + * @see SetDrawColor(), SetTextColor(), Rect(), Cell(), MultiCell() |
|
| 1471 | + */ |
|
| 1472 | 1472 | function SetFillColor($r, $g=-1, $b=-1, $storeprev=false) { |
| 1473 | 1473 | //Set color for all filling operations |
| 1474 | 1474 | if(($r==0 and $g==0 and $b==0) or $g==-1) { |
@@ -1488,14 +1488,14 @@ discard block |
||
| 1488 | 1488 | } |
| 1489 | 1489 | |
| 1490 | 1490 | /** |
| 1491 | - * Defines the color used for text. It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page. |
|
| 1492 | - * @param int $r If g et b are given, red component; if not, indicates the gray level. Value between 0 and 255 |
|
| 1493 | - * @param int $g Green component (between 0 and 255) |
|
| 1494 | - * @param int $b Blue component (between 0 and 255) |
|
| 1495 | - * @param boolean $storeprev if true stores the RGB array on $prevTextColor variable. |
|
| 1496 | - * @since 1.3 |
|
| 1497 | - * @see SetDrawColor(), SetFillColor(), Text(), Cell(), MultiCell() |
|
| 1498 | - */ |
|
| 1491 | + * Defines the color used for text. It can be expressed in RGB components or gray scale. The method can be called before the first page is created and the value is retained from page to page. |
|
| 1492 | + * @param int $r If g et b are given, red component; if not, indicates the gray level. Value between 0 and 255 |
|
| 1493 | + * @param int $g Green component (between 0 and 255) |
|
| 1494 | + * @param int $b Blue component (between 0 and 255) |
|
| 1495 | + * @param boolean $storeprev if true stores the RGB array on $prevTextColor variable. |
|
| 1496 | + * @since 1.3 |
|
| 1497 | + * @see SetDrawColor(), SetFillColor(), Text(), Cell(), MultiCell() |
|
| 1498 | + */ |
|
| 1499 | 1499 | function SetTextColor($r, $g=-1, $b=-1, $storeprev=false) { |
| 1500 | 1500 | //Set color for text |
| 1501 | 1501 | if(($r==0 and $g==0 and $b==0) or $g==-1) { |
@@ -1512,12 +1512,12 @@ discard block |
||
| 1512 | 1512 | } |
| 1513 | 1513 | |
| 1514 | 1514 | /** |
| 1515 | - * Returns the length of a string in user unit. A font must be selected.<br> |
|
| 1516 | - * Support UTF-8 Unicode [Nicola Asuni, 2005-01-02] |
|
| 1517 | - * @param string $s The string whose length is to be computed |
|
| 1518 | - * @return int |
|
| 1519 | - * @since 1.2 |
|
| 1520 | - */ |
|
| 1515 | + * Returns the length of a string in user unit. A font must be selected.<br> |
|
| 1516 | + * Support UTF-8 Unicode [Nicola Asuni, 2005-01-02] |
|
| 1517 | + * @param string $s The string whose length is to be computed |
|
| 1518 | + * @return int |
|
| 1519 | + * @since 1.2 |
|
| 1520 | + */ |
|
| 1521 | 1521 | function GetStringWidth($s) { |
| 1522 | 1522 | //Get width of a string in the current font |
| 1523 | 1523 | $s = (string)$s; |
@@ -1552,11 +1552,11 @@ discard block |
||
| 1552 | 1552 | } |
| 1553 | 1553 | |
| 1554 | 1554 | /** |
| 1555 | - * Defines the line width. By default, the value equals 0.2 mm. The method can be called before the first page is created and the value is retained from page to page. |
|
| 1556 | - * @param float $width The width. |
|
| 1557 | - * @since 1.0 |
|
| 1558 | - * @see Line(), Rect(), Cell(), MultiCell() |
|
| 1559 | - */ |
|
| 1555 | + * Defines the line width. By default, the value equals 0.2 mm. The method can be called before the first page is created and the value is retained from page to page. |
|
| 1556 | + * @param float $width The width. |
|
| 1557 | + * @since 1.0 |
|
| 1558 | + * @see Line(), Rect(), Cell(), MultiCell() |
|
| 1559 | + */ |
|
| 1560 | 1560 | function SetLineWidth($width) { |
| 1561 | 1561 | //Set line width |
| 1562 | 1562 | $this->LineWidth=$width; |
@@ -1566,29 +1566,29 @@ discard block |
||
| 1566 | 1566 | } |
| 1567 | 1567 | |
| 1568 | 1568 | /** |
| 1569 | - * Draws a line between two points. |
|
| 1570 | - * @param float $x1 Abscissa of first point |
|
| 1571 | - * @param float $y1 Ordinate of first point |
|
| 1572 | - * @param float $x2 Abscissa of second point |
|
| 1573 | - * @param float $y2 Ordinate of second point |
|
| 1574 | - * @since 1.0 |
|
| 1575 | - * @see SetLineWidth(), SetDrawColor() |
|
| 1576 | - */ |
|
| 1569 | + * Draws a line between two points. |
|
| 1570 | + * @param float $x1 Abscissa of first point |
|
| 1571 | + * @param float $y1 Ordinate of first point |
|
| 1572 | + * @param float $x2 Abscissa of second point |
|
| 1573 | + * @param float $y2 Ordinate of second point |
|
| 1574 | + * @since 1.0 |
|
| 1575 | + * @see SetLineWidth(), SetDrawColor() |
|
| 1576 | + */ |
|
| 1577 | 1577 | function Line($x1, $y1, $x2, $y2) { |
| 1578 | 1578 | //Draw a line |
| 1579 | 1579 | $this->_out(sprintf('%.2f %.2f m %.2f %.2f l S', $x1*$this->k, ($this->h-$y1)*$this->k, $x2*$this->k, ($this->h-$y2)*$this->k)); |
| 1580 | 1580 | } |
| 1581 | 1581 | |
| 1582 | 1582 | /** |
| 1583 | - * Outputs a rectangle. It can be drawn (border only), filled (with no border) or both. |
|
| 1584 | - * @param float $x Abscissa of upper-left corner |
|
| 1585 | - * @param float $y Ordinate of upper-left corner |
|
| 1586 | - * @param float $w Width |
|
| 1587 | - * @param float $h Height |
|
| 1588 | - * @param string $style Style of rendering. Possible values are:<ul><li>D or empty string: draw (default)</li><li>F: fill</li><li>DF or FD: draw and fill</li></ul> |
|
| 1589 | - * @since 1.0 |
|
| 1590 | - * @see SetLineWidth(), SetDrawColor(), SetFillColor() |
|
| 1591 | - */ |
|
| 1583 | + * Outputs a rectangle. It can be drawn (border only), filled (with no border) or both. |
|
| 1584 | + * @param float $x Abscissa of upper-left corner |
|
| 1585 | + * @param float $y Ordinate of upper-left corner |
|
| 1586 | + * @param float $w Width |
|
| 1587 | + * @param float $h Height |
|
| 1588 | + * @param string $style Style of rendering. Possible values are:<ul><li>D or empty string: draw (default)</li><li>F: fill</li><li>DF or FD: draw and fill</li></ul> |
|
| 1589 | + * @since 1.0 |
|
| 1590 | + * @see SetLineWidth(), SetDrawColor(), SetFillColor() |
|
| 1591 | + */ |
|
| 1592 | 1592 | function Rect($x, $y, $w, $h, $style='') { |
| 1593 | 1593 | //Draw a rectangle |
| 1594 | 1594 | if($style=='F') { |
@@ -1604,20 +1604,20 @@ discard block |
||
| 1604 | 1604 | } |
| 1605 | 1605 | |
| 1606 | 1606 | /** |
| 1607 | - * Imports a TrueType or Type1 font and makes it available. It is necessary to generate a font definition file first with the makefont.php utility. The definition file (and the font file itself when embedding) must be present either in the current directory or in the one indicated by FPDF_FONTPATH if the constant is defined. If it could not be found, the error "Could not include font definition file" is generated. |
|
| 1608 | - * Support UTF-8 Unicode [Nicola Asuni, 2005-01-02]. |
|
| 1609 | - * <b>Example</b>:<br /> |
|
| 1610 | - * <pre> |
|
| 1611 | - * $pdf->AddFont('Comic','I'); |
|
| 1612 | - * // is equivalent to: |
|
| 1613 | - * $pdf->AddFont('Comic','I','comici.php'); |
|
| 1614 | - * </pre> |
|
| 1615 | - * @param string $family Font family. The name can be chosen arbitrarily. If it is a standard family name, it will override the corresponding font. |
|
| 1616 | - * @param string $style Font style. Possible values are (case insensitive):<ul><li>empty string: regular (default)</li><li>B: bold</li><li>I: italic</li><li>BI or IB: bold italic</li></ul> |
|
| 1617 | - * @param string $file The font definition file. By default, the name is built from the family and style, in lower case with no space. |
|
| 1618 | - * @since 1.5 |
|
| 1619 | - * @see SetFont() |
|
| 1620 | - */ |
|
| 1607 | + * Imports a TrueType or Type1 font and makes it available. It is necessary to generate a font definition file first with the makefont.php utility. The definition file (and the font file itself when embedding) must be present either in the current directory or in the one indicated by FPDF_FONTPATH if the constant is defined. If it could not be found, the error "Could not include font definition file" is generated. |
|
| 1608 | + * Support UTF-8 Unicode [Nicola Asuni, 2005-01-02]. |
|
| 1609 | + * <b>Example</b>:<br /> |
|
| 1610 | + * <pre> |
|
| 1611 | + * $pdf->AddFont('Comic','I'); |
|
| 1612 | + * // is equivalent to: |
|
| 1613 | + * $pdf->AddFont('Comic','I','comici.php'); |
|
| 1614 | + * </pre> |
|
| 1615 | + * @param string $family Font family. The name can be chosen arbitrarily. If it is a standard family name, it will override the corresponding font. |
|
| 1616 | + * @param string $style Font style. Possible values are (case insensitive):<ul><li>empty string: regular (default)</li><li>B: bold</li><li>I: italic</li><li>BI or IB: bold italic</li></ul> |
|
| 1617 | + * @param string $file The font definition file. By default, the name is built from the family and style, in lower case with no space. |
|
| 1618 | + * @since 1.5 |
|
| 1619 | + * @see SetFont() |
|
| 1620 | + */ |
|
| 1621 | 1621 | function AddFont($family, $style='', $file='') { |
| 1622 | 1622 | if(empty($family)) { |
| 1623 | 1623 | return; |
@@ -1691,32 +1691,32 @@ discard block |
||
| 1691 | 1691 | } |
| 1692 | 1692 | |
| 1693 | 1693 | /** |
| 1694 | - * Sets the font used to print character strings. It is mandatory to call this method at least once before printing text or the resulting document would not be valid. |
|
| 1695 | - * The font can be either a standard one or a font added via the AddFont() method. Standard fonts use Windows encoding cp1252 (Western Europe). |
|
| 1696 | - * The method can be called before the first page is created and the font is retained from page to page. |
|
| 1694 | + * Sets the font used to print character strings. It is mandatory to call this method at least once before printing text or the resulting document would not be valid. |
|
| 1695 | + * The font can be either a standard one or a font added via the AddFont() method. Standard fonts use Windows encoding cp1252 (Western Europe). |
|
| 1696 | + * The method can be called before the first page is created and the font is retained from page to page. |
|
| 1697 | 1697 | If you just wish to change the current font size, it is simpler to call SetFontSize(). |
| 1698 | - * Note: for the standard fonts, the font metric files must be accessible. There are three possibilities for this:<ul><li>They are in the current directory (the one where the running script lies)</li><li>They are in one of the directories defined by the include_path parameter</li><li>They are in the directory defined by the FPDF_FONTPATH constant</li></ul><br /> |
|
| 1699 | - * Example for the last case (note the trailing slash):<br /> |
|
| 1700 | - * <pre> |
|
| 1701 | - * define('FPDF_FONTPATH','/home/www/font/'); |
|
| 1702 | - * require('tcpdf.php'); |
|
| 1703 | - * |
|
| 1704 | - * //Times regular 12 |
|
| 1705 | - * $pdf->SetFont('Times'); |
|
| 1706 | - * //Arial bold 14 |
|
| 1707 | - * $pdf->SetFont('Arial','B',14); |
|
| 1708 | - * //Removes bold |
|
| 1709 | - * $pdf->SetFont(''); |
|
| 1710 | - * //Times bold, italic and underlined 14 |
|
| 1711 | - * $pdf->SetFont('Times','BIU'); |
|
| 1712 | - * </pre><br /> |
|
| 1713 | - * If the file corresponding to the requested font is not found, the error "Could not include font metric file" is generated. |
|
| 1714 | - * @param string $family Family font. It can be either a name defined by AddFont() or one of the standard families (case insensitive):<ul><li>Courier (fixed-width)</li><li>Helvetica or Arial (synonymous; sans serif)</li><li>Times (serif)</li><li>Symbol (symbolic)</li><li>ZapfDingbats (symbolic)</li></ul>It is also possible to pass an empty string. In that case, the current family is retained. |
|
| 1715 | - * @param string $style Font style. Possible values are (case insensitive):<ul><li>empty string: regular</li><li>B: bold</li><li>I: italic</li><li>U: underline</li></ul>or any combination. The default value is regular. Bold and italic styles do not apply to Symbol and ZapfDingbats |
|
| 1716 | - * @param float $size Font size in points. The default value is the current size. If no size has been specified since the beginning of the document, the value taken is 12 |
|
| 1717 | - * @since 1.0 |
|
| 1718 | - * @see AddFont(), SetFontSize(), Cell(), MultiCell(), Write() |
|
| 1719 | - */ |
|
| 1698 | + * Note: for the standard fonts, the font metric files must be accessible. There are three possibilities for this:<ul><li>They are in the current directory (the one where the running script lies)</li><li>They are in one of the directories defined by the include_path parameter</li><li>They are in the directory defined by the FPDF_FONTPATH constant</li></ul><br /> |
|
| 1699 | + * Example for the last case (note the trailing slash):<br /> |
|
| 1700 | + * <pre> |
|
| 1701 | + * define('FPDF_FONTPATH','/home/www/font/'); |
|
| 1702 | + * require('tcpdf.php'); |
|
| 1703 | + * |
|
| 1704 | + * //Times regular 12 |
|
| 1705 | + * $pdf->SetFont('Times'); |
|
| 1706 | + * //Arial bold 14 |
|
| 1707 | + * $pdf->SetFont('Arial','B',14); |
|
| 1708 | + * //Removes bold |
|
| 1709 | + * $pdf->SetFont(''); |
|
| 1710 | + * //Times bold, italic and underlined 14 |
|
| 1711 | + * $pdf->SetFont('Times','BIU'); |
|
| 1712 | + * </pre><br /> |
|
| 1713 | + * If the file corresponding to the requested font is not found, the error "Could not include font metric file" is generated. |
|
| 1714 | + * @param string $family Family font. It can be either a name defined by AddFont() or one of the standard families (case insensitive):<ul><li>Courier (fixed-width)</li><li>Helvetica or Arial (synonymous; sans serif)</li><li>Times (serif)</li><li>Symbol (symbolic)</li><li>ZapfDingbats (symbolic)</li></ul>It is also possible to pass an empty string. In that case, the current family is retained. |
|
| 1715 | + * @param string $style Font style. Possible values are (case insensitive):<ul><li>empty string: regular</li><li>B: bold</li><li>I: italic</li><li>U: underline</li></ul>or any combination. The default value is regular. Bold and italic styles do not apply to Symbol and ZapfDingbats |
|
| 1716 | + * @param float $size Font size in points. The default value is the current size. If no size has been specified since the beginning of the document, the value taken is 12 |
|
| 1717 | + * @since 1.0 |
|
| 1718 | + * @see AddFont(), SetFontSize(), Cell(), MultiCell(), Write() |
|
| 1719 | + */ |
|
| 1720 | 1720 | function SetFont($family, $style='', $size=0) { |
| 1721 | 1721 | // save previous values |
| 1722 | 1722 | $this->prevFontFamily = $this->FontFamily; |
@@ -1811,11 +1811,11 @@ discard block |
||
| 1811 | 1811 | } |
| 1812 | 1812 | |
| 1813 | 1813 | /** |
| 1814 | - * Defines the size of the current font. |
|
| 1815 | - * @param float $size The size (in points) |
|
| 1816 | - * @since 1.0 |
|
| 1817 | - * @see SetFont() |
|
| 1818 | - */ |
|
| 1814 | + * Defines the size of the current font. |
|
| 1815 | + * @param float $size The size (in points) |
|
| 1816 | + * @since 1.0 |
|
| 1817 | + * @see SetFont() |
|
| 1818 | + */ |
|
| 1819 | 1819 | function SetFontSize($size) { |
| 1820 | 1820 | //Set font size in points |
| 1821 | 1821 | if($this->FontSizePt==$size) { |
@@ -1829,11 +1829,11 @@ discard block |
||
| 1829 | 1829 | } |
| 1830 | 1830 | |
| 1831 | 1831 | /** |
| 1832 | - * Creates a new internal link and returns its identifier. An internal link is a clickable area which directs to another place within the document.<br /> |
|
| 1833 | - * The identifier can then be passed to Cell(), Write(), Image() or Link(). The destination is defined with SetLink(). |
|
| 1834 | - * @since 1.5 |
|
| 1835 | - * @see Cell(), Write(), Image(), Link(), SetLink() |
|
| 1836 | - */ |
|
| 1832 | + * Creates a new internal link and returns its identifier. An internal link is a clickable area which directs to another place within the document.<br /> |
|
| 1833 | + * The identifier can then be passed to Cell(), Write(), Image() or Link(). The destination is defined with SetLink(). |
|
| 1834 | + * @since 1.5 |
|
| 1835 | + * @see Cell(), Write(), Image(), Link(), SetLink() |
|
| 1836 | + */ |
|
| 1837 | 1837 | function AddLink() { |
| 1838 | 1838 | //Create a new internal link |
| 1839 | 1839 | $n=count($this->links)+1; |
@@ -1842,13 +1842,13 @@ discard block |
||
| 1842 | 1842 | } |
| 1843 | 1843 | |
| 1844 | 1844 | /** |
| 1845 | - * Defines the page and position a link points to |
|
| 1846 | - * @param int $link The link identifier returned by AddLink() |
|
| 1847 | - * @param float $y Ordinate of target position; -1 indicates the current position. The default value is 0 (top of page) |
|
| 1848 | - * @param int $page Number of target page; -1 indicates the current page. This is the default value |
|
| 1849 | - * @since 1.5 |
|
| 1850 | - * @see AddLink() |
|
| 1851 | - */ |
|
| 1845 | + * Defines the page and position a link points to |
|
| 1846 | + * @param int $link The link identifier returned by AddLink() |
|
| 1847 | + * @param float $y Ordinate of target position; -1 indicates the current position. The default value is 0 (top of page) |
|
| 1848 | + * @param int $page Number of target page; -1 indicates the current page. This is the default value |
|
| 1849 | + * @since 1.5 |
|
| 1850 | + * @see AddLink() |
|
| 1851 | + */ |
|
| 1852 | 1852 | function SetLink($link, $y=0, $page=-1) { |
| 1853 | 1853 | //Set destination of internal link |
| 1854 | 1854 | if($y==-1) { |
@@ -1861,28 +1861,28 @@ discard block |
||
| 1861 | 1861 | } |
| 1862 | 1862 | |
| 1863 | 1863 | /** |
| 1864 | - * Puts a link on a rectangular area of the page. Text or image links are generally put via Cell(), Write() or Image(), but this method can be useful for instance to define a clickable area inside an image. |
|
| 1865 | - * @param float $x Abscissa of the upper-left corner of the rectangle |
|
| 1866 | - * @param float $y Ordinate of the upper-left corner of the rectangle |
|
| 1867 | - * @param float $w Width of the rectangle |
|
| 1868 | - * @param float $h Height of the rectangle |
|
| 1869 | - * @param mixed $link URL or identifier returned by AddLink() |
|
| 1870 | - * @since 1.5 |
|
| 1871 | - * @see AddLink(), Cell(), Write(), Image() |
|
| 1872 | - */ |
|
| 1864 | + * Puts a link on a rectangular area of the page. Text or image links are generally put via Cell(), Write() or Image(), but this method can be useful for instance to define a clickable area inside an image. |
|
| 1865 | + * @param float $x Abscissa of the upper-left corner of the rectangle |
|
| 1866 | + * @param float $y Ordinate of the upper-left corner of the rectangle |
|
| 1867 | + * @param float $w Width of the rectangle |
|
| 1868 | + * @param float $h Height of the rectangle |
|
| 1869 | + * @param mixed $link URL or identifier returned by AddLink() |
|
| 1870 | + * @since 1.5 |
|
| 1871 | + * @see AddLink(), Cell(), Write(), Image() |
|
| 1872 | + */ |
|
| 1873 | 1873 | function Link($x, $y, $w, $h, $link) { |
| 1874 | 1874 | //Put a link on the page |
| 1875 | 1875 | $this->PageLinks[$this->page][] = array($x * $this->k, $this->hPt - $y * $this->k, $w * $this->k, $h*$this->k, $link); |
| 1876 | 1876 | } |
| 1877 | 1877 | |
| 1878 | 1878 | /** |
| 1879 | - * Prints a character string. The origin is on the left of the first charcter, on the baseline. This method allows to place a string precisely on the page, but it is usually easier to use Cell(), MultiCell() or Write() which are the standard methods to print text. |
|
| 1880 | - * @param float $x Abscissa of the origin |
|
| 1881 | - * @param float $y Ordinate of the origin |
|
| 1882 | - * @param string $txt String to print |
|
| 1883 | - * @since 1.0 |
|
| 1884 | - * @see SetFont(), SetTextColor(), Cell(), MultiCell(), Write() |
|
| 1885 | - */ |
|
| 1879 | + * Prints a character string. The origin is on the left of the first charcter, on the baseline. This method allows to place a string precisely on the page, but it is usually easier to use Cell(), MultiCell() or Write() which are the standard methods to print text. |
|
| 1880 | + * @param float $x Abscissa of the origin |
|
| 1881 | + * @param float $y Ordinate of the origin |
|
| 1882 | + * @param string $txt String to print |
|
| 1883 | + * @since 1.0 |
|
| 1884 | + * @see SetFont(), SetTextColor(), Cell(), MultiCell(), Write() |
|
| 1885 | + */ |
|
| 1886 | 1886 | function Text($x, $y, $txt) { |
| 1887 | 1887 | //Output a string |
| 1888 | 1888 | $s=sprintf('BT %.2f %.2f Td (%s) Tj ET', $x * $this->k, ($this->h-$y) * $this->k, $this->_escapetext($txt)); |
@@ -1896,70 +1896,70 @@ discard block |
||
| 1896 | 1896 | } |
| 1897 | 1897 | |
| 1898 | 1898 | /** |
| 1899 | - * Whenever a page break condition is met, the method is called, and the break is issued or not depending on the returned value. The default implementation returns a value according to the mode selected by SetAutoPageBreak().<br /> |
|
| 1900 | - * This method is called automatically and should not be called directly by the application.<br /> |
|
| 1901 | - * <b>Example:</b><br /> |
|
| 1902 | - * The method is overriden in an inherited class in order to obtain a 3 column layout:<br /> |
|
| 1903 | - * <pre> |
|
| 1904 | - * class PDF extends TCPDF { |
|
| 1905 | - * var $col=0; |
|
| 1906 | - * |
|
| 1907 | - * function SetCol($col) { |
|
| 1908 | - * //Move position to a column |
|
| 1909 | - * $this->col=$col; |
|
| 1910 | - * $x=10+$col*65; |
|
| 1911 | - * $this->SetLeftMargin($x); |
|
| 1912 | - * $this->SetX($x); |
|
| 1913 | - * } |
|
| 1914 | - * |
|
| 1915 | - * function AcceptPageBreak() { |
|
| 1916 | - * if($this->col<2) { |
|
| 1917 | - * //Go to next column |
|
| 1918 | - * $this->SetCol($this->col+1); |
|
| 1919 | - * $this->SetY(10); |
|
| 1920 | - * return false; |
|
| 1921 | - * } |
|
| 1922 | - * else { |
|
| 1923 | - * //Go back to first column and issue page break |
|
| 1924 | - * $this->SetCol(0); |
|
| 1925 | - * return true; |
|
| 1926 | - * } |
|
| 1927 | - * } |
|
| 1928 | - * } |
|
| 1929 | - * |
|
| 1930 | - * $pdf=new PDF(); |
|
| 1931 | - * $pdf->Open(); |
|
| 1932 | - * $pdf->AddPage(); |
|
| 1933 | - * $pdf->SetFont('Arial','',12); |
|
| 1934 | - * for($i=1;$i<=300;$i++) { |
|
| 1935 | - * $pdf->Cell(0,5,"Line $i",0,1); |
|
| 1936 | - * } |
|
| 1937 | - * $pdf->Output(); |
|
| 1938 | - * </pre> |
|
| 1939 | - * @return boolean |
|
| 1940 | - * @since 1.4 |
|
| 1941 | - * @see SetAutoPageBreak() |
|
| 1942 | - */ |
|
| 1899 | + * Whenever a page break condition is met, the method is called, and the break is issued or not depending on the returned value. The default implementation returns a value according to the mode selected by SetAutoPageBreak().<br /> |
|
| 1900 | + * This method is called automatically and should not be called directly by the application.<br /> |
|
| 1901 | + * <b>Example:</b><br /> |
|
| 1902 | + * The method is overriden in an inherited class in order to obtain a 3 column layout:<br /> |
|
| 1903 | + * <pre> |
|
| 1904 | + * class PDF extends TCPDF { |
|
| 1905 | + * var $col=0; |
|
| 1906 | + * |
|
| 1907 | + * function SetCol($col) { |
|
| 1908 | + * //Move position to a column |
|
| 1909 | + * $this->col=$col; |
|
| 1910 | + * $x=10+$col*65; |
|
| 1911 | + * $this->SetLeftMargin($x); |
|
| 1912 | + * $this->SetX($x); |
|
| 1913 | + * } |
|
| 1914 | + * |
|
| 1915 | + * function AcceptPageBreak() { |
|
| 1916 | + * if($this->col<2) { |
|
| 1917 | + * //Go to next column |
|
| 1918 | + * $this->SetCol($this->col+1); |
|
| 1919 | + * $this->SetY(10); |
|
| 1920 | + * return false; |
|
| 1921 | + * } |
|
| 1922 | + * else { |
|
| 1923 | + * //Go back to first column and issue page break |
|
| 1924 | + * $this->SetCol(0); |
|
| 1925 | + * return true; |
|
| 1926 | + * } |
|
| 1927 | + * } |
|
| 1928 | + * } |
|
| 1929 | + * |
|
| 1930 | + * $pdf=new PDF(); |
|
| 1931 | + * $pdf->Open(); |
|
| 1932 | + * $pdf->AddPage(); |
|
| 1933 | + * $pdf->SetFont('Arial','',12); |
|
| 1934 | + * for($i=1;$i<=300;$i++) { |
|
| 1935 | + * $pdf->Cell(0,5,"Line $i",0,1); |
|
| 1936 | + * } |
|
| 1937 | + * $pdf->Output(); |
|
| 1938 | + * </pre> |
|
| 1939 | + * @return boolean |
|
| 1940 | + * @since 1.4 |
|
| 1941 | + * @see SetAutoPageBreak() |
|
| 1942 | + */ |
|
| 1943 | 1943 | function AcceptPageBreak() { |
| 1944 | 1944 | //Accept automatic page break or not |
| 1945 | 1945 | return $this->AutoPageBreak; |
| 1946 | 1946 | } |
| 1947 | 1947 | |
| 1948 | 1948 | /** |
| 1949 | - * Prints a cell (rectangular area) with optional borders, background color and character string. The upper-left corner of the cell corresponds to the current position. The text can be aligned or centered. After the call, the current position moves to the right or to the next line. It is possible to put a link on the text.<br /> |
|
| 1950 | - * If automatic page breaking is enabled and the cell goes beyond the limit, a page break is done before outputting. |
|
| 1951 | - * @param float $w Cell width. If 0, the cell extends up to the right margin. |
|
| 1952 | - * @param float $h Cell height. Default value: 0. |
|
| 1953 | - * @param string $txt String to print. Default value: empty string. |
|
| 1954 | - * @param mixed $border Indicates if borders must be drawn around the cell. The value can be either a number:<ul><li>0: no border (default)</li><li>1: frame</li></ul>or a string containing some or all of the following characters (in any order):<ul><li>L: left</li><li>T: top</li><li>R: right</li><li>B: bottom</li></ul> |
|
| 1955 | - * @param int $ln Indicates where the current position should go after the call. Possible values are:<ul><li>0: to the right</li><li>1: to the beginning of the next line</li><li>2: below</li></ul> |
|
| 1949 | + * Prints a cell (rectangular area) with optional borders, background color and character string. The upper-left corner of the cell corresponds to the current position. The text can be aligned or centered. After the call, the current position moves to the right or to the next line. It is possible to put a link on the text.<br /> |
|
| 1950 | + * If automatic page breaking is enabled and the cell goes beyond the limit, a page break is done before outputting. |
|
| 1951 | + * @param float $w Cell width. If 0, the cell extends up to the right margin. |
|
| 1952 | + * @param float $h Cell height. Default value: 0. |
|
| 1953 | + * @param string $txt String to print. Default value: empty string. |
|
| 1954 | + * @param mixed $border Indicates if borders must be drawn around the cell. The value can be either a number:<ul><li>0: no border (default)</li><li>1: frame</li></ul>or a string containing some or all of the following characters (in any order):<ul><li>L: left</li><li>T: top</li><li>R: right</li><li>B: bottom</li></ul> |
|
| 1955 | + * @param int $ln Indicates where the current position should go after the call. Possible values are:<ul><li>0: to the right</li><li>1: to the beginning of the next line</li><li>2: below</li></ul> |
|
| 1956 | 1956 | Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: 0. |
| 1957 | - * @param string $align Allows to center or align the text. Possible values are:<ul><li>L or empty string: left align (default value)</li><li>C: center</li><li>R: right align</li></ul> |
|
| 1958 | - * @param int $fill Indicates if the cell background must be painted (1) or transparent (0). Default value: 0. |
|
| 1959 | - * @param mixed $link URL or identifier returned by AddLink(). |
|
| 1960 | - * @since 1.0 |
|
| 1961 | - * @see SetFont(), SetDrawColor(), SetFillColor(), SetTextColor(), SetLineWidth(), AddLink(), Ln(), MultiCell(), Write(), SetAutoPageBreak() |
|
| 1962 | - */ |
|
| 1957 | + * @param string $align Allows to center or align the text. Possible values are:<ul><li>L or empty string: left align (default value)</li><li>C: center</li><li>R: right align</li></ul> |
|
| 1958 | + * @param int $fill Indicates if the cell background must be painted (1) or transparent (0). Default value: 0. |
|
| 1959 | + * @param mixed $link URL or identifier returned by AddLink(). |
|
| 1960 | + * @since 1.0 |
|
| 1961 | + * @see SetFont(), SetDrawColor(), SetFillColor(), SetTextColor(), SetLineWidth(), AddLink(), Ln(), MultiCell(), Write(), SetAutoPageBreak() |
|
| 1962 | + */ |
|
| 1963 | 1963 | function Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=0, $link='') { |
| 1964 | 1964 | //Output a cell |
| 1965 | 1965 | $k=$this->k; |
@@ -2050,18 +2050,18 @@ discard block |
||
| 2050 | 2050 | } |
| 2051 | 2051 | |
| 2052 | 2052 | /** |
| 2053 | - * This method allows printing text with line breaks. They can be automatic (as soon as the text reaches the right border of the cell) or explicit (via the \n character). As many cells as necessary are output, one below the other.<br /> |
|
| 2054 | - * Text can be aligned, centered or justified. The cell block can be framed and the background painted. |
|
| 2055 | - * @param float $w Width of cells. If 0, they extend up to the right margin of the page. |
|
| 2056 | - * @param float $h Height of cells. |
|
| 2057 | - * @param string $txt String to print |
|
| 2058 | - * @param mixed $border Indicates if borders must be drawn around the cell block. The value can be either a number:<ul><li>0: no border (default)</li><li>1: frame</li></ul>or a string containing some or all of the following characters (in any order):<ul><li>L: left</li><li>T: top</li><li>R: right</li><li>B: bottom</li></ul> |
|
| 2059 | - * @param string $align Allows to center or align the text. Possible values are:<ul><li>L or empty string: left align</li><li>C: center</li><li>R: right align</li><li>J: justification (default value)</li></ul> |
|
| 2060 | - * @param int $fill Indicates if the cell background must be painted (1) or transparent (0). Default value: 0. |
|
| 2061 | - * @param int $ln Indicates where the current position should go after the call. Possible values are:<ul><li>0: to the right</li><li>1: to the beginning of the next line [DEFAULT]</li><li>2: below</li></ul> |
|
| 2062 | - * @since 1.3 |
|
| 2063 | - * @see SetFont(), SetDrawColor(), SetFillColor(), SetTextColor(), SetLineWidth(), Cell(), Write(), SetAutoPageBreak() |
|
| 2064 | - */ |
|
| 2053 | + * This method allows printing text with line breaks. They can be automatic (as soon as the text reaches the right border of the cell) or explicit (via the \n character). As many cells as necessary are output, one below the other.<br /> |
|
| 2054 | + * Text can be aligned, centered or justified. The cell block can be framed and the background painted. |
|
| 2055 | + * @param float $w Width of cells. If 0, they extend up to the right margin of the page. |
|
| 2056 | + * @param float $h Height of cells. |
|
| 2057 | + * @param string $txt String to print |
|
| 2058 | + * @param mixed $border Indicates if borders must be drawn around the cell block. The value can be either a number:<ul><li>0: no border (default)</li><li>1: frame</li></ul>or a string containing some or all of the following characters (in any order):<ul><li>L: left</li><li>T: top</li><li>R: right</li><li>B: bottom</li></ul> |
|
| 2059 | + * @param string $align Allows to center or align the text. Possible values are:<ul><li>L or empty string: left align</li><li>C: center</li><li>R: right align</li><li>J: justification (default value)</li></ul> |
|
| 2060 | + * @param int $fill Indicates if the cell background must be painted (1) or transparent (0). Default value: 0. |
|
| 2061 | + * @param int $ln Indicates where the current position should go after the call. Possible values are:<ul><li>0: to the right</li><li>1: to the beginning of the next line [DEFAULT]</li><li>2: below</li></ul> |
|
| 2062 | + * @since 1.3 |
|
| 2063 | + * @see SetFont(), SetDrawColor(), SetFillColor(), SetTextColor(), SetLineWidth(), Cell(), Write(), SetAutoPageBreak() |
|
| 2064 | + */ |
|
| 2065 | 2065 | function MultiCell($w, $h, $txt, $border=0, $align='J', $fill=0, $ln=1) { |
| 2066 | 2066 | |
| 2067 | 2067 | // save current position |
@@ -2192,24 +2192,24 @@ discard block |
||
| 2192 | 2192 | } |
| 2193 | 2193 | |
| 2194 | 2194 | /** |
| 2195 | - * This method prints text from the current position. When the right margin is reached (or the \n character is met) a line break occurs and text continues from the left margin. Upon method exit, the current position is left just at the end of the text. It is possible to put a link on the text.<br /> |
|
| 2196 | - * <b>Example:</b><br /> |
|
| 2197 | - * <pre> |
|
| 2198 | - * //Begin with regular font |
|
| 2199 | - * $pdf->SetFont('Arial','',14); |
|
| 2200 | - * $pdf->Write(5,'Visit '); |
|
| 2201 | - * //Then put a blue underlined link |
|
| 2202 | - * $pdf->SetTextColor(0,0,255); |
|
| 2203 | - * $pdf->SetFont('','U'); |
|
| 2204 | - * $pdf->Write(5,'www.tecnick.com','http://www.tecnick.com'); |
|
| 2205 | - * </pre> |
|
| 2206 | - * @param float $h Line height |
|
| 2207 | - * @param string $txt String to print |
|
| 2208 | - * @param mixed $link URL or identifier returned by AddLink() |
|
| 2209 | - * @param int $fill Indicates if the background must be painted (1) or transparent (0). Default value: 0. |
|
| 2210 | - * @since 1.5 |
|
| 2211 | - * @see SetFont(), SetTextColor(), AddLink(), MultiCell(), SetAutoPageBreak() |
|
| 2212 | - */ |
|
| 2195 | + * This method prints text from the current position. When the right margin is reached (or the \n character is met) a line break occurs and text continues from the left margin. Upon method exit, the current position is left just at the end of the text. It is possible to put a link on the text.<br /> |
|
| 2196 | + * <b>Example:</b><br /> |
|
| 2197 | + * <pre> |
|
| 2198 | + * //Begin with regular font |
|
| 2199 | + * $pdf->SetFont('Arial','',14); |
|
| 2200 | + * $pdf->Write(5,'Visit '); |
|
| 2201 | + * //Then put a blue underlined link |
|
| 2202 | + * $pdf->SetTextColor(0,0,255); |
|
| 2203 | + * $pdf->SetFont('','U'); |
|
| 2204 | + * $pdf->Write(5,'www.tecnick.com','http://www.tecnick.com'); |
|
| 2205 | + * </pre> |
|
| 2206 | + * @param float $h Line height |
|
| 2207 | + * @param string $txt String to print |
|
| 2208 | + * @param mixed $link URL or identifier returned by AddLink() |
|
| 2209 | + * @param int $fill Indicates if the background must be painted (1) or transparent (0). Default value: 0. |
|
| 2210 | + * @since 1.5 |
|
| 2211 | + * @see SetFont(), SetTextColor(), AddLink(), MultiCell(), SetAutoPageBreak() |
|
| 2212 | + */ |
|
| 2213 | 2213 | function Write($h, $txt, $link='', $fill=0) { |
| 2214 | 2214 | |
| 2215 | 2215 | //Output text in flowing mode |
@@ -2299,25 +2299,25 @@ discard block |
||
| 2299 | 2299 | } |
| 2300 | 2300 | |
| 2301 | 2301 | /** |
| 2302 | - * Puts an image in the page. The upper-left corner must be given. The dimensions can be specified in different ways:<ul><li>explicit width and height (expressed in user unit)</li><li>one explicit dimension, the other being calculated automatically in order to keep the original proportions</li><li>no explicit dimension, in which case the image is put at 72 dpi</li></ul> |
|
| 2303 | - * Supported formats are JPEG and PNG. |
|
| 2304 | - * For JPEG, all flavors are allowed:<ul><li>gray scales</li><li>true colors (24 bits)</li><li>CMYK (32 bits)</li></ul> |
|
| 2305 | - * For PNG, are allowed:<ul><li>gray scales on at most 8 bits (256 levels)</li><li>indexed colors</li><li>true colors (24 bits)</li></ul> |
|
| 2306 | - * but are not supported:<ul><li>Interlacing</li><li>Alpha channel</li></ul> |
|
| 2307 | - * If a transparent color is defined, it will be taken into account (but will be only interpreted by Acrobat 4 and above).<br /> |
|
| 2308 | - * The format can be specified explicitly or inferred from the file extension.<br /> |
|
| 2309 | - * It is possible to put a link on the image.<br /> |
|
| 2310 | - * Remark: if an image is used several times, only one copy will be embedded in the file.<br /> |
|
| 2311 | - * @param string $file Name of the file containing the image. |
|
| 2312 | - * @param float $x Abscissa of the upper-left corner. |
|
| 2313 | - * @param float $y Ordinate of the upper-left corner. |
|
| 2314 | - * @param float $w Width of the image in the page. If not specified or equal to zero, it is automatically calculated. |
|
| 2315 | - * @param float $h Height of the image in the page. If not specified or equal to zero, it is automatically calculated. |
|
| 2316 | - * @param string $type Image format. Possible values are (case insensitive): JPG, JPEG, PNG. If not specified, the type is inferred from the file extension. |
|
| 2317 | - * @param mixed $link URL or identifier returned by AddLink(). |
|
| 2318 | - * @since 1.1 |
|
| 2319 | - * @see AddLink() |
|
| 2320 | - */ |
|
| 2302 | + * Puts an image in the page. The upper-left corner must be given. The dimensions can be specified in different ways:<ul><li>explicit width and height (expressed in user unit)</li><li>one explicit dimension, the other being calculated automatically in order to keep the original proportions</li><li>no explicit dimension, in which case the image is put at 72 dpi</li></ul> |
|
| 2303 | + * Supported formats are JPEG and PNG. |
|
| 2304 | + * For JPEG, all flavors are allowed:<ul><li>gray scales</li><li>true colors (24 bits)</li><li>CMYK (32 bits)</li></ul> |
|
| 2305 | + * For PNG, are allowed:<ul><li>gray scales on at most 8 bits (256 levels)</li><li>indexed colors</li><li>true colors (24 bits)</li></ul> |
|
| 2306 | + * but are not supported:<ul><li>Interlacing</li><li>Alpha channel</li></ul> |
|
| 2307 | + * If a transparent color is defined, it will be taken into account (but will be only interpreted by Acrobat 4 and above).<br /> |
|
| 2308 | + * The format can be specified explicitly or inferred from the file extension.<br /> |
|
| 2309 | + * It is possible to put a link on the image.<br /> |
|
| 2310 | + * Remark: if an image is used several times, only one copy will be embedded in the file.<br /> |
|
| 2311 | + * @param string $file Name of the file containing the image. |
|
| 2312 | + * @param float $x Abscissa of the upper-left corner. |
|
| 2313 | + * @param float $y Ordinate of the upper-left corner. |
|
| 2314 | + * @param float $w Width of the image in the page. If not specified or equal to zero, it is automatically calculated. |
|
| 2315 | + * @param float $h Height of the image in the page. If not specified or equal to zero, it is automatically calculated. |
|
| 2316 | + * @param string $type Image format. Possible values are (case insensitive): JPG, JPEG, PNG. If not specified, the type is inferred from the file extension. |
|
| 2317 | + * @param mixed $link URL or identifier returned by AddLink(). |
|
| 2318 | + * @since 1.1 |
|
| 2319 | + * @see AddLink() |
|
| 2320 | + */ |
|
| 2321 | 2321 | function Image($file, $x, $y, $w=0, $h=0, $type='', $link='') { |
| 2322 | 2322 | //Put an image on the page |
| 2323 | 2323 | if(!isset($this->images[$file])) { |
@@ -2378,11 +2378,11 @@ discard block |
||
| 2378 | 2378 | } |
| 2379 | 2379 | |
| 2380 | 2380 | /** |
| 2381 | - * Performs a line break. The current abscissa goes back to the left margin and the ordinate increases by the amount passed in parameter. |
|
| 2382 | - * @param float $h The height of the break. By default, the value equals the height of the last printed cell. |
|
| 2383 | - * @since 1.0 |
|
| 2384 | - * @see Cell() |
|
| 2385 | - */ |
|
| 2381 | + * Performs a line break. The current abscissa goes back to the left margin and the ordinate increases by the amount passed in parameter. |
|
| 2382 | + * @param float $h The height of the break. By default, the value equals the height of the last printed cell. |
|
| 2383 | + * @since 1.0 |
|
| 2384 | + * @see Cell() |
|
| 2385 | + */ |
|
| 2386 | 2386 | function Ln($h='') { |
| 2387 | 2387 | //Line feed; default value is last cell height |
| 2388 | 2388 | $this->x=$this->lMargin; |
@@ -2395,22 +2395,22 @@ discard block |
||
| 2395 | 2395 | } |
| 2396 | 2396 | |
| 2397 | 2397 | /** |
| 2398 | - * Returns the abscissa of the current position. |
|
| 2399 | - * @return float |
|
| 2400 | - * @since 1.2 |
|
| 2401 | - * @see SetX(), GetY(), SetY() |
|
| 2402 | - */ |
|
| 2398 | + * Returns the abscissa of the current position. |
|
| 2399 | + * @return float |
|
| 2400 | + * @since 1.2 |
|
| 2401 | + * @see SetX(), GetY(), SetY() |
|
| 2402 | + */ |
|
| 2403 | 2403 | function GetX() { |
| 2404 | 2404 | //Get x position |
| 2405 | 2405 | return $this->x; |
| 2406 | 2406 | } |
| 2407 | 2407 | |
| 2408 | 2408 | /** |
| 2409 | - * Defines the abscissa of the current position. If the passed value is negative, it is relative to the right of the page. |
|
| 2410 | - * @param float $x The value of the abscissa. |
|
| 2411 | - * @since 1.2 |
|
| 2412 | - * @see GetX(), GetY(), SetY(), SetXY() |
|
| 2413 | - */ |
|
| 2409 | + * Defines the abscissa of the current position. If the passed value is negative, it is relative to the right of the page. |
|
| 2410 | + * @param float $x The value of the abscissa. |
|
| 2411 | + * @since 1.2 |
|
| 2412 | + * @see GetX(), GetY(), SetY(), SetXY() |
|
| 2413 | + */ |
|
| 2414 | 2414 | function SetX($x) { |
| 2415 | 2415 | //Set x position |
| 2416 | 2416 | if($x>=0) { |
@@ -2422,22 +2422,22 @@ discard block |
||
| 2422 | 2422 | } |
| 2423 | 2423 | |
| 2424 | 2424 | /** |
| 2425 | - * Returns the ordinate of the current position. |
|
| 2426 | - * @return float |
|
| 2427 | - * @since 1.0 |
|
| 2428 | - * @see SetY(), GetX(), SetX() |
|
| 2429 | - */ |
|
| 2425 | + * Returns the ordinate of the current position. |
|
| 2426 | + * @return float |
|
| 2427 | + * @since 1.0 |
|
| 2428 | + * @see SetY(), GetX(), SetX() |
|
| 2429 | + */ |
|
| 2430 | 2430 | function GetY() { |
| 2431 | 2431 | //Get y position |
| 2432 | 2432 | return $this->y; |
| 2433 | 2433 | } |
| 2434 | 2434 | |
| 2435 | 2435 | /** |
| 2436 | - * Moves the current abscissa back to the left margin and sets the ordinate. If the passed value is negative, it is relative to the bottom of the page. |
|
| 2437 | - * @param float $y The value of the ordinate. |
|
| 2438 | - * @since 1.0 |
|
| 2439 | - * @see GetX(), GetY(), SetY(), SetXY() |
|
| 2440 | - */ |
|
| 2436 | + * Moves the current abscissa back to the left margin and sets the ordinate. If the passed value is negative, it is relative to the bottom of the page. |
|
| 2437 | + * @param float $y The value of the ordinate. |
|
| 2438 | + * @since 1.0 |
|
| 2439 | + * @see GetX(), GetY(), SetY(), SetXY() |
|
| 2440 | + */ |
|
| 2441 | 2441 | function SetY($y) { |
| 2442 | 2442 | //Set y position and reset x |
| 2443 | 2443 | $this->x=$this->lMargin; |
@@ -2450,12 +2450,12 @@ discard block |
||
| 2450 | 2450 | } |
| 2451 | 2451 | |
| 2452 | 2452 | /** |
| 2453 | - * Defines the abscissa and ordinate of the current position. If the passed values are negative, they are relative respectively to the right and bottom of the page. |
|
| 2454 | - * @param float $x The value of the abscissa |
|
| 2455 | - * @param float $y The value of the ordinate |
|
| 2456 | - * @since 1.2 |
|
| 2457 | - * @see SetX(), SetY() |
|
| 2458 | - */ |
|
| 2453 | + * Defines the abscissa and ordinate of the current position. If the passed values are negative, they are relative respectively to the right and bottom of the page. |
|
| 2454 | + * @param float $x The value of the abscissa |
|
| 2455 | + * @param float $y The value of the ordinate |
|
| 2456 | + * @since 1.2 |
|
| 2457 | + * @see SetX(), SetY() |
|
| 2458 | + */ |
|
| 2459 | 2459 | function SetXY($x, $y) { |
| 2460 | 2460 | //Set x and y positions |
| 2461 | 2461 | $this->SetY($y); |
@@ -2463,13 +2463,13 @@ discard block |
||
| 2463 | 2463 | } |
| 2464 | 2464 | |
| 2465 | 2465 | /** |
| 2466 | - * Send the document to a given destination: string, local file or browser. In the last case, the plug-in may be used (if present) or a download ("Save as" dialog box) may be forced.<br /> |
|
| 2467 | - * The method first calls Close() if necessary to terminate the document. |
|
| 2468 | - * @param string $name The name of the file. If not given, the document will be sent to the browser (destination I) with the name doc.pdf. |
|
| 2469 | - * @param string $dest Destination where to send the document. It can take one of the following values:<ul><li>I: send the file inline to the browser. The plug-in is used if available. The name given by name is used when one selects the "Save as" option on the link generating the PDF.</li><li>D: send to the browser and force a file download with the name given by name.</li><li>F: save to a local file with the name given by name.</li><li>S: return the document as a string. name is ignored.</li></ul>If the parameter is not specified but a name is given, destination is F. If no parameter is specified at all, destination is I.<br />Note: for compatibility with previous versions, a boolean value is also accepted (false for F and true for D). |
|
| 2470 | - * @since 1.0 |
|
| 2471 | - * @see Close() |
|
| 2472 | - */ |
|
| 2466 | + * Send the document to a given destination: string, local file or browser. In the last case, the plug-in may be used (if present) or a download ("Save as" dialog box) may be forced.<br /> |
|
| 2467 | + * The method first calls Close() if necessary to terminate the document. |
|
| 2468 | + * @param string $name The name of the file. If not given, the document will be sent to the browser (destination I) with the name doc.pdf. |
|
| 2469 | + * @param string $dest Destination where to send the document. It can take one of the following values:<ul><li>I: send the file inline to the browser. The plug-in is used if available. The name given by name is used when one selects the "Save as" option on the link generating the PDF.</li><li>D: send to the browser and force a file download with the name given by name.</li><li>F: save to a local file with the name given by name.</li><li>S: return the document as a string. name is ignored.</li></ul>If the parameter is not specified but a name is given, destination is F. If no parameter is specified at all, destination is I.<br />Note: for compatibility with previous versions, a boolean value is also accepted (false for F and true for D). |
|
| 2470 | + * @since 1.0 |
|
| 2471 | + * @see Close() |
|
| 2472 | + */ |
|
| 2473 | 2473 | function Output($name='',$dest='') { |
| 2474 | 2474 | //Output PDF to some destination |
| 2475 | 2475 | //Finish document if necessary |
@@ -2549,9 +2549,9 @@ discard block |
||
| 2549 | 2549 | // var methods |
| 2550 | 2550 | |
| 2551 | 2551 | /** |
| 2552 | - * Check for locale-related bug |
|
| 2553 | - * @access protected |
|
| 2554 | - */ |
|
| 2552 | + * Check for locale-related bug |
|
| 2553 | + * @access protected |
|
| 2554 | + */ |
|
| 2555 | 2555 | function _dochecks() { |
| 2556 | 2556 | //Check for locale-related bug |
| 2557 | 2557 | if(1.1==1) { |
@@ -2564,9 +2564,9 @@ discard block |
||
| 2564 | 2564 | } |
| 2565 | 2565 | |
| 2566 | 2566 | /** |
| 2567 | - * Return fonts path |
|
| 2568 | - * @access protected |
|
| 2569 | - */ |
|
| 2567 | + * Return fonts path |
|
| 2568 | + * @access protected |
|
| 2569 | + */ |
|
| 2570 | 2570 | function _getfontpath() { |
| 2571 | 2571 | if(!defined('FPDF_FONTPATH') AND is_dir(dirname(__FILE__).'/font')) { |
| 2572 | 2572 | define('FPDF_FONTPATH', dirname(__FILE__).'/font/'); |
@@ -2575,9 +2575,9 @@ discard block |
||
| 2575 | 2575 | } |
| 2576 | 2576 | |
| 2577 | 2577 | /** |
| 2578 | - * Start document |
|
| 2579 | - * @access protected |
|
| 2580 | - */ |
|
| 2578 | + * Start document |
|
| 2579 | + * @access protected |
|
| 2580 | + */ |
|
| 2581 | 2581 | function _begindoc() { |
| 2582 | 2582 | //Start document |
| 2583 | 2583 | $this->state=1; |
@@ -2585,9 +2585,9 @@ discard block |
||
| 2585 | 2585 | } |
| 2586 | 2586 | |
| 2587 | 2587 | /** |
| 2588 | - * _putpages |
|
| 2589 | - * @access protected |
|
| 2590 | - */ |
|
| 2588 | + * _putpages |
|
| 2589 | + * @access protected |
|
| 2590 | + */ |
|
| 2591 | 2591 | function _putpages() { |
| 2592 | 2592 | $nb = $this->page; |
| 2593 | 2593 | if(!empty($this->AliasNbPages)) { |
@@ -2657,10 +2657,10 @@ discard block |
||
| 2657 | 2657 | } |
| 2658 | 2658 | |
| 2659 | 2659 | /** |
| 2660 | - * Adds fonts |
|
| 2661 | - * _putfonts |
|
| 2662 | - * @access protected |
|
| 2663 | - */ |
|
| 2660 | + * Adds fonts |
|
| 2661 | + * _putfonts |
|
| 2662 | + * @access protected |
|
| 2663 | + */ |
|
| 2664 | 2664 | function _putfonts() { |
| 2665 | 2665 | $nf=$this->n; |
| 2666 | 2666 | foreach($this->diffs as $diff) { |
@@ -2776,9 +2776,9 @@ discard block |
||
| 2776 | 2776 | } |
| 2777 | 2777 | |
| 2778 | 2778 | /** |
| 2779 | - * _putimages |
|
| 2780 | - * @access protected |
|
| 2781 | - */ |
|
| 2779 | + * _putimages |
|
| 2780 | + * @access protected |
|
| 2781 | + */ |
|
| 2782 | 2782 | function _putimages() { |
| 2783 | 2783 | $filter=($this->compress) ? '/Filter /FlateDecode ' : ''; |
| 2784 | 2784 | reset($this->images); |
@@ -2828,9 +2828,9 @@ discard block |
||
| 2828 | 2828 | } |
| 2829 | 2829 | |
| 2830 | 2830 | /** |
| 2831 | - * _putxobjectdict |
|
| 2832 | - * @access protected |
|
| 2833 | - */ |
|
| 2831 | + * _putxobjectdict |
|
| 2832 | + * @access protected |
|
| 2833 | + */ |
|
| 2834 | 2834 | function _putxobjectdict() { |
| 2835 | 2835 | foreach($this->images as $image) { |
| 2836 | 2836 | $this->_out('/I'.$image['i'].' '.$image['n'].' 0 R'); |
@@ -2838,9 +2838,9 @@ discard block |
||
| 2838 | 2838 | } |
| 2839 | 2839 | |
| 2840 | 2840 | /** |
| 2841 | - * _putresourcedict |
|
| 2842 | - * @access protected |
|
| 2843 | - */ |
|
| 2841 | + * _putresourcedict |
|
| 2842 | + * @access protected |
|
| 2843 | + */ |
|
| 2844 | 2844 | function _putresourcedict(){ |
| 2845 | 2845 | $this->_out('/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]'); |
| 2846 | 2846 | $this->_out('/Font <<'); |
@@ -2854,9 +2854,9 @@ discard block |
||
| 2854 | 2854 | } |
| 2855 | 2855 | |
| 2856 | 2856 | /** |
| 2857 | - * _putresources |
|
| 2858 | - * @access protected |
|
| 2859 | - */ |
|
| 2857 | + * _putresources |
|
| 2858 | + * @access protected |
|
| 2859 | + */ |
|
| 2860 | 2860 | function _putresources() { |
| 2861 | 2861 | $this->_putfonts(); |
| 2862 | 2862 | $this->_putimages(); |
@@ -2870,9 +2870,9 @@ discard block |
||
| 2870 | 2870 | } |
| 2871 | 2871 | |
| 2872 | 2872 | /** |
| 2873 | - * _putinfo |
|
| 2874 | - * @access protected |
|
| 2875 | - */ |
|
| 2873 | + * _putinfo |
|
| 2874 | + * @access protected |
|
| 2875 | + */ |
|
| 2876 | 2876 | function _putinfo() { |
| 2877 | 2877 | $this->_out('/Producer '.$this->_textstring(PDF_PRODUCER)); |
| 2878 | 2878 | if(!empty($this->title)) { |
@@ -2894,9 +2894,9 @@ discard block |
||
| 2894 | 2894 | } |
| 2895 | 2895 | |
| 2896 | 2896 | /** |
| 2897 | - * _putcatalog |
|
| 2898 | - * @access protected |
|
| 2899 | - */ |
|
| 2897 | + * _putcatalog |
|
| 2898 | + * @access protected |
|
| 2899 | + */ |
|
| 2900 | 2900 | function _putcatalog() { |
| 2901 | 2901 | $this->_out('/Type /Catalog'); |
| 2902 | 2902 | $this->_out('/Pages 1 0 R'); |
@@ -2924,9 +2924,9 @@ discard block |
||
| 2924 | 2924 | } |
| 2925 | 2925 | |
| 2926 | 2926 | /** |
| 2927 | - * _puttrailer |
|
| 2928 | - * @access protected |
|
| 2929 | - */ |
|
| 2927 | + * _puttrailer |
|
| 2928 | + * @access protected |
|
| 2929 | + */ |
|
| 2930 | 2930 | function _puttrailer() { |
| 2931 | 2931 | $this->_out('/Size '.($this->n+1)); |
| 2932 | 2932 | $this->_out('/Root '.$this->n.' 0 R'); |
@@ -2934,17 +2934,17 @@ discard block |
||
| 2934 | 2934 | } |
| 2935 | 2935 | |
| 2936 | 2936 | /** |
| 2937 | - * _putheader |
|
| 2938 | - * @access protected |
|
| 2939 | - */ |
|
| 2937 | + * _putheader |
|
| 2938 | + * @access protected |
|
| 2939 | + */ |
|
| 2940 | 2940 | function _putheader() { |
| 2941 | 2941 | $this->_out('%PDF-'.$this->PDFVersion); |
| 2942 | 2942 | } |
| 2943 | 2943 | |
| 2944 | 2944 | /** |
| 2945 | - * _enddoc |
|
| 2946 | - * @access protected |
|
| 2947 | - */ |
|
| 2945 | + * _enddoc |
|
| 2946 | + * @access protected |
|
| 2947 | + */ |
|
| 2948 | 2948 | function _enddoc() { |
| 2949 | 2949 | $this->_putheader(); |
| 2950 | 2950 | $this->_putpages(); |
@@ -2981,9 +2981,9 @@ discard block |
||
| 2981 | 2981 | } |
| 2982 | 2982 | |
| 2983 | 2983 | /** |
| 2984 | - * _beginpage |
|
| 2985 | - * @access protected |
|
| 2986 | - */ |
|
| 2984 | + * _beginpage |
|
| 2985 | + * @access protected |
|
| 2986 | + */ |
|
| 2987 | 2987 | function _beginpage($orientation) { |
| 2988 | 2988 | $this->page++; |
| 2989 | 2989 | $this->pages[$this->page]=''; |
@@ -3021,17 +3021,17 @@ discard block |
||
| 3021 | 3021 | } |
| 3022 | 3022 | |
| 3023 | 3023 | /** |
| 3024 | - * End of page contents |
|
| 3025 | - * @access protected |
|
| 3026 | - */ |
|
| 3024 | + * End of page contents |
|
| 3025 | + * @access protected |
|
| 3026 | + */ |
|
| 3027 | 3027 | function _endpage() { |
| 3028 | 3028 | $this->state=1; |
| 3029 | 3029 | } |
| 3030 | 3030 | |
| 3031 | 3031 | /** |
| 3032 | - * Begin a new object |
|
| 3033 | - * @access protected |
|
| 3034 | - */ |
|
| 3032 | + * Begin a new object |
|
| 3033 | + * @access protected |
|
| 3034 | + */ |
|
| 3035 | 3035 | function _newobj() { |
| 3036 | 3036 | $this->n++; |
| 3037 | 3037 | $this->offsets[$this->n]=strlen($this->buffer); |
@@ -3039,9 +3039,9 @@ discard block |
||
| 3039 | 3039 | } |
| 3040 | 3040 | |
| 3041 | 3041 | /** |
| 3042 | - * Underline text |
|
| 3043 | - * @access protected |
|
| 3044 | - */ |
|
| 3042 | + * Underline text |
|
| 3043 | + * @access protected |
|
| 3044 | + */ |
|
| 3045 | 3045 | function _dounderline($x,$y,$txt) { |
| 3046 | 3046 | $up = $this->CurrentFont['up']; |
| 3047 | 3047 | $ut = $this->CurrentFont['ut']; |
@@ -3050,9 +3050,9 @@ discard block |
||
| 3050 | 3050 | } |
| 3051 | 3051 | |
| 3052 | 3052 | /** |
| 3053 | - * Extract info from a JPEG file |
|
| 3054 | - * @access protected |
|
| 3055 | - */ |
|
| 3053 | + * Extract info from a JPEG file |
|
| 3054 | + * @access protected |
|
| 3055 | + */ |
|
| 3056 | 3056 | function _parsejpg($file) { |
| 3057 | 3057 | $a=GetImageSize($file); |
| 3058 | 3058 | if(empty($a)) { |
@@ -3082,9 +3082,9 @@ discard block |
||
| 3082 | 3082 | } |
| 3083 | 3083 | |
| 3084 | 3084 | /** |
| 3085 | - * Extract info from a PNG file |
|
| 3086 | - * @access protected |
|
| 3087 | - */ |
|
| 3085 | + * Extract info from a PNG file |
|
| 3086 | + * @access protected |
|
| 3087 | + */ |
|
| 3088 | 3088 | function _parsepng($file) { |
| 3089 | 3089 | $f=fopen($file,'rb'); |
| 3090 | 3090 | if(empty($f)) { |
@@ -3179,9 +3179,9 @@ discard block |
||
| 3179 | 3179 | } |
| 3180 | 3180 | |
| 3181 | 3181 | /** |
| 3182 | - * Read a 4-byte integer from file |
|
| 3183 | - * @access protected |
|
| 3184 | - */ |
|
| 3182 | + * Read a 4-byte integer from file |
|
| 3183 | + * @access protected |
|
| 3184 | + */ |
|
| 3185 | 3185 | function _freadint($f) { |
| 3186 | 3186 | //Read a 4-byte integer from file |
| 3187 | 3187 | $a=unpack('Ni',fread($f,4)); |
@@ -3189,9 +3189,9 @@ discard block |
||
| 3189 | 3189 | } |
| 3190 | 3190 | |
| 3191 | 3191 | /** |
| 3192 | - * Format a text string |
|
| 3193 | - * @access protected |
|
| 3194 | - */ |
|
| 3192 | + * Format a text string |
|
| 3193 | + * @access protected |
|
| 3194 | + */ |
|
| 3195 | 3195 | function _textstring($s) { |
| 3196 | 3196 | if($this->isunicode) { |
| 3197 | 3197 | //Convert string to UTF-16BE |
@@ -3201,9 +3201,9 @@ discard block |
||
| 3201 | 3201 | } |
| 3202 | 3202 | |
| 3203 | 3203 | /** |
| 3204 | - * Format a text string |
|
| 3205 | - * @access protected |
|
| 3206 | - */ |
|
| 3204 | + * Format a text string |
|
| 3205 | + * @access protected |
|
| 3206 | + */ |
|
| 3207 | 3207 | function _escapetext($s) { |
| 3208 | 3208 | if($this->isunicode) { |
| 3209 | 3209 | //Convert string to UTF-16BE |
@@ -3213,18 +3213,18 @@ discard block |
||
| 3213 | 3213 | } |
| 3214 | 3214 | |
| 3215 | 3215 | /** |
| 3216 | - * Add \ before \, ( and ) |
|
| 3217 | - * @access protected |
|
| 3218 | - */ |
|
| 3216 | + * Add \ before \, ( and ) |
|
| 3217 | + * @access protected |
|
| 3218 | + */ |
|
| 3219 | 3219 | function _escape($s) { |
| 3220 | 3220 | // the chr(13) substitution fixes the Bugs item #1421290. |
| 3221 | 3221 | return strtr($s, array(')' => '\\)', '(' => '\\(', '\\' => '\\\\', chr(13) => '\r')); |
| 3222 | 3222 | } |
| 3223 | 3223 | |
| 3224 | 3224 | /** |
| 3225 | - * |
|
| 3226 | - * @access protected |
|
| 3227 | - */ |
|
| 3225 | + * |
|
| 3226 | + * @access protected |
|
| 3227 | + */ |
|
| 3228 | 3228 | function _putstream($s) { |
| 3229 | 3229 | $this->_out('stream'); |
| 3230 | 3230 | $this->_out($s); |
@@ -3232,9 +3232,9 @@ discard block |
||
| 3232 | 3232 | } |
| 3233 | 3233 | |
| 3234 | 3234 | /** |
| 3235 | - * Add a line to the document |
|
| 3236 | - * @access protected |
|
| 3237 | - */ |
|
| 3235 | + * Add a line to the document |
|
| 3236 | + * @access protected |
|
| 3237 | + */ |
|
| 3238 | 3238 | function _out($s) { |
| 3239 | 3239 | if($this->state==2) { |
| 3240 | 3240 | $this->pages[$this->page] .= $s."\n"; |
@@ -3245,12 +3245,12 @@ discard block |
||
| 3245 | 3245 | } |
| 3246 | 3246 | |
| 3247 | 3247 | /** |
| 3248 | - * Adds unicode fonts.<br> |
|
| 3249 | - * Based on PDF Reference 1.3 (section 5) |
|
| 3250 | - * @access protected |
|
| 3251 | - * @author Nicola Asuni |
|
| 3252 | - * @since 1.52.0.TC005 (2005-01-05) |
|
| 3253 | - */ |
|
| 3248 | + * Adds unicode fonts.<br> |
|
| 3249 | + * Based on PDF Reference 1.3 (section 5) |
|
| 3250 | + * @access protected |
|
| 3251 | + * @author Nicola Asuni |
|
| 3252 | + * @since 1.52.0.TC005 (2005-01-05) |
|
| 3253 | + */ |
|
| 3254 | 3254 | function _puttruetypeunicode($font) { |
| 3255 | 3255 | // Type0 Font |
| 3256 | 3256 | // A composite font—a font composed of other fonts, organized hierarchically |
@@ -3358,39 +3358,39 @@ discard block |
||
| 3358 | 3358 | } |
| 3359 | 3359 | |
| 3360 | 3360 | /** |
| 3361 | - * Converts UTF-8 strings to codepoints array.<br> |
|
| 3362 | - * Invalid byte sequences will be replaced with 0xFFFD (replacement character)<br> |
|
| 3363 | - * Based on: http://www.faqs.org/rfcs/rfc3629.html |
|
| 3364 | - * <pre> |
|
| 3365 | - * Char. number range | UTF-8 octet sequence |
|
| 3366 | - * (hexadecimal) | (binary) |
|
| 3367 | - * --------------------+----------------------------------------------- |
|
| 3368 | - * 0000 0000-0000 007F | 0xxxxxxx |
|
| 3369 | - * 0000 0080-0000 07FF | 110xxxxx 10xxxxxx |
|
| 3370 | - * 0000 0800-0000 FFFF | 1110xxxx 10xxxxxx 10xxxxxx |
|
| 3371 | - * 0001 0000-0010 FFFF | 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx |
|
| 3372 | - * --------------------------------------------------------------------- |
|
| 3373 | - * |
|
| 3374 | - * ABFN notation: |
|
| 3375 | - * --------------------------------------------------------------------- |
|
| 3376 | - * UTF8-octets = *( UTF8-char ) |
|
| 3377 | - * UTF8-char = UTF8-1 / UTF8-2 / UTF8-3 / UTF8-4 |
|
| 3378 | - * UTF8-1 = %x00-7F |
|
| 3379 | - * UTF8-2 = %xC2-DF UTF8-tail |
|
| 3380 | - * |
|
| 3381 | - * UTF8-3 = %xE0 %xA0-BF UTF8-tail / %xE1-EC 2( UTF8-tail ) / |
|
| 3382 | - * %xED %x80-9F UTF8-tail / %xEE-EF 2( UTF8-tail ) |
|
| 3383 | - * UTF8-4 = %xF0 %x90-BF 2( UTF8-tail ) / %xF1-F3 3( UTF8-tail ) / |
|
| 3384 | - * %xF4 %x80-8F 2( UTF8-tail ) |
|
| 3385 | - * UTF8-tail = %x80-BF |
|
| 3386 | - * --------------------------------------------------------------------- |
|
| 3387 | - * </pre> |
|
| 3388 | - * @param string $str string to process. |
|
| 3389 | - * @return array containing codepoints (UTF-8 characters values) |
|
| 3390 | - * @access protected |
|
| 3391 | - * @author Nicola Asuni |
|
| 3392 | - * @since 1.53.0.TC005 (2005-01-05) |
|
| 3393 | - */ |
|
| 3361 | + * Converts UTF-8 strings to codepoints array.<br> |
|
| 3362 | + * Invalid byte sequences will be replaced with 0xFFFD (replacement character)<br> |
|
| 3363 | + * Based on: http://www.faqs.org/rfcs/rfc3629.html |
|
| 3364 | + * <pre> |
|
| 3365 | + * Char. number range | UTF-8 octet sequence |
|
| 3366 | + * (hexadecimal) | (binary) |
|
| 3367 | + * --------------------+----------------------------------------------- |
|
| 3368 | + * 0000 0000-0000 007F | 0xxxxxxx |
|
| 3369 | + * 0000 0080-0000 07FF | 110xxxxx 10xxxxxx |
|
| 3370 | + * 0000 0800-0000 FFFF | 1110xxxx 10xxxxxx 10xxxxxx |
|
| 3371 | + * 0001 0000-0010 FFFF | 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx |
|
| 3372 | + * --------------------------------------------------------------------- |
|
| 3373 | + * |
|
| 3374 | + * ABFN notation: |
|
| 3375 | + * --------------------------------------------------------------------- |
|
| 3376 | + * UTF8-octets = *( UTF8-char ) |
|
| 3377 | + * UTF8-char = UTF8-1 / UTF8-2 / UTF8-3 / UTF8-4 |
|
| 3378 | + * UTF8-1 = %x00-7F |
|
| 3379 | + * UTF8-2 = %xC2-DF UTF8-tail |
|
| 3380 | + * |
|
| 3381 | + * UTF8-3 = %xE0 %xA0-BF UTF8-tail / %xE1-EC 2( UTF8-tail ) / |
|
| 3382 | + * %xED %x80-9F UTF8-tail / %xEE-EF 2( UTF8-tail ) |
|
| 3383 | + * UTF8-4 = %xF0 %x90-BF 2( UTF8-tail ) / %xF1-F3 3( UTF8-tail ) / |
|
| 3384 | + * %xF4 %x80-8F 2( UTF8-tail ) |
|
| 3385 | + * UTF8-tail = %x80-BF |
|
| 3386 | + * --------------------------------------------------------------------- |
|
| 3387 | + * </pre> |
|
| 3388 | + * @param string $str string to process. |
|
| 3389 | + * @return array containing codepoints (UTF-8 characters values) |
|
| 3390 | + * @access protected |
|
| 3391 | + * @author Nicola Asuni |
|
| 3392 | + * @since 1.53.0.TC005 (2005-01-05) |
|
| 3393 | + */ |
|
| 3394 | 3394 | function UTF8StringToArray($str) { |
| 3395 | 3395 | if(!$this->isunicode) { |
| 3396 | 3396 | return $str; // string is not in unicode |
@@ -3458,10 +3458,10 @@ discard block |
||
| 3458 | 3458 | /** |
| 3459 | 3459 | * Converts UTF-8 strings to UTF16-BE.<br> |
| 3460 | 3460 | * Based on: http://www.faqs.org/rfcs/rfc2781.html |
| 3461 | - * <pre> |
|
| 3461 | + * <pre> |
|
| 3462 | 3462 | * Encoding UTF-16: |
| 3463 | 3463 | * |
| 3464 | - * Encoding of a single character from an ISO 10646 character value to |
|
| 3464 | + * Encoding of a single character from an ISO 10646 character value to |
|
| 3465 | 3465 | * UTF-16 proceeds as follows. Let U be the character number, no greater |
| 3466 | 3466 | * than 0x10FFFF. |
| 3467 | 3467 | * |
@@ -3526,7 +3526,7 @@ discard block |
||
| 3526 | 3526 | // ==================================================== |
| 3527 | 3527 | |
| 3528 | 3528 | /** |
| 3529 | - * Set header font. |
|
| 3529 | + * Set header font. |
|
| 3530 | 3530 | * @param array $font font |
| 3531 | 3531 | * @since 1.1 |
| 3532 | 3532 | */ |
@@ -3535,7 +3535,7 @@ discard block |
||
| 3535 | 3535 | } |
| 3536 | 3536 | |
| 3537 | 3537 | /** |
| 3538 | - * Set footer font. |
|
| 3538 | + * Set footer font. |
|
| 3539 | 3539 | * @param array $font font |
| 3540 | 3540 | * @since 1.1 |
| 3541 | 3541 | */ |
@@ -3544,7 +3544,7 @@ discard block |
||
| 3544 | 3544 | } |
| 3545 | 3545 | |
| 3546 | 3546 | /** |
| 3547 | - * Set language array. |
|
| 3547 | + * Set language array. |
|
| 3548 | 3548 | * @param array $language |
| 3549 | 3549 | * @since 1.1 |
| 3550 | 3550 | */ |
@@ -3553,7 +3553,7 @@ discard block |
||
| 3553 | 3553 | } |
| 3554 | 3554 | |
| 3555 | 3555 | /** |
| 3556 | - * Set document barcode. |
|
| 3556 | + * Set document barcode. |
|
| 3557 | 3557 | * @param string $bc barcode |
| 3558 | 3558 | */ |
| 3559 | 3559 | function setBarcode($bc="") { |
@@ -3561,7 +3561,7 @@ discard block |
||
| 3561 | 3561 | } |
| 3562 | 3562 | |
| 3563 | 3563 | /** |
| 3564 | - * Print Barcode. |
|
| 3564 | + * Print Barcode. |
|
| 3565 | 3565 | * @param int $x x position in user units |
| 3566 | 3566 | * @param int $y y position in user units |
| 3567 | 3567 | * @param int $w width in user units |
@@ -3637,7 +3637,7 @@ discard block |
||
| 3637 | 3637 | } |
| 3638 | 3638 | |
| 3639 | 3639 | /** |
| 3640 | - * Returns the PDF data. |
|
| 3640 | + * Returns the PDF data. |
|
| 3641 | 3641 | */ |
| 3642 | 3642 | function getPDFData() { |
| 3643 | 3643 | if($this->state < 3) { |
@@ -65,12 +65,12 @@ discard block |
||
| 65 | 65 | @version 1.53.0.TC031_PHP4 |
| 66 | 66 | */ |
| 67 | 67 | |
| 68 | -if(!class_exists('TCPDF')) { |
|
| 68 | +if (!class_exists('TCPDF')) { |
|
| 69 | 69 | /** |
| 70 | 70 | * define default PDF document producer |
| 71 | 71 | */ |
| 72 | 72 | //define('PDF_PRODUCER','TCPDF 1.53.0.TC031_PHP4 (http://tcpdf.sourceforge.net)'); |
| 73 | - define('PDF_PRODUCER','Instant Zero (http://www.instant-zero.com)'); |
|
| 73 | + define('PDF_PRODUCER', 'Instant Zero (http://www.instant-zero.com)'); |
|
| 74 | 74 | |
| 75 | 75 | /** |
| 76 | 76 | * This is a PHP4 class for generating PDF files on-the-fly without requiring external extensions.<br> |
@@ -694,14 +694,14 @@ discard block |
||
| 694 | 694 | * @access private |
| 695 | 695 | * @since 1.53.0.TC017 |
| 696 | 696 | */ |
| 697 | - var $prevFillColor = array(255,255,255); |
|
| 697 | + var $prevFillColor = array(255, 255, 255); |
|
| 698 | 698 | |
| 699 | 699 | /** |
| 700 | 700 | * @var store previous text color as RGB array |
| 701 | 701 | * @access private |
| 702 | 702 | * @since 1.53.0.TC017 |
| 703 | 703 | */ |
| 704 | - var $prevTextColor = array(0,0,0); |
|
| 704 | + var $prevTextColor = array(0, 0, 0); |
|
| 705 | 705 | |
| 706 | 706 | /** |
| 707 | 707 | * @var store previous font family |
@@ -732,7 +732,7 @@ discard block |
||
| 732 | 732 | * @param boolean $unicode TRUE means that the input text is unicode (default = true) |
| 733 | 733 | * @param String $encoding charset encoding; default is UTF-8 |
| 734 | 734 | */ |
| 735 | - function TCPDF($orientation='P', $unit='mm', $format='A4', $unicode=true, $encoding="UTF-8") { |
|
| 735 | + function TCPDF($orientation = 'P', $unit = 'mm', $format = 'A4', $unicode = true, $encoding = "UTF-8") { |
|
| 736 | 736 | |
| 737 | 737 | /* Set internal character encoding to ASCII */ |
| 738 | 738 | if (function_exists("mb_internal_encoding") AND mb_internal_encoding()) { |
@@ -743,31 +743,31 @@ discard block |
||
| 743 | 743 | //Some checks |
| 744 | 744 | $this->_dochecks(); |
| 745 | 745 | //Initialization of properties |
| 746 | - $this->isunicode=$unicode; |
|
| 747 | - $this->page=0; |
|
| 748 | - $this->n=2; |
|
| 749 | - $this->buffer=''; |
|
| 750 | - $this->pages=array(); |
|
| 751 | - $this->OrientationChanges=array(); |
|
| 752 | - $this->state=0; |
|
| 753 | - $this->fonts=array(); |
|
| 754 | - $this->FontFiles=array(); |
|
| 755 | - $this->diffs=array(); |
|
| 756 | - $this->images=array(); |
|
| 757 | - $this->links=array(); |
|
| 758 | - $this->InFooter=false; |
|
| 759 | - $this->lasth=0; |
|
| 760 | - $this->FontFamily=''; |
|
| 761 | - $this->FontStyle=''; |
|
| 762 | - $this->FontSizePt=12; |
|
| 763 | - $this->underline=false; |
|
| 764 | - $this->DrawColor='0 G'; |
|
| 765 | - $this->FillColor='0 g'; |
|
| 766 | - $this->TextColor='0 g'; |
|
| 767 | - $this->ColorFlag=false; |
|
| 768 | - $this->ws=0; |
|
| 746 | + $this->isunicode = $unicode; |
|
| 747 | + $this->page = 0; |
|
| 748 | + $this->n = 2; |
|
| 749 | + $this->buffer = ''; |
|
| 750 | + $this->pages = array(); |
|
| 751 | + $this->OrientationChanges = array(); |
|
| 752 | + $this->state = 0; |
|
| 753 | + $this->fonts = array(); |
|
| 754 | + $this->FontFiles = array(); |
|
| 755 | + $this->diffs = array(); |
|
| 756 | + $this->images = array(); |
|
| 757 | + $this->links = array(); |
|
| 758 | + $this->InFooter = false; |
|
| 759 | + $this->lasth = 0; |
|
| 760 | + $this->FontFamily = ''; |
|
| 761 | + $this->FontStyle = ''; |
|
| 762 | + $this->FontSizePt = 12; |
|
| 763 | + $this->underline = false; |
|
| 764 | + $this->DrawColor = '0 G'; |
|
| 765 | + $this->FillColor = '0 g'; |
|
| 766 | + $this->TextColor = '0 g'; |
|
| 767 | + $this->ColorFlag = false; |
|
| 768 | + $this->ws = 0; |
|
| 769 | 769 | //Standard Unicode fonts |
| 770 | - $this->CoreFonts=array( |
|
| 770 | + $this->CoreFonts = array( |
|
| 771 | 771 | 'courier'=>'Courier', |
| 772 | 772 | 'courierB'=>'Courier-Bold', |
| 773 | 773 | 'courierI'=>'Courier-Oblique', |
@@ -786,111 +786,111 @@ discard block |
||
| 786 | 786 | |
| 787 | 787 | //Scale factor |
| 788 | 788 | // 2003-06-11 - Nicola Asuni : changed if/else with switch statement |
| 789 | - switch (strtolower($unit)){ |
|
| 790 | - case 'pt': {$this->k=1; break;} |
|
| 791 | - case 'mm': {$this->k=72/25.4; break;} |
|
| 792 | - case 'cm': {$this->k=72/2.54; break;} |
|
| 793 | - case 'in': {$this->k=72; break;} |
|
| 794 | - default : {$this->Error('Incorrect unit: '.$unit); break;} |
|
| 789 | + switch (strtolower($unit)) { |
|
| 790 | + case 'pt': {$this->k = 1; break; } |
|
| 791 | + case 'mm': {$this->k = 72 / 25.4; break; } |
|
| 792 | + case 'cm': {$this->k = 72 / 2.54; break; } |
|
| 793 | + case 'in': {$this->k = 72; break; } |
|
| 794 | + default : {$this->Error('Incorrect unit: '.$unit); break; } |
|
| 795 | 795 | } |
| 796 | 796 | |
| 797 | 797 | //Page format |
| 798 | - if(is_string($format)) { |
|
| 798 | + if (is_string($format)) { |
|
| 799 | 799 | // 2002-07-24 - Nicola Asuni ([email protected]) |
| 800 | 800 | // Added new page formats (45 standard ISO paper formats and 4 american common formats). |
| 801 | 801 | // Paper cordinates are calculated in this way: (inches * 72) where (1 inch = 2.54 cm) |
| 802 | - switch (strtoupper($format)){ |
|
| 803 | - case '4A0': {$format = array(4767.87,6740.79); break;} |
|
| 804 | - case '2A0': {$format = array(3370.39,4767.87); break;} |
|
| 805 | - case 'A0': {$format = array(2383.94,3370.39); break;} |
|
| 806 | - case 'A1': {$format = array(1683.78,2383.94); break;} |
|
| 807 | - case 'A2': {$format = array(1190.55,1683.78); break;} |
|
| 808 | - case 'A3': {$format = array(841.89,1190.55); break;} |
|
| 809 | - case 'A4': default: {$format = array(595.28,841.89); break;} |
|
| 810 | - case 'A5': {$format = array(419.53,595.28); break;} |
|
| 811 | - case 'A6': {$format = array(297.64,419.53); break;} |
|
| 812 | - case 'A7': {$format = array(209.76,297.64); break;} |
|
| 813 | - case 'A8': {$format = array(147.40,209.76); break;} |
|
| 814 | - case 'A9': {$format = array(104.88,147.40); break;} |
|
| 815 | - case 'A10': {$format = array(73.70,104.88); break;} |
|
| 816 | - case 'B0': {$format = array(2834.65,4008.19); break;} |
|
| 817 | - case 'B1': {$format = array(2004.09,2834.65); break;} |
|
| 818 | - case 'B2': {$format = array(1417.32,2004.09); break;} |
|
| 819 | - case 'B3': {$format = array(1000.63,1417.32); break;} |
|
| 820 | - case 'B4': {$format = array(708.66,1000.63); break;} |
|
| 821 | - case 'B5': {$format = array(498.90,708.66); break;} |
|
| 822 | - case 'B6': {$format = array(354.33,498.90); break;} |
|
| 823 | - case 'B7': {$format = array(249.45,354.33); break;} |
|
| 824 | - case 'B8': {$format = array(175.75,249.45); break;} |
|
| 825 | - case 'B9': {$format = array(124.72,175.75); break;} |
|
| 826 | - case 'B10': {$format = array(87.87,124.72); break;} |
|
| 827 | - case 'C0': {$format = array(2599.37,3676.54); break;} |
|
| 828 | - case 'C1': {$format = array(1836.85,2599.37); break;} |
|
| 829 | - case 'C2': {$format = array(1298.27,1836.85); break;} |
|
| 830 | - case 'C3': {$format = array(918.43,1298.27); break;} |
|
| 831 | - case 'C4': {$format = array(649.13,918.43); break;} |
|
| 832 | - case 'C5': {$format = array(459.21,649.13); break;} |
|
| 833 | - case 'C6': {$format = array(323.15,459.21); break;} |
|
| 834 | - case 'C7': {$format = array(229.61,323.15); break;} |
|
| 835 | - case 'C8': {$format = array(161.57,229.61); break;} |
|
| 836 | - case 'C9': {$format = array(113.39,161.57); break;} |
|
| 837 | - case 'C10': {$format = array(79.37,113.39); break;} |
|
| 838 | - case 'RA0': {$format = array(2437.80,3458.27); break;} |
|
| 839 | - case 'RA1': {$format = array(1729.13,2437.80); break;} |
|
| 840 | - case 'RA2': {$format = array(1218.90,1729.13); break;} |
|
| 841 | - case 'RA3': {$format = array(864.57,1218.90); break;} |
|
| 842 | - case 'RA4': {$format = array(609.45,864.57); break;} |
|
| 843 | - case 'SRA0': {$format = array(2551.18,3628.35); break;} |
|
| 844 | - case 'SRA1': {$format = array(1814.17,2551.18); break;} |
|
| 845 | - case 'SRA2': {$format = array(1275.59,1814.17); break;} |
|
| 846 | - case 'SRA3': {$format = array(907.09,1275.59); break;} |
|
| 847 | - case 'SRA4': {$format = array(637.80,907.09); break;} |
|
| 848 | - case 'LETTER': {$format = array(612.00,792.00); break;} |
|
| 849 | - case 'LEGAL': {$format = array(612.00,1008.00); break;} |
|
| 850 | - case 'EXECUTIVE': {$format = array(521.86,756.00); break;} |
|
| 851 | - case 'FOLIO': {$format = array(612.00,936.00); break;} |
|
| 802 | + switch (strtoupper($format)) { |
|
| 803 | + case '4A0': {$format = array(4767.87, 6740.79); break; } |
|
| 804 | + case '2A0': {$format = array(3370.39, 4767.87); break; } |
|
| 805 | + case 'A0': {$format = array(2383.94, 3370.39); break; } |
|
| 806 | + case 'A1': {$format = array(1683.78, 2383.94); break; } |
|
| 807 | + case 'A2': {$format = array(1190.55, 1683.78); break; } |
|
| 808 | + case 'A3': {$format = array(841.89, 1190.55); break; } |
|
| 809 | + case 'A4': default: {$format = array(595.28, 841.89); break; } |
|
| 810 | + case 'A5': {$format = array(419.53, 595.28); break; } |
|
| 811 | + case 'A6': {$format = array(297.64, 419.53); break; } |
|
| 812 | + case 'A7': {$format = array(209.76, 297.64); break; } |
|
| 813 | + case 'A8': {$format = array(147.40, 209.76); break; } |
|
| 814 | + case 'A9': {$format = array(104.88, 147.40); break; } |
|
| 815 | + case 'A10': {$format = array(73.70, 104.88); break; } |
|
| 816 | + case 'B0': {$format = array(2834.65, 4008.19); break; } |
|
| 817 | + case 'B1': {$format = array(2004.09, 2834.65); break; } |
|
| 818 | + case 'B2': {$format = array(1417.32, 2004.09); break; } |
|
| 819 | + case 'B3': {$format = array(1000.63, 1417.32); break; } |
|
| 820 | + case 'B4': {$format = array(708.66, 1000.63); break; } |
|
| 821 | + case 'B5': {$format = array(498.90, 708.66); break; } |
|
| 822 | + case 'B6': {$format = array(354.33, 498.90); break; } |
|
| 823 | + case 'B7': {$format = array(249.45, 354.33); break; } |
|
| 824 | + case 'B8': {$format = array(175.75, 249.45); break; } |
|
| 825 | + case 'B9': {$format = array(124.72, 175.75); break; } |
|
| 826 | + case 'B10': {$format = array(87.87, 124.72); break; } |
|
| 827 | + case 'C0': {$format = array(2599.37, 3676.54); break; } |
|
| 828 | + case 'C1': {$format = array(1836.85, 2599.37); break; } |
|
| 829 | + case 'C2': {$format = array(1298.27, 1836.85); break; } |
|
| 830 | + case 'C3': {$format = array(918.43, 1298.27); break; } |
|
| 831 | + case 'C4': {$format = array(649.13, 918.43); break; } |
|
| 832 | + case 'C5': {$format = array(459.21, 649.13); break; } |
|
| 833 | + case 'C6': {$format = array(323.15, 459.21); break; } |
|
| 834 | + case 'C7': {$format = array(229.61, 323.15); break; } |
|
| 835 | + case 'C8': {$format = array(161.57, 229.61); break; } |
|
| 836 | + case 'C9': {$format = array(113.39, 161.57); break; } |
|
| 837 | + case 'C10': {$format = array(79.37, 113.39); break; } |
|
| 838 | + case 'RA0': {$format = array(2437.80, 3458.27); break; } |
|
| 839 | + case 'RA1': {$format = array(1729.13, 2437.80); break; } |
|
| 840 | + case 'RA2': {$format = array(1218.90, 1729.13); break; } |
|
| 841 | + case 'RA3': {$format = array(864.57, 1218.90); break; } |
|
| 842 | + case 'RA4': {$format = array(609.45, 864.57); break; } |
|
| 843 | + case 'SRA0': {$format = array(2551.18, 3628.35); break; } |
|
| 844 | + case 'SRA1': {$format = array(1814.17, 2551.18); break; } |
|
| 845 | + case 'SRA2': {$format = array(1275.59, 1814.17); break; } |
|
| 846 | + case 'SRA3': {$format = array(907.09, 1275.59); break; } |
|
| 847 | + case 'SRA4': {$format = array(637.80, 907.09); break; } |
|
| 848 | + case 'LETTER': {$format = array(612.00, 792.00); break; } |
|
| 849 | + case 'LEGAL': {$format = array(612.00, 1008.00); break; } |
|
| 850 | + case 'EXECUTIVE': {$format = array(521.86, 756.00); break; } |
|
| 851 | + case 'FOLIO': {$format = array(612.00, 936.00); break; } |
|
| 852 | 852 | // default: {$this->Error('Unknown page format: '.$format); break;} |
| 853 | 853 | // END CHANGES Nicola Asuni |
| 854 | 854 | } |
| 855 | - $this->fwPt=$format[0]; |
|
| 856 | - $this->fhPt=$format[1]; |
|
| 855 | + $this->fwPt = $format[0]; |
|
| 856 | + $this->fhPt = $format[1]; |
|
| 857 | 857 | } |
| 858 | 858 | else { |
| 859 | - $this->fwPt=$format[0]*$this->k; |
|
| 860 | - $this->fhPt=$format[1]*$this->k; |
|
| 859 | + $this->fwPt = $format[0] * $this->k; |
|
| 860 | + $this->fhPt = $format[1] * $this->k; |
|
| 861 | 861 | } |
| 862 | 862 | |
| 863 | - $this->fw=$this->fwPt/$this->k; |
|
| 864 | - $this->fh=$this->fhPt/$this->k; |
|
| 863 | + $this->fw = $this->fwPt / $this->k; |
|
| 864 | + $this->fh = $this->fhPt / $this->k; |
|
| 865 | 865 | |
| 866 | 866 | //Page orientation |
| 867 | - $orientation=strtolower($orientation); |
|
| 868 | - if($orientation=='p' or $orientation=='portrait') { |
|
| 869 | - $this->DefOrientation='P'; |
|
| 870 | - $this->wPt=$this->fwPt; |
|
| 871 | - $this->hPt=$this->fhPt; |
|
| 867 | + $orientation = strtolower($orientation); |
|
| 868 | + if ($orientation == 'p' or $orientation == 'portrait') { |
|
| 869 | + $this->DefOrientation = 'P'; |
|
| 870 | + $this->wPt = $this->fwPt; |
|
| 871 | + $this->hPt = $this->fhPt; |
|
| 872 | 872 | } |
| 873 | - elseif($orientation=='l' or $orientation=='landscape') { |
|
| 874 | - $this->DefOrientation='L'; |
|
| 875 | - $this->wPt=$this->fhPt; |
|
| 876 | - $this->hPt=$this->fwPt; |
|
| 873 | + elseif ($orientation == 'l' or $orientation == 'landscape') { |
|
| 874 | + $this->DefOrientation = 'L'; |
|
| 875 | + $this->wPt = $this->fhPt; |
|
| 876 | + $this->hPt = $this->fwPt; |
|
| 877 | 877 | } |
| 878 | 878 | else { |
| 879 | 879 | $this->Error('Incorrect orientation: '.$orientation); |
| 880 | 880 | } |
| 881 | 881 | |
| 882 | - $this->CurOrientation=$this->DefOrientation; |
|
| 883 | - $this->w=$this->wPt/$this->k; |
|
| 884 | - $this->h=$this->hPt/$this->k; |
|
| 882 | + $this->CurOrientation = $this->DefOrientation; |
|
| 883 | + $this->w = $this->wPt / $this->k; |
|
| 884 | + $this->h = $this->hPt / $this->k; |
|
| 885 | 885 | //Page margins (1 cm) |
| 886 | - $margin=28.35/$this->k; |
|
| 887 | - $this->SetMargins($margin,$margin); |
|
| 886 | + $margin = 28.35 / $this->k; |
|
| 887 | + $this->SetMargins($margin, $margin); |
|
| 888 | 888 | //Interior cell margin (1 mm) |
| 889 | - $this->cMargin=$margin/10; |
|
| 889 | + $this->cMargin = $margin / 10; |
|
| 890 | 890 | //Line width (0.2 mm) |
| 891 | - $this->LineWidth=.567/$this->k; |
|
| 891 | + $this->LineWidth = .567 / $this->k; |
|
| 892 | 892 | //Automatic page break |
| 893 | - $this->SetAutoPageBreak(true,2*$margin); |
|
| 893 | + $this->SetAutoPageBreak(true, 2 * $margin); |
|
| 894 | 894 | //Full width display mode |
| 895 | 895 | $this->SetDisplayMode('fullwidth'); |
| 896 | 896 | //Compression |
@@ -908,7 +908,7 @@ discard block |
||
| 908 | 908 | $this->issetcolor = false; |
| 909 | 909 | $this->tableborder = 0; |
| 910 | 910 | $this->tdbegin = false; |
| 911 | - $this->tdwidth= 0; |
|
| 911 | + $this->tdwidth = 0; |
|
| 912 | 912 | $this->tdheight = 0; |
| 913 | 913 | $this->tdalign = "L"; |
| 914 | 914 | $this->tdbgcolor = false; |
@@ -924,7 +924,7 @@ discard block |
||
| 924 | 924 | * @since 1.5.2 |
| 925 | 925 | */ |
| 926 | 926 | function setImageScale($scale) { |
| 927 | - $this->imgscale=$scale; |
|
| 927 | + $this->imgscale = $scale; |
|
| 928 | 928 | } |
| 929 | 929 | |
| 930 | 930 | /** |
@@ -985,14 +985,14 @@ discard block |
||
| 985 | 985 | * @since 1.0 |
| 986 | 986 | * @see SetLeftMargin(), SetTopMargin(), SetRightMargin(), SetAutoPageBreak() |
| 987 | 987 | */ |
| 988 | - function SetMargins($left, $top, $right=-1) { |
|
| 988 | + function SetMargins($left, $top, $right = -1) { |
|
| 989 | 989 | //Set left, top and right margins |
| 990 | - $this->lMargin=$left; |
|
| 991 | - $this->tMargin=$top; |
|
| 992 | - if($right==-1) { |
|
| 993 | - $right=$left; |
|
| 990 | + $this->lMargin = $left; |
|
| 991 | + $this->tMargin = $top; |
|
| 992 | + if ($right == -1) { |
|
| 993 | + $right = $left; |
|
| 994 | 994 | } |
| 995 | - $this->rMargin=$right; |
|
| 995 | + $this->rMargin = $right; |
|
| 996 | 996 | } |
| 997 | 997 | |
| 998 | 998 | /** |
@@ -1003,9 +1003,9 @@ discard block |
||
| 1003 | 1003 | */ |
| 1004 | 1004 | function SetLeftMargin($margin) { |
| 1005 | 1005 | //Set left margin |
| 1006 | - $this->lMargin=$margin; |
|
| 1007 | - if(($this->page>0) and ($this->x<$margin)) { |
|
| 1008 | - $this->x=$margin; |
|
| 1006 | + $this->lMargin = $margin; |
|
| 1007 | + if (($this->page > 0) and ($this->x < $margin)) { |
|
| 1008 | + $this->x = $margin; |
|
| 1009 | 1009 | } |
| 1010 | 1010 | } |
| 1011 | 1011 | |
@@ -1017,7 +1017,7 @@ discard block |
||
| 1017 | 1017 | */ |
| 1018 | 1018 | function SetTopMargin($margin) { |
| 1019 | 1019 | //Set top margin |
| 1020 | - $this->tMargin=$margin; |
|
| 1020 | + $this->tMargin = $margin; |
|
| 1021 | 1021 | } |
| 1022 | 1022 | |
| 1023 | 1023 | /** |
@@ -1028,7 +1028,7 @@ discard block |
||
| 1028 | 1028 | */ |
| 1029 | 1029 | function SetRightMargin($margin) { |
| 1030 | 1030 | //Set right margin |
| 1031 | - $this->rMargin=$margin; |
|
| 1031 | + $this->rMargin = $margin; |
|
| 1032 | 1032 | } |
| 1033 | 1033 | |
| 1034 | 1034 | /** |
@@ -1038,11 +1038,11 @@ discard block |
||
| 1038 | 1038 | * @since 1.0 |
| 1039 | 1039 | * @see Cell(), MultiCell(), AcceptPageBreak() |
| 1040 | 1040 | */ |
| 1041 | - function SetAutoPageBreak($auto, $margin=0) { |
|
| 1041 | + function SetAutoPageBreak($auto, $margin = 0) { |
|
| 1042 | 1042 | //Set auto page break mode and triggering margin |
| 1043 | - $this->AutoPageBreak=$auto; |
|
| 1044 | - $this->bMargin=$margin; |
|
| 1045 | - $this->PageBreakTrigger=$this->h-$margin; |
|
| 1043 | + $this->AutoPageBreak = $auto; |
|
| 1044 | + $this->bMargin = $margin; |
|
| 1045 | + $this->PageBreakTrigger = $this->h - $margin; |
|
| 1046 | 1046 | } |
| 1047 | 1047 | |
| 1048 | 1048 | /** |
@@ -1051,16 +1051,16 @@ discard block |
||
| 1051 | 1051 | * @param string $layout The page layout. Possible values are:<ul><li>single: displays one page at once</li><li>continuous: displays pages continuously (default)</li><li>two: displays two pages on two columns</li><li>default: uses viewer default mode</li></ul> |
| 1052 | 1052 | * @since 1.2 |
| 1053 | 1053 | */ |
| 1054 | - function SetDisplayMode($zoom, $layout='continuous') { |
|
| 1054 | + function SetDisplayMode($zoom, $layout = 'continuous') { |
|
| 1055 | 1055 | //Set display mode in viewer |
| 1056 | - if($zoom=='fullpage' or $zoom=='fullwidth' or $zoom=='real' or $zoom=='default' or !is_string($zoom)) { |
|
| 1057 | - $this->ZoomMode=$zoom; |
|
| 1056 | + if ($zoom == 'fullpage' or $zoom == 'fullwidth' or $zoom == 'real' or $zoom == 'default' or !is_string($zoom)) { |
|
| 1057 | + $this->ZoomMode = $zoom; |
|
| 1058 | 1058 | } |
| 1059 | 1059 | else { |
| 1060 | 1060 | $this->Error('Incorrect zoom display mode: '.$zoom); |
| 1061 | 1061 | } |
| 1062 | - if($layout=='single' or $layout=='continuous' or $layout=='two' or $layout=='default') { |
|
| 1063 | - $this->LayoutMode=$layout; |
|
| 1062 | + if ($layout == 'single' or $layout == 'continuous' or $layout == 'two' or $layout == 'default') { |
|
| 1063 | + $this->LayoutMode = $layout; |
|
| 1064 | 1064 | } |
| 1065 | 1065 | else { |
| 1066 | 1066 | $this->Error('Incorrect layout display mode: '.$layout); |
@@ -1075,11 +1075,11 @@ discard block |
||
| 1075 | 1075 | */ |
| 1076 | 1076 | function SetCompression($compress) { |
| 1077 | 1077 | //Set page compression |
| 1078 | - if(function_exists('gzcompress')) { |
|
| 1079 | - $this->compress=$compress; |
|
| 1078 | + if (function_exists('gzcompress')) { |
|
| 1079 | + $this->compress = $compress; |
|
| 1080 | 1080 | } |
| 1081 | 1081 | else { |
| 1082 | - $this->compress=false; |
|
| 1082 | + $this->compress = false; |
|
| 1083 | 1083 | } |
| 1084 | 1084 | } |
| 1085 | 1085 | |
@@ -1091,7 +1091,7 @@ discard block |
||
| 1091 | 1091 | */ |
| 1092 | 1092 | function SetTitle($title) { |
| 1093 | 1093 | //Title of document |
| 1094 | - $this->title=$title; |
|
| 1094 | + $this->title = $title; |
|
| 1095 | 1095 | } |
| 1096 | 1096 | |
| 1097 | 1097 | /** |
@@ -1102,7 +1102,7 @@ discard block |
||
| 1102 | 1102 | */ |
| 1103 | 1103 | function SetSubject($subject) { |
| 1104 | 1104 | //Subject of document |
| 1105 | - $this->subject=$subject; |
|
| 1105 | + $this->subject = $subject; |
|
| 1106 | 1106 | } |
| 1107 | 1107 | |
| 1108 | 1108 | /** |
@@ -1113,7 +1113,7 @@ discard block |
||
| 1113 | 1113 | */ |
| 1114 | 1114 | function SetAuthor($author) { |
| 1115 | 1115 | //Author of document |
| 1116 | - $this->author=$author; |
|
| 1116 | + $this->author = $author; |
|
| 1117 | 1117 | } |
| 1118 | 1118 | |
| 1119 | 1119 | /** |
@@ -1124,7 +1124,7 @@ discard block |
||
| 1124 | 1124 | */ |
| 1125 | 1125 | function SetKeywords($keywords) { |
| 1126 | 1126 | //Keywords of document |
| 1127 | - $this->keywords=$keywords; |
|
| 1127 | + $this->keywords = $keywords; |
|
| 1128 | 1128 | } |
| 1129 | 1129 | |
| 1130 | 1130 | /** |
@@ -1135,7 +1135,7 @@ discard block |
||
| 1135 | 1135 | */ |
| 1136 | 1136 | function SetCreator($creator) { |
| 1137 | 1137 | //Creator of document |
| 1138 | - $this->creator=$creator; |
|
| 1138 | + $this->creator = $creator; |
|
| 1139 | 1139 | } |
| 1140 | 1140 | |
| 1141 | 1141 | /** |
@@ -1159,7 +1159,7 @@ discard block |
||
| 1159 | 1159 | * @since 1.4 |
| 1160 | 1160 | * @see PageNo(), Footer() |
| 1161 | 1161 | */ |
| 1162 | - function AliasNbPages($alias='{nb}') { |
|
| 1162 | + function AliasNbPages($alias = '{nb}') { |
|
| 1163 | 1163 | //Define an alias for total number of pages |
| 1164 | 1164 | $this->AliasNbPages = $this->_escapetext($alias); |
| 1165 | 1165 | } |
@@ -1183,7 +1183,7 @@ discard block |
||
| 1183 | 1183 | */ |
| 1184 | 1184 | function Open() { |
| 1185 | 1185 | //Begin document |
| 1186 | - $this->state=1; |
|
| 1186 | + $this->state = 1; |
|
| 1187 | 1187 | } |
| 1188 | 1188 | |
| 1189 | 1189 | /** |
@@ -1193,16 +1193,16 @@ discard block |
||
| 1193 | 1193 | */ |
| 1194 | 1194 | function Close() { |
| 1195 | 1195 | //Terminate document |
| 1196 | - if($this->state==3) { |
|
| 1196 | + if ($this->state == 3) { |
|
| 1197 | 1197 | return; |
| 1198 | 1198 | } |
| 1199 | - if($this->page==0) { |
|
| 1199 | + if ($this->page == 0) { |
|
| 1200 | 1200 | $this->AddPage(); |
| 1201 | 1201 | } |
| 1202 | 1202 | //Page footer |
| 1203 | - $this->InFooter=true; |
|
| 1203 | + $this->InFooter = true; |
|
| 1204 | 1204 | $this->Footer(); |
| 1205 | - $this->InFooter=false; |
|
| 1205 | + $this->InFooter = false; |
|
| 1206 | 1206 | //Close page |
| 1207 | 1207 | $this->_endpage(); |
| 1208 | 1208 | //Close document |
@@ -1217,24 +1217,24 @@ discard block |
||
| 1217 | 1217 | * @since 1.0 |
| 1218 | 1218 | * @see TCPDF(), Header(), Footer(), SetMargins() |
| 1219 | 1219 | */ |
| 1220 | - function AddPage($orientation='') { |
|
| 1220 | + function AddPage($orientation = '') { |
|
| 1221 | 1221 | //Start a new page |
| 1222 | - if($this->state==0) { |
|
| 1222 | + if ($this->state == 0) { |
|
| 1223 | 1223 | $this->Open(); |
| 1224 | 1224 | } |
| 1225 | - $family=$this->FontFamily; |
|
| 1226 | - $style=$this->FontStyle.($this->underline ? 'U' : ''); |
|
| 1227 | - $size=$this->FontSizePt; |
|
| 1228 | - $lw=$this->LineWidth; |
|
| 1229 | - $dc=$this->DrawColor; |
|
| 1230 | - $fc=$this->FillColor; |
|
| 1231 | - $tc=$this->TextColor; |
|
| 1232 | - $cf=$this->ColorFlag; |
|
| 1233 | - if($this->page>0) { |
|
| 1225 | + $family = $this->FontFamily; |
|
| 1226 | + $style = $this->FontStyle.($this->underline ? 'U' : ''); |
|
| 1227 | + $size = $this->FontSizePt; |
|
| 1228 | + $lw = $this->LineWidth; |
|
| 1229 | + $dc = $this->DrawColor; |
|
| 1230 | + $fc = $this->FillColor; |
|
| 1231 | + $tc = $this->TextColor; |
|
| 1232 | + $cf = $this->ColorFlag; |
|
| 1233 | + if ($this->page > 0) { |
|
| 1234 | 1234 | //Page footer |
| 1235 | - $this->InFooter=true; |
|
| 1235 | + $this->InFooter = true; |
|
| 1236 | 1236 | $this->Footer(); |
| 1237 | - $this->InFooter=false; |
|
| 1237 | + $this->InFooter = false; |
|
| 1238 | 1238 | //Close page |
| 1239 | 1239 | $this->_endpage(); |
| 1240 | 1240 | } |
@@ -1243,45 +1243,45 @@ discard block |
||
| 1243 | 1243 | //Set line cap style to square |
| 1244 | 1244 | $this->_out('2 J'); |
| 1245 | 1245 | //Set line width |
| 1246 | - $this->LineWidth=$lw; |
|
| 1247 | - $this->_out(sprintf('%.2f w',$lw*$this->k)); |
|
| 1246 | + $this->LineWidth = $lw; |
|
| 1247 | + $this->_out(sprintf('%.2f w', $lw * $this->k)); |
|
| 1248 | 1248 | //Set font |
| 1249 | - if($family) { |
|
| 1250 | - $this->SetFont($family,$style,$size); |
|
| 1249 | + if ($family) { |
|
| 1250 | + $this->SetFont($family, $style, $size); |
|
| 1251 | 1251 | } |
| 1252 | 1252 | //Set colors |
| 1253 | - $this->DrawColor=$dc; |
|
| 1254 | - if($dc!='0 G') { |
|
| 1253 | + $this->DrawColor = $dc; |
|
| 1254 | + if ($dc != '0 G') { |
|
| 1255 | 1255 | $this->_out($dc); |
| 1256 | 1256 | } |
| 1257 | - $this->FillColor=$fc; |
|
| 1258 | - if($fc!='0 g') { |
|
| 1257 | + $this->FillColor = $fc; |
|
| 1258 | + if ($fc != '0 g') { |
|
| 1259 | 1259 | $this->_out($fc); |
| 1260 | 1260 | } |
| 1261 | - $this->TextColor=$tc; |
|
| 1262 | - $this->ColorFlag=$cf; |
|
| 1261 | + $this->TextColor = $tc; |
|
| 1262 | + $this->ColorFlag = $cf; |
|
| 1263 | 1263 | //Page header |
| 1264 | 1264 | $this->Header(); |
| 1265 | 1265 | //Restore line width |
| 1266 | - if($this->LineWidth!=$lw) { |
|
| 1267 | - $this->LineWidth=$lw; |
|
| 1268 | - $this->_out(sprintf('%.2f w',$lw*$this->k)); |
|
| 1266 | + if ($this->LineWidth != $lw) { |
|
| 1267 | + $this->LineWidth = $lw; |
|
| 1268 | + $this->_out(sprintf('%.2f w', $lw * $this->k)); |
|
| 1269 | 1269 | } |
| 1270 | 1270 | //Restore font |
| 1271 | - if($family) { |
|
| 1272 | - $this->SetFont($family,$style,$size); |
|
| 1271 | + if ($family) { |
|
| 1272 | + $this->SetFont($family, $style, $size); |
|
| 1273 | 1273 | } |
| 1274 | 1274 | //Restore colors |
| 1275 | - if($this->DrawColor!=$dc) { |
|
| 1276 | - $this->DrawColor=$dc; |
|
| 1275 | + if ($this->DrawColor != $dc) { |
|
| 1276 | + $this->DrawColor = $dc; |
|
| 1277 | 1277 | $this->_out($dc); |
| 1278 | 1278 | } |
| 1279 | - if($this->FillColor!=$fc) { |
|
| 1280 | - $this->FillColor=$fc; |
|
| 1279 | + if ($this->FillColor != $fc) { |
|
| 1280 | + $this->FillColor = $fc; |
|
| 1281 | 1281 | $this->_out($fc); |
| 1282 | 1282 | } |
| 1283 | - $this->TextColor=$tc; |
|
| 1284 | - $this->ColorFlag=$cf; |
|
| 1283 | + $this->TextColor = $tc; |
|
| 1284 | + $this->ColorFlag = $cf; |
|
| 1285 | 1285 | } |
| 1286 | 1286 | |
| 1287 | 1287 | |
@@ -1293,7 +1293,7 @@ discard block |
||
| 1293 | 1293 | * @param string $ht string to print as title on document header |
| 1294 | 1294 | * @param string $hs string to print on document header |
| 1295 | 1295 | */ |
| 1296 | - function setHeaderData($ln="", $lw=0, $ht="", $hs="") { |
|
| 1296 | + function setHeaderData($ln = "", $lw = 0, $ht = "", $hs = "") { |
|
| 1297 | 1297 | $this->header_logo = $ln; |
| 1298 | 1298 | $this->header_logo_width = $lw; |
| 1299 | 1299 | $this->header_title = $ht; |
@@ -1305,7 +1305,7 @@ discard block |
||
| 1305 | 1305 | * (minimum distance between header and top page margin) |
| 1306 | 1306 | * @param int $hm distance in millimeters |
| 1307 | 1307 | */ |
| 1308 | - function setHeaderMargin($hm=10) { |
|
| 1308 | + function setHeaderMargin($hm = 10) { |
|
| 1309 | 1309 | $this->header_margin = $hm; |
| 1310 | 1310 | } |
| 1311 | 1311 | |
@@ -1314,7 +1314,7 @@ discard block |
||
| 1314 | 1314 | * (minimum distance between footer and bottom page margin) |
| 1315 | 1315 | * @param int $fm distance in millimeters |
| 1316 | 1316 | */ |
| 1317 | - function setFooterMargin($fm=10) { |
|
| 1317 | + function setFooterMargin($fm = 10) { |
|
| 1318 | 1318 | $this->footer_margin = $fm; |
| 1319 | 1319 | } |
| 1320 | 1320 | |
@@ -1322,7 +1322,7 @@ discard block |
||
| 1322 | 1322 | * Set a flag to print page header. |
| 1323 | 1323 | * @param boolean $val set to true to print the page header (default), false otherwise. |
| 1324 | 1324 | */ |
| 1325 | - function setPrintHeader($val=true) { |
|
| 1325 | + function setPrintHeader($val = true) { |
|
| 1326 | 1326 | $this->print_header = $val; |
| 1327 | 1327 | } |
| 1328 | 1328 | |
@@ -1330,7 +1330,7 @@ discard block |
||
| 1330 | 1330 | * Set a flag to print page footer. |
| 1331 | 1331 | * @param boolean $value set to true to print the page footer (default), false otherwise. |
| 1332 | 1332 | */ |
| 1333 | - function setPrintFooter($val=true) { |
|
| 1333 | + function setPrintFooter($val = true) { |
|
| 1334 | 1334 | $this->print_footer = $val; |
| 1335 | 1335 | } |
| 1336 | 1336 | |
@@ -1402,7 +1402,7 @@ discard block |
||
| 1402 | 1402 | } |
| 1403 | 1403 | |
| 1404 | 1404 | //set font |
| 1405 | - $this->SetFont($this->footer_font[0], $this->footer_font[1] , $this->footer_font[2]); |
|
| 1405 | + $this->SetFont($this->footer_font[0], $this->footer_font[1], $this->footer_font[2]); |
|
| 1406 | 1406 | //set style for cell border |
| 1407 | 1407 | $line_width = 0.3; |
| 1408 | 1408 | $this->SetLineWidth($line_width); |
@@ -1447,15 +1447,15 @@ discard block |
||
| 1447 | 1447 | * @since 1.3 |
| 1448 | 1448 | * @see SetFillColor(), SetTextColor(), Line(), Rect(), Cell(), MultiCell() |
| 1449 | 1449 | */ |
| 1450 | - function SetDrawColor($r, $g=-1, $b=-1) { |
|
| 1450 | + function SetDrawColor($r, $g = -1, $b = -1) { |
|
| 1451 | 1451 | //Set color for all stroking operations |
| 1452 | - if(($r==0 and $g==0 and $b==0) or $g==-1) { |
|
| 1453 | - $this->DrawColor=sprintf('%.3f G',$r/255); |
|
| 1452 | + if (($r == 0 and $g == 0 and $b == 0) or $g == -1) { |
|
| 1453 | + $this->DrawColor = sprintf('%.3f G', $r / 255); |
|
| 1454 | 1454 | } |
| 1455 | 1455 | else { |
| 1456 | - $this->DrawColor=sprintf('%.3f %.3f %.3f RG',$r/255,$g/255,$b/255); |
|
| 1456 | + $this->DrawColor = sprintf('%.3f %.3f %.3f RG', $r / 255, $g / 255, $b / 255); |
|
| 1457 | 1457 | } |
| 1458 | - if($this->page>0) { |
|
| 1458 | + if ($this->page > 0) { |
|
| 1459 | 1459 | $this->_out($this->DrawColor); |
| 1460 | 1460 | } |
| 1461 | 1461 | } |
@@ -1469,16 +1469,16 @@ discard block |
||
| 1469 | 1469 | * @since 1.3 |
| 1470 | 1470 | * @see SetDrawColor(), SetTextColor(), Rect(), Cell(), MultiCell() |
| 1471 | 1471 | */ |
| 1472 | - function SetFillColor($r, $g=-1, $b=-1, $storeprev=false) { |
|
| 1472 | + function SetFillColor($r, $g = -1, $b = -1, $storeprev = false) { |
|
| 1473 | 1473 | //Set color for all filling operations |
| 1474 | - if(($r==0 and $g==0 and $b==0) or $g==-1) { |
|
| 1475 | - $this->FillColor=sprintf('%.3f g',$r/255); |
|
| 1474 | + if (($r == 0 and $g == 0 and $b == 0) or $g == -1) { |
|
| 1475 | + $this->FillColor = sprintf('%.3f g', $r / 255); |
|
| 1476 | 1476 | } |
| 1477 | 1477 | else { |
| 1478 | - $this->FillColor=sprintf('%.3f %.3f %.3f rg',$r/255,$g/255,$b/255); |
|
| 1478 | + $this->FillColor = sprintf('%.3f %.3f %.3f rg', $r / 255, $g / 255, $b / 255); |
|
| 1479 | 1479 | } |
| 1480 | - $this->ColorFlag=($this->FillColor!=$this->TextColor); |
|
| 1481 | - if($this->page>0) { |
|
| 1480 | + $this->ColorFlag = ($this->FillColor != $this->TextColor); |
|
| 1481 | + if ($this->page > 0) { |
|
| 1482 | 1482 | $this->_out($this->FillColor); |
| 1483 | 1483 | } |
| 1484 | 1484 | if ($storeprev) { |
@@ -1496,15 +1496,15 @@ discard block |
||
| 1496 | 1496 | * @since 1.3 |
| 1497 | 1497 | * @see SetDrawColor(), SetFillColor(), Text(), Cell(), MultiCell() |
| 1498 | 1498 | */ |
| 1499 | - function SetTextColor($r, $g=-1, $b=-1, $storeprev=false) { |
|
| 1499 | + function SetTextColor($r, $g = -1, $b = -1, $storeprev = false) { |
|
| 1500 | 1500 | //Set color for text |
| 1501 | - if(($r==0 and $g==0 and $b==0) or $g==-1) { |
|
| 1502 | - $this->TextColor=sprintf('%.3f g',$r/255); |
|
| 1501 | + if (($r == 0 and $g == 0 and $b == 0) or $g == -1) { |
|
| 1502 | + $this->TextColor = sprintf('%.3f g', $r / 255); |
|
| 1503 | 1503 | } |
| 1504 | 1504 | else { |
| 1505 | - $this->TextColor=sprintf('%.3f %.3f %.3f rg',$r/255,$g/255,$b/255); |
|
| 1505 | + $this->TextColor = sprintf('%.3f %.3f %.3f rg', $r / 255, $g / 255, $b / 255); |
|
| 1506 | 1506 | } |
| 1507 | - $this->ColorFlag=($this->FillColor!=$this->TextColor); |
|
| 1507 | + $this->ColorFlag = ($this->FillColor != $this->TextColor); |
|
| 1508 | 1508 | if ($storeprev) { |
| 1509 | 1509 | // store color as previous value |
| 1510 | 1510 | $this->prevTextColor = array($r, $g, $b); |
@@ -1523,16 +1523,16 @@ discard block |
||
| 1523 | 1523 | $s = (string)$s; |
| 1524 | 1524 | $cw = &$this->CurrentFont['cw']; |
| 1525 | 1525 | $w = 0; |
| 1526 | - if($this->isunicode) { |
|
| 1526 | + if ($this->isunicode) { |
|
| 1527 | 1527 | $unicode = $this->UTF8StringToArray($s); |
| 1528 | - foreach($unicode as $char) { |
|
| 1528 | + foreach ($unicode as $char) { |
|
| 1529 | 1529 | if (isset($cw[$char])) { |
| 1530 | - $w+=$cw[$char]; |
|
| 1531 | - } elseif(isset($cw[ord($char)])) { |
|
| 1532 | - $w+=$cw[ord($char)]; |
|
| 1533 | - } elseif(isset($cw[chr($char)])) { |
|
| 1534 | - $w+=$cw[chr($char)]; |
|
| 1535 | - } elseif(isset($this->CurrentFont['desc']['MissingWidth'])) { |
|
| 1530 | + $w += $cw[$char]; |
|
| 1531 | + } elseif (isset($cw[ord($char)])) { |
|
| 1532 | + $w += $cw[ord($char)]; |
|
| 1533 | + } elseif (isset($cw[chr($char)])) { |
|
| 1534 | + $w += $cw[chr($char)]; |
|
| 1535 | + } elseif (isset($this->CurrentFont['desc']['MissingWidth'])) { |
|
| 1536 | 1536 | $w += $this->CurrentFont['desc']['MissingWidth']; // set default size |
| 1537 | 1537 | } else { |
| 1538 | 1538 | $w += 500; |
@@ -1540,7 +1540,7 @@ discard block |
||
| 1540 | 1540 | } |
| 1541 | 1541 | } else { |
| 1542 | 1542 | $l = strlen($s); |
| 1543 | - for($i=0; $i<$l; $i++) { |
|
| 1543 | + for ($i = 0; $i < $l; $i++) { |
|
| 1544 | 1544 | if (isset($cw[$s{$i}])) { |
| 1545 | 1545 | $w += $cw[$s{$i}]; |
| 1546 | 1546 | } else if (isset($cw[ord($s{$i})])) { |
@@ -1559,9 +1559,9 @@ discard block |
||
| 1559 | 1559 | */ |
| 1560 | 1560 | function SetLineWidth($width) { |
| 1561 | 1561 | //Set line width |
| 1562 | - $this->LineWidth=$width; |
|
| 1563 | - if($this->page>0) { |
|
| 1564 | - $this->_out(sprintf('%.2f w',$width*$this->k)); |
|
| 1562 | + $this->LineWidth = $width; |
|
| 1563 | + if ($this->page > 0) { |
|
| 1564 | + $this->_out(sprintf('%.2f w', $width * $this->k)); |
|
| 1565 | 1565 | } |
| 1566 | 1566 | } |
| 1567 | 1567 | |
@@ -1576,7 +1576,7 @@ discard block |
||
| 1576 | 1576 | */ |
| 1577 | 1577 | function Line($x1, $y1, $x2, $y2) { |
| 1578 | 1578 | //Draw a line |
| 1579 | - $this->_out(sprintf('%.2f %.2f m %.2f %.2f l S', $x1*$this->k, ($this->h-$y1)*$this->k, $x2*$this->k, ($this->h-$y2)*$this->k)); |
|
| 1579 | + $this->_out(sprintf('%.2f %.2f m %.2f %.2f l S', $x1 * $this->k, ($this->h - $y1) * $this->k, $x2 * $this->k, ($this->h - $y2) * $this->k)); |
|
| 1580 | 1580 | } |
| 1581 | 1581 | |
| 1582 | 1582 | /** |
@@ -1589,18 +1589,18 @@ discard block |
||
| 1589 | 1589 | * @since 1.0 |
| 1590 | 1590 | * @see SetLineWidth(), SetDrawColor(), SetFillColor() |
| 1591 | 1591 | */ |
| 1592 | - function Rect($x, $y, $w, $h, $style='') { |
|
| 1592 | + function Rect($x, $y, $w, $h, $style = '') { |
|
| 1593 | 1593 | //Draw a rectangle |
| 1594 | - if($style=='F') { |
|
| 1595 | - $op='f'; |
|
| 1594 | + if ($style == 'F') { |
|
| 1595 | + $op = 'f'; |
|
| 1596 | 1596 | } |
| 1597 | - elseif($style=='FD' or $style=='DF') { |
|
| 1598 | - $op='B'; |
|
| 1597 | + elseif ($style == 'FD' or $style == 'DF') { |
|
| 1598 | + $op = 'B'; |
|
| 1599 | 1599 | } |
| 1600 | 1600 | else { |
| 1601 | - $op='S'; |
|
| 1601 | + $op = 'S'; |
|
| 1602 | 1602 | } |
| 1603 | - $this->_out(sprintf('%.2f %.2f %.2f %.2f re %s',$x*$this->k,($this->h-$y)*$this->k,$w*$this->k,-$h*$this->k,$op)); |
|
| 1603 | + $this->_out(sprintf('%.2f %.2f %.2f %.2f re %s', $x * $this->k, ($this->h - $y) * $this->k, $w * $this->k, -$h * $this->k, $op)); |
|
| 1604 | 1604 | } |
| 1605 | 1605 | |
| 1606 | 1606 | /** |
@@ -1618,74 +1618,74 @@ discard block |
||
| 1618 | 1618 | * @since 1.5 |
| 1619 | 1619 | * @see SetFont() |
| 1620 | 1620 | */ |
| 1621 | - function AddFont($family, $style='', $file='') { |
|
| 1622 | - if(empty($family)) { |
|
| 1621 | + function AddFont($family, $style = '', $file = '') { |
|
| 1622 | + if (empty($family)) { |
|
| 1623 | 1623 | return; |
| 1624 | 1624 | } |
| 1625 | 1625 | |
| 1626 | 1626 | //Add a TrueType or Type1 font |
| 1627 | 1627 | $family = strtolower($family); |
| 1628 | - if((!$this->isunicode) AND ($family == 'arial')) { |
|
| 1628 | + if ((!$this->isunicode) AND ($family == 'arial')) { |
|
| 1629 | 1629 | $family = 'helvetica'; |
| 1630 | 1630 | } |
| 1631 | 1631 | |
| 1632 | - $style=strtoupper($style); |
|
| 1633 | - $style=str_replace('U','',$style); |
|
| 1634 | - if($style == 'IB') { |
|
| 1632 | + $style = strtoupper($style); |
|
| 1633 | + $style = str_replace('U', '', $style); |
|
| 1634 | + if ($style == 'IB') { |
|
| 1635 | 1635 | $style = 'BI'; |
| 1636 | 1636 | } |
| 1637 | 1637 | |
| 1638 | 1638 | $fontkey = $family.$style; |
| 1639 | 1639 | // check if the font has been already added |
| 1640 | - if(isset($this->fonts[$fontkey])) { |
|
| 1640 | + if (isset($this->fonts[$fontkey])) { |
|
| 1641 | 1641 | return; |
| 1642 | 1642 | } |
| 1643 | 1643 | |
| 1644 | - if($file=='') { |
|
| 1644 | + if ($file == '') { |
|
| 1645 | 1645 | $file = str_replace(' ', '', $family).strtolower($style).'.php'; |
| 1646 | 1646 | } |
| 1647 | - if(!file_exists($this->_getfontpath().$file)) { |
|
| 1647 | + if (!file_exists($this->_getfontpath().$file)) { |
|
| 1648 | 1648 | // try to load the basic file without styles |
| 1649 | 1649 | $file = str_replace(' ', '', $family).'.php'; |
| 1650 | 1650 | } |
| 1651 | 1651 | |
| 1652 | 1652 | include($this->_getfontpath().$file); |
| 1653 | 1653 | |
| 1654 | - if(!isset($name) AND !isset($fpdf_charwidths)) { |
|
| 1654 | + if (!isset($name) AND !isset($fpdf_charwidths)) { |
|
| 1655 | 1655 | $this->Error('Could not include font definition file'); |
| 1656 | 1656 | } |
| 1657 | 1657 | |
| 1658 | - $i = count($this->fonts)+1; |
|
| 1658 | + $i = count($this->fonts) + 1; |
|
| 1659 | 1659 | |
| 1660 | - if($this->isunicode) { |
|
| 1660 | + if ($this->isunicode) { |
|
| 1661 | 1661 | $this->fonts[$fontkey] = array('i'=>$i, 'type'=>$type, 'name'=>$name, 'desc'=>$desc, 'up'=>$up, 'ut'=>$ut, 'cw'=>$cw, 'enc'=>$enc, 'file'=>$file, 'ctg'=>$ctg); |
| 1662 | 1662 | $fpdf_charwidths[$fontkey] = $cw; |
| 1663 | 1663 | } else { |
| 1664 | - $this->fonts[$fontkey]=array('i'=>$i, 'type'=>'core', 'name'=>$this->CoreFonts[$fontkey], 'up'=>-100, 'ut'=>50, 'cw'=>$fpdf_charwidths[$fontkey]); |
|
| 1664 | + $this->fonts[$fontkey] = array('i'=>$i, 'type'=>'core', 'name'=>$this->CoreFonts[$fontkey], 'up'=>-100, 'ut'=>50, 'cw'=>$fpdf_charwidths[$fontkey]); |
|
| 1665 | 1665 | } |
| 1666 | 1666 | |
| 1667 | - if(isset($diff) AND (!empty($diff))) { |
|
| 1667 | + if (isset($diff) AND (!empty($diff))) { |
|
| 1668 | 1668 | //Search existing encodings |
| 1669 | - $d=0; |
|
| 1670 | - $nb=count($this->diffs); |
|
| 1671 | - for($i=1;$i<=$nb;$i++) { |
|
| 1672 | - if($this->diffs[$i]==$diff) { |
|
| 1673 | - $d=$i; |
|
| 1669 | + $d = 0; |
|
| 1670 | + $nb = count($this->diffs); |
|
| 1671 | + for ($i = 1; $i <= $nb; $i++) { |
|
| 1672 | + if ($this->diffs[$i] == $diff) { |
|
| 1673 | + $d = $i; |
|
| 1674 | 1674 | break; |
| 1675 | 1675 | } |
| 1676 | 1676 | } |
| 1677 | - if($d==0) { |
|
| 1678 | - $d=$nb+1; |
|
| 1679 | - $this->diffs[$d]=$diff; |
|
| 1677 | + if ($d == 0) { |
|
| 1678 | + $d = $nb + 1; |
|
| 1679 | + $this->diffs[$d] = $diff; |
|
| 1680 | 1680 | } |
| 1681 | - $this->fonts[$fontkey]['diff']=$d; |
|
| 1681 | + $this->fonts[$fontkey]['diff'] = $d; |
|
| 1682 | 1682 | } |
| 1683 | - if(!empty($file)) { |
|
| 1684 | - if((strcasecmp($type,"TrueType") == 0) OR (strcasecmp($type,"TrueTypeUnicode") == 0)) { |
|
| 1685 | - $this->FontFiles[$file]=array('length1'=>$originalsize); |
|
| 1683 | + if (!empty($file)) { |
|
| 1684 | + if ((strcasecmp($type, "TrueType") == 0) OR (strcasecmp($type, "TrueTypeUnicode") == 0)) { |
|
| 1685 | + $this->FontFiles[$file] = array('length1'=>$originalsize); |
|
| 1686 | 1686 | } |
| 1687 | 1687 | else { |
| 1688 | - $this->FontFiles[$file]=array('length1'=>$size1,'length2'=>$size2); |
|
| 1688 | + $this->FontFiles[$file] = array('length1'=>$size1, 'length2'=>$size2); |
|
| 1689 | 1689 | } |
| 1690 | 1690 | } |
| 1691 | 1691 | } |
@@ -1717,7 +1717,7 @@ discard block |
||
| 1717 | 1717 | * @since 1.0 |
| 1718 | 1718 | * @see AddFont(), SetFontSize(), Cell(), MultiCell(), Write() |
| 1719 | 1719 | */ |
| 1720 | - function SetFont($family, $style='', $size=0) { |
|
| 1720 | + function SetFont($family, $style = '', $size = 0) { |
|
| 1721 | 1721 | // save previous values |
| 1722 | 1722 | $this->prevFontFamily = $this->FontFamily; |
| 1723 | 1723 | $this->prevFontStyle = $this->FontStyle; |
@@ -1725,39 +1725,39 @@ discard block |
||
| 1725 | 1725 | //Select a font; size given in points |
| 1726 | 1726 | global $fpdf_charwidths; |
| 1727 | 1727 | |
| 1728 | - $family=strtolower($family); |
|
| 1729 | - if($family=='') { |
|
| 1730 | - $family=$this->FontFamily; |
|
| 1728 | + $family = strtolower($family); |
|
| 1729 | + if ($family == '') { |
|
| 1730 | + $family = $this->FontFamily; |
|
| 1731 | 1731 | } |
| 1732 | - if((!$this->isunicode) AND ($family == 'arial')) { |
|
| 1732 | + if ((!$this->isunicode) AND ($family == 'arial')) { |
|
| 1733 | 1733 | $family = 'helvetica'; |
| 1734 | 1734 | } |
| 1735 | - elseif(($family=="symbol") OR ($family=="zapfdingbats")) { |
|
| 1736 | - $style=''; |
|
| 1735 | + elseif (($family == "symbol") OR ($family == "zapfdingbats")) { |
|
| 1736 | + $style = ''; |
|
| 1737 | 1737 | } |
| 1738 | - $style=strtoupper($style); |
|
| 1738 | + $style = strtoupper($style); |
|
| 1739 | 1739 | |
| 1740 | - if(strpos($style,'U')!==false) { |
|
| 1741 | - $this->underline=true; |
|
| 1742 | - $style=str_replace('U','',$style); |
|
| 1740 | + if (strpos($style, 'U') !== false) { |
|
| 1741 | + $this->underline = true; |
|
| 1742 | + $style = str_replace('U', '', $style); |
|
| 1743 | 1743 | } |
| 1744 | 1744 | else { |
| 1745 | - $this->underline=false; |
|
| 1745 | + $this->underline = false; |
|
| 1746 | 1746 | } |
| 1747 | - if($style=='IB') { |
|
| 1748 | - $style='BI'; |
|
| 1747 | + if ($style == 'IB') { |
|
| 1748 | + $style = 'BI'; |
|
| 1749 | 1749 | } |
| 1750 | - if($size==0) { |
|
| 1751 | - $size=$this->FontSizePt; |
|
| 1750 | + if ($size == 0) { |
|
| 1751 | + $size = $this->FontSizePt; |
|
| 1752 | 1752 | } |
| 1753 | 1753 | |
| 1754 | 1754 | // try to add font (if not already added) |
| 1755 | - if($this->isunicode) { |
|
| 1755 | + if ($this->isunicode) { |
|
| 1756 | 1756 | $this->AddFont($family, $style); |
| 1757 | 1757 | } |
| 1758 | 1758 | |
| 1759 | 1759 | //Test if font is already selected |
| 1760 | - if(($this->FontFamily == $family) AND ($this->FontStyle == $style) AND ($this->FontSizePt == $size)) { |
|
| 1760 | + if (($this->FontFamily == $family) AND ($this->FontStyle == $style) AND ($this->FontSizePt == $size)) { |
|
| 1761 | 1761 | return; |
| 1762 | 1762 | } |
| 1763 | 1763 | |
@@ -1767,32 +1767,32 @@ discard block |
||
| 1767 | 1767 | //} |
| 1768 | 1768 | |
| 1769 | 1769 | //Test if used for the first time |
| 1770 | - if(!isset($this->fonts[$fontkey])) { |
|
| 1770 | + if (!isset($this->fonts[$fontkey])) { |
|
| 1771 | 1771 | //Check if one of the standard fonts |
| 1772 | - if(isset($this->CoreFonts[$fontkey])) { |
|
| 1773 | - if(!isset($fpdf_charwidths[$fontkey])) { |
|
| 1772 | + if (isset($this->CoreFonts[$fontkey])) { |
|
| 1773 | + if (!isset($fpdf_charwidths[$fontkey])) { |
|
| 1774 | 1774 | //Load metric file |
| 1775 | 1775 | $file = $family; |
| 1776 | - if(($family!='symbol') AND ($family!='zapfdingbats')) { |
|
| 1776 | + if (($family != 'symbol') AND ($family != 'zapfdingbats')) { |
|
| 1777 | 1777 | $file .= strtolower($style); |
| 1778 | 1778 | } |
| 1779 | - if(!file_exists($this->_getfontpath().$file.'.php')) { |
|
| 1779 | + if (!file_exists($this->_getfontpath().$file.'.php')) { |
|
| 1780 | 1780 | // try to load the basic file without styles |
| 1781 | 1781 | $file = $family; |
| 1782 | 1782 | $fontkey = $family; |
| 1783 | 1783 | } |
| 1784 | 1784 | include($this->_getfontpath().$file.'.php'); |
| 1785 | - if (($this->isunicode AND !isset($ctg)) OR ((!$this->isunicode) AND (!isset($fpdf_charwidths[$fontkey]))) ) { |
|
| 1785 | + if (($this->isunicode AND !isset($ctg)) OR ((!$this->isunicode) AND (!isset($fpdf_charwidths[$fontkey])))) { |
|
| 1786 | 1786 | $this->Error("Could not include font metric file [".$fontkey."]: ".$this->_getfontpath().$file.".php"); |
| 1787 | 1787 | } |
| 1788 | 1788 | } |
| 1789 | 1789 | $i = count($this->fonts) + 1; |
| 1790 | 1790 | |
| 1791 | - if($this->isunicode) { |
|
| 1791 | + if ($this->isunicode) { |
|
| 1792 | 1792 | $this->fonts[$fontkey] = array('i'=>$i, 'type'=>$type, 'name'=>$name, 'desc'=>$desc, 'up'=>$up, 'ut'=>$ut, 'cw'=>$cw, 'enc'=>$enc, 'file'=>$file, 'ctg'=>$ctg); |
| 1793 | 1793 | $fpdf_charwidths[$fontkey] = $cw; |
| 1794 | 1794 | } else { |
| 1795 | - $this->fonts[$fontkey]=array('i'=>$i, 'type'=>'core', 'name'=>$this->CoreFonts[$fontkey], 'up'=>-100, 'ut'=>50, 'cw'=>$fpdf_charwidths[$fontkey]); |
|
| 1795 | + $this->fonts[$fontkey] = array('i'=>$i, 'type'=>'core', 'name'=>$this->CoreFonts[$fontkey], 'up'=>-100, 'ut'=>50, 'cw'=>$fpdf_charwidths[$fontkey]); |
|
| 1796 | 1796 | } |
| 1797 | 1797 | } |
| 1798 | 1798 | else { |
@@ -1805,7 +1805,7 @@ discard block |
||
| 1805 | 1805 | $this->FontSizePt = $size; |
| 1806 | 1806 | $this->FontSize = $size / $this->k; |
| 1807 | 1807 | $this->CurrentFont = &$this->fonts[$fontkey]; |
| 1808 | - if($this->page>0) { |
|
| 1808 | + if ($this->page > 0) { |
|
| 1809 | 1809 | $this->_out(sprintf('BT /F%d %.2f Tf ET', $this->CurrentFont['i'], $this->FontSizePt)); |
| 1810 | 1810 | } |
| 1811 | 1811 | } |
@@ -1818,12 +1818,12 @@ discard block |
||
| 1818 | 1818 | */ |
| 1819 | 1819 | function SetFontSize($size) { |
| 1820 | 1820 | //Set font size in points |
| 1821 | - if($this->FontSizePt==$size) { |
|
| 1821 | + if ($this->FontSizePt == $size) { |
|
| 1822 | 1822 | return; |
| 1823 | 1823 | } |
| 1824 | 1824 | $this->FontSizePt = $size; |
| 1825 | 1825 | $this->FontSize = $size / $this->k; |
| 1826 | - if($this->page > 0) { |
|
| 1826 | + if ($this->page > 0) { |
|
| 1827 | 1827 | $this->_out(sprintf('BT /F%d %.2f Tf ET', $this->CurrentFont['i'], $this->FontSizePt)); |
| 1828 | 1828 | } |
| 1829 | 1829 | } |
@@ -1836,8 +1836,8 @@ discard block |
||
| 1836 | 1836 | */ |
| 1837 | 1837 | function AddLink() { |
| 1838 | 1838 | //Create a new internal link |
| 1839 | - $n=count($this->links)+1; |
|
| 1840 | - $this->links[$n]=array(0,0); |
|
| 1839 | + $n = count($this->links) + 1; |
|
| 1840 | + $this->links[$n] = array(0, 0); |
|
| 1841 | 1841 | return $n; |
| 1842 | 1842 | } |
| 1843 | 1843 | |
@@ -1849,15 +1849,15 @@ discard block |
||
| 1849 | 1849 | * @since 1.5 |
| 1850 | 1850 | * @see AddLink() |
| 1851 | 1851 | */ |
| 1852 | - function SetLink($link, $y=0, $page=-1) { |
|
| 1852 | + function SetLink($link, $y = 0, $page = -1) { |
|
| 1853 | 1853 | //Set destination of internal link |
| 1854 | - if($y==-1) { |
|
| 1855 | - $y=$this->y; |
|
| 1854 | + if ($y == -1) { |
|
| 1855 | + $y = $this->y; |
|
| 1856 | 1856 | } |
| 1857 | - if($page==-1) { |
|
| 1858 | - $page=$this->page; |
|
| 1857 | + if ($page == -1) { |
|
| 1858 | + $page = $this->page; |
|
| 1859 | 1859 | } |
| 1860 | - $this->links[$link]=array($page,$y); |
|
| 1860 | + $this->links[$link] = array($page, $y); |
|
| 1861 | 1861 | } |
| 1862 | 1862 | |
| 1863 | 1863 | /** |
@@ -1872,7 +1872,7 @@ discard block |
||
| 1872 | 1872 | */ |
| 1873 | 1873 | function Link($x, $y, $w, $h, $link) { |
| 1874 | 1874 | //Put a link on the page |
| 1875 | - $this->PageLinks[$this->page][] = array($x * $this->k, $this->hPt - $y * $this->k, $w * $this->k, $h*$this->k, $link); |
|
| 1875 | + $this->PageLinks[$this->page][] = array($x * $this->k, $this->hPt - $y * $this->k, $w * $this->k, $h * $this->k, $link); |
|
| 1876 | 1876 | } |
| 1877 | 1877 | |
| 1878 | 1878 | /** |
@@ -1885,12 +1885,12 @@ discard block |
||
| 1885 | 1885 | */ |
| 1886 | 1886 | function Text($x, $y, $txt) { |
| 1887 | 1887 | //Output a string |
| 1888 | - $s=sprintf('BT %.2f %.2f Td (%s) Tj ET', $x * $this->k, ($this->h-$y) * $this->k, $this->_escapetext($txt)); |
|
| 1889 | - if($this->underline AND ($txt!='')) { |
|
| 1890 | - $s .= ' '.$this->_dounderline($x,$y,$txt); |
|
| 1888 | + $s = sprintf('BT %.2f %.2f Td (%s) Tj ET', $x * $this->k, ($this->h - $y) * $this->k, $this->_escapetext($txt)); |
|
| 1889 | + if ($this->underline AND ($txt != '')) { |
|
| 1890 | + $s .= ' '.$this->_dounderline($x, $y, $txt); |
|
| 1891 | 1891 | } |
| 1892 | - if($this->ColorFlag) { |
|
| 1893 | - $s='q '.$this->TextColor.' '.$s.' Q'; |
|
| 1892 | + if ($this->ColorFlag) { |
|
| 1893 | + $s = 'q '.$this->TextColor.' '.$s.' Q'; |
|
| 1894 | 1894 | } |
| 1895 | 1895 | $this->_out($s); |
| 1896 | 1896 | } |
@@ -1960,30 +1960,30 @@ discard block |
||
| 1960 | 1960 | * @since 1.0 |
| 1961 | 1961 | * @see SetFont(), SetDrawColor(), SetFillColor(), SetTextColor(), SetLineWidth(), AddLink(), Ln(), MultiCell(), Write(), SetAutoPageBreak() |
| 1962 | 1962 | */ |
| 1963 | - function Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=0, $link='') { |
|
| 1963 | + function Cell($w, $h = 0, $txt = '', $border = 0, $ln = 0, $align = '', $fill = 0, $link = '') { |
|
| 1964 | 1964 | //Output a cell |
| 1965 | - $k=$this->k; |
|
| 1966 | - if(($this->y + $h) > $this->PageBreakTrigger AND empty($this->InFooter) AND $this->AcceptPageBreak()) { |
|
| 1965 | + $k = $this->k; |
|
| 1966 | + if (($this->y + $h) > $this->PageBreakTrigger AND empty($this->InFooter) AND $this->AcceptPageBreak()) { |
|
| 1967 | 1967 | //Automatic page break |
| 1968 | 1968 | $x = $this->x; |
| 1969 | 1969 | $ws = $this->ws; |
| 1970 | - if($ws > 0) { |
|
| 1970 | + if ($ws > 0) { |
|
| 1971 | 1971 | $this->ws = 0; |
| 1972 | 1972 | $this->_out('0 Tw'); |
| 1973 | 1973 | } |
| 1974 | 1974 | $this->AddPage($this->CurOrientation); |
| 1975 | 1975 | $this->x = $x; |
| 1976 | - if($ws > 0) { |
|
| 1976 | + if ($ws > 0) { |
|
| 1977 | 1977 | $this->ws = $ws; |
| 1978 | - $this->_out(sprintf('%.3f Tw',$ws * $k)); |
|
| 1978 | + $this->_out(sprintf('%.3f Tw', $ws * $k)); |
|
| 1979 | 1979 | } |
| 1980 | 1980 | } |
| 1981 | - if($w == 0) { |
|
| 1981 | + if ($w == 0) { |
|
| 1982 | 1982 | $w = $this->w - $this->rMargin - $this->x; |
| 1983 | 1983 | } |
| 1984 | 1984 | $s = ''; |
| 1985 | - if(($fill == 1) OR ($border == 1)) { |
|
| 1986 | - if($fill == 1) { |
|
| 1985 | + if (($fill == 1) OR ($border == 1)) { |
|
| 1986 | + if ($fill == 1) { |
|
| 1987 | 1987 | $op = ($border == 1) ? 'B' : 'f'; |
| 1988 | 1988 | } |
| 1989 | 1989 | else { |
@@ -1991,56 +1991,56 @@ discard block |
||
| 1991 | 1991 | } |
| 1992 | 1992 | $s = sprintf('%.2f %.2f %.2f %.2f re %s ', $this->x * $k, ($this->h - $this->y) * $k, $w * $k, -$h * $k, $op); |
| 1993 | 1993 | } |
| 1994 | - if(is_string($border)) { |
|
| 1995 | - $x=$this->x; |
|
| 1996 | - $y=$this->y; |
|
| 1997 | - if(strpos($border,'L')!==false) { |
|
| 1998 | - $s.=sprintf('%.2f %.2f m %.2f %.2f l S ',$x*$k,($this->h-$y)*$k,$x*$k,($this->h-($y+$h))*$k); |
|
| 1994 | + if (is_string($border)) { |
|
| 1995 | + $x = $this->x; |
|
| 1996 | + $y = $this->y; |
|
| 1997 | + if (strpos($border, 'L') !== false) { |
|
| 1998 | + $s .= sprintf('%.2f %.2f m %.2f %.2f l S ', $x * $k, ($this->h - $y) * $k, $x * $k, ($this->h - ($y + $h)) * $k); |
|
| 1999 | 1999 | } |
| 2000 | - if(strpos($border,'T')!==false) { |
|
| 2001 | - $s.=sprintf('%.2f %.2f m %.2f %.2f l S ',$x*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-$y)*$k); |
|
| 2000 | + if (strpos($border, 'T') !== false) { |
|
| 2001 | + $s .= sprintf('%.2f %.2f m %.2f %.2f l S ', $x * $k, ($this->h - $y) * $k, ($x + $w) * $k, ($this->h - $y) * $k); |
|
| 2002 | 2002 | } |
| 2003 | - if(strpos($border,'R')!==false) { |
|
| 2004 | - $s.=sprintf('%.2f %.2f m %.2f %.2f l S ',($x+$w)*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-($y+$h))*$k); |
|
| 2003 | + if (strpos($border, 'R') !== false) { |
|
| 2004 | + $s .= sprintf('%.2f %.2f m %.2f %.2f l S ', ($x + $w) * $k, ($this->h - $y) * $k, ($x + $w) * $k, ($this->h - ($y + $h)) * $k); |
|
| 2005 | 2005 | } |
| 2006 | - if(strpos($border,'B')!==false) { |
|
| 2007 | - $s.=sprintf('%.2f %.2f m %.2f %.2f l S ',$x*$k,($this->h-($y+$h))*$k,($x+$w)*$k,($this->h-($y+$h))*$k); |
|
| 2006 | + if (strpos($border, 'B') !== false) { |
|
| 2007 | + $s .= sprintf('%.2f %.2f m %.2f %.2f l S ', $x * $k, ($this->h - ($y + $h)) * $k, ($x + $w) * $k, ($this->h - ($y + $h)) * $k); |
|
| 2008 | 2008 | } |
| 2009 | 2009 | } |
| 2010 | - if($txt != '') { |
|
| 2010 | + if ($txt != '') { |
|
| 2011 | 2011 | $width = $this->GetStringWidth($txt); |
| 2012 | - if($align == 'R') { |
|
| 2012 | + if ($align == 'R') { |
|
| 2013 | 2013 | $dx = $w - $this->cMargin - $width; |
| 2014 | 2014 | } |
| 2015 | - elseif($align=='C') { |
|
| 2016 | - $dx = ($w - $width)/2; |
|
| 2015 | + elseif ($align == 'C') { |
|
| 2016 | + $dx = ($w - $width) / 2; |
|
| 2017 | 2017 | } |
| 2018 | 2018 | else { |
| 2019 | 2019 | $dx = $this->cMargin; |
| 2020 | 2020 | } |
| 2021 | - if($this->ColorFlag) { |
|
| 2021 | + if ($this->ColorFlag) { |
|
| 2022 | 2022 | $s .= 'q '.$this->TextColor.' '; |
| 2023 | 2023 | } |
| 2024 | 2024 | $txt2 = $this->_escapetext($txt); |
| 2025 | - $s.=sprintf('BT %.2f %.2f Td (%s) Tj ET', ($this->x + $dx) * $k, ($this->h - ($this->y + 0.5 * $h + 0.3 * $this->FontSize)) * $k, $txt2); |
|
| 2026 | - if($this->underline) { |
|
| 2027 | - $s.=' '.$this->_dounderline($this->x + $dx, $this->y + 0.5 * $h + 0.3 * $this->FontSize, $txt); |
|
| 2025 | + $s .= sprintf('BT %.2f %.2f Td (%s) Tj ET', ($this->x + $dx) * $k, ($this->h - ($this->y + 0.5 * $h + 0.3 * $this->FontSize)) * $k, $txt2); |
|
| 2026 | + if ($this->underline) { |
|
| 2027 | + $s .= ' '.$this->_dounderline($this->x + $dx, $this->y + 0.5 * $h + 0.3 * $this->FontSize, $txt); |
|
| 2028 | 2028 | } |
| 2029 | - if($this->ColorFlag) { |
|
| 2030 | - $s.=' Q'; |
|
| 2029 | + if ($this->ColorFlag) { |
|
| 2030 | + $s .= ' Q'; |
|
| 2031 | 2031 | } |
| 2032 | - if($link) { |
|
| 2032 | + if ($link) { |
|
| 2033 | 2033 | $this->Link($this->x + $dx, $this->y + 0.5 * $h - 0.5 * $this->FontSize, $width, $this->FontSize, $link); |
| 2034 | 2034 | } |
| 2035 | 2035 | } |
| 2036 | - if($s) { |
|
| 2036 | + if ($s) { |
|
| 2037 | 2037 | $this->_out($s); |
| 2038 | 2038 | } |
| 2039 | 2039 | $this->lasth = $h; |
| 2040 | - if($ln>0) { |
|
| 2040 | + if ($ln > 0) { |
|
| 2041 | 2041 | //Go to next line |
| 2042 | 2042 | $this->y += $h; |
| 2043 | - if($ln == 1) { |
|
| 2043 | + if ($ln == 1) { |
|
| 2044 | 2044 | $this->x = $this->lMargin; |
| 2045 | 2045 | } |
| 2046 | 2046 | } |
@@ -2062,7 +2062,7 @@ discard block |
||
| 2062 | 2062 | * @since 1.3 |
| 2063 | 2063 | * @see SetFont(), SetDrawColor(), SetFillColor(), SetTextColor(), SetLineWidth(), Cell(), Write(), SetAutoPageBreak() |
| 2064 | 2064 | */ |
| 2065 | - function MultiCell($w, $h, $txt, $border=0, $align='J', $fill=0, $ln=1) { |
|
| 2065 | + function MultiCell($w, $h, $txt, $border = 0, $align = 'J', $fill = 0, $ln = 1) { |
|
| 2066 | 2066 | |
| 2067 | 2067 | // save current position |
| 2068 | 2068 | $prevx = $this->x; |
@@ -2071,7 +2071,7 @@ discard block |
||
| 2071 | 2071 | //Output text with automatic or explicit line breaks |
| 2072 | 2072 | $cw = &$this->CurrentFont['cw']; |
| 2073 | 2073 | |
| 2074 | - if($w == 0) { |
|
| 2074 | + if ($w == 0) { |
|
| 2075 | 2075 | $w = $this->w - $this->rMargin - $this->x; |
| 2076 | 2076 | } |
| 2077 | 2077 | |
@@ -2080,86 +2080,86 @@ discard block |
||
| 2080 | 2080 | $s = str_replace("\r", '', $txt); // remove carriage returns |
| 2081 | 2081 | $nb = strlen($s); |
| 2082 | 2082 | |
| 2083 | - $b=0; |
|
| 2084 | - if($border) { |
|
| 2085 | - if($border==1) { |
|
| 2086 | - $border='LTRB'; |
|
| 2087 | - $b='LRT'; |
|
| 2088 | - $b2='LR'; |
|
| 2083 | + $b = 0; |
|
| 2084 | + if ($border) { |
|
| 2085 | + if ($border == 1) { |
|
| 2086 | + $border = 'LTRB'; |
|
| 2087 | + $b = 'LRT'; |
|
| 2088 | + $b2 = 'LR'; |
|
| 2089 | 2089 | } |
| 2090 | 2090 | else { |
| 2091 | - $b2=''; |
|
| 2092 | - if(strpos($border,'L')!==false) { |
|
| 2093 | - $b2.='L'; |
|
| 2091 | + $b2 = ''; |
|
| 2092 | + if (strpos($border, 'L') !== false) { |
|
| 2093 | + $b2 .= 'L'; |
|
| 2094 | 2094 | } |
| 2095 | - if(strpos($border,'R')!==false) { |
|
| 2096 | - $b2.='R'; |
|
| 2095 | + if (strpos($border, 'R') !== false) { |
|
| 2096 | + $b2 .= 'R'; |
|
| 2097 | 2097 | } |
| 2098 | - $b=(strpos($border,'T')!==false) ? $b2.'T' : $b2; |
|
| 2098 | + $b = (strpos($border, 'T') !== false) ? $b2.'T' : $b2; |
|
| 2099 | 2099 | } |
| 2100 | 2100 | } |
| 2101 | - $sep=-1; |
|
| 2102 | - $i=0; |
|
| 2103 | - $j=0; |
|
| 2104 | - $l=0; |
|
| 2105 | - $ns=0; |
|
| 2106 | - $nl=1; |
|
| 2107 | - while($i<$nb) { |
|
| 2101 | + $sep = -1; |
|
| 2102 | + $i = 0; |
|
| 2103 | + $j = 0; |
|
| 2104 | + $l = 0; |
|
| 2105 | + $ns = 0; |
|
| 2106 | + $nl = 1; |
|
| 2107 | + while ($i < $nb) { |
|
| 2108 | 2108 | //Get next character |
| 2109 | 2109 | $c = $s{$i}; |
| 2110 | - if(preg_match("/[\n]/u", $c)) { |
|
| 2110 | + if (preg_match("/[\n]/u", $c)) { |
|
| 2111 | 2111 | //Explicit line break |
| 2112 | - if($this->ws > 0) { |
|
| 2112 | + if ($this->ws > 0) { |
|
| 2113 | 2113 | $this->ws = 0; |
| 2114 | 2114 | $this->_out('0 Tw'); |
| 2115 | 2115 | } |
| 2116 | - $this->Cell($w, $h, substr($s, $j, $i-$j), $b, 2, $align, $fill); |
|
| 2116 | + $this->Cell($w, $h, substr($s, $j, $i - $j), $b, 2, $align, $fill); |
|
| 2117 | 2117 | $i++; |
| 2118 | - $sep=-1; |
|
| 2119 | - $j=$i; |
|
| 2120 | - $l=0; |
|
| 2121 | - $ns=0; |
|
| 2118 | + $sep = -1; |
|
| 2119 | + $j = $i; |
|
| 2120 | + $l = 0; |
|
| 2121 | + $ns = 0; |
|
| 2122 | 2122 | $nl++; |
| 2123 | - if($border and $nl==2) { |
|
| 2123 | + if ($border and $nl == 2) { |
|
| 2124 | 2124 | $b = $b2; |
| 2125 | 2125 | } |
| 2126 | 2126 | continue; |
| 2127 | 2127 | } |
| 2128 | - if(preg_match("/[ ]/u", $c)) { |
|
| 2128 | + if (preg_match("/[ ]/u", $c)) { |
|
| 2129 | 2129 | $sep = $i; |
| 2130 | 2130 | $ls = $l; |
| 2131 | 2131 | $ns++; |
| 2132 | 2132 | } |
| 2133 | 2133 | |
| 2134 | - $l = $this->GetStringWidth(substr($s, $j, $i-$j)); |
|
| 2134 | + $l = $this->GetStringWidth(substr($s, $j, $i - $j)); |
|
| 2135 | 2135 | |
| 2136 | - if($l > $wmax) { |
|
| 2136 | + if ($l > $wmax) { |
|
| 2137 | 2137 | //Automatic line break |
| 2138 | - if($sep == -1) { |
|
| 2139 | - if($i == $j) { |
|
| 2138 | + if ($sep == -1) { |
|
| 2139 | + if ($i == $j) { |
|
| 2140 | 2140 | $i++; |
| 2141 | 2141 | } |
| 2142 | - if($this->ws > 0) { |
|
| 2142 | + if ($this->ws > 0) { |
|
| 2143 | 2143 | $this->ws = 0; |
| 2144 | 2144 | $this->_out('0 Tw'); |
| 2145 | 2145 | } |
| 2146 | - $this->Cell($w, $h, substr($s, $j, $i-$j), $b, 2, $align, $fill); |
|
| 2146 | + $this->Cell($w, $h, substr($s, $j, $i - $j), $b, 2, $align, $fill); |
|
| 2147 | 2147 | } |
| 2148 | 2148 | else { |
| 2149 | - if($align=='J') { |
|
| 2150 | - $this->ws = ($ns>1) ? ($wmax-$ls)/($ns-1) : 0; |
|
| 2149 | + if ($align == 'J') { |
|
| 2150 | + $this->ws = ($ns > 1) ? ($wmax - $ls) / ($ns - 1) : 0; |
|
| 2151 | 2151 | $this->_out(sprintf('%.3f Tw', $this->ws * $this->k)); |
| 2152 | 2152 | } |
| 2153 | - $this->Cell($w, $h, substr($s, $j, $sep-$j), $b, 2, $align, $fill); |
|
| 2153 | + $this->Cell($w, $h, substr($s, $j, $sep - $j), $b, 2, $align, $fill); |
|
| 2154 | 2154 | $i = $sep + 1; |
| 2155 | 2155 | } |
| 2156 | - $sep=-1; |
|
| 2157 | - $j=$i; |
|
| 2158 | - $l=0; |
|
| 2159 | - $ns=0; |
|
| 2156 | + $sep = -1; |
|
| 2157 | + $j = $i; |
|
| 2158 | + $l = 0; |
|
| 2159 | + $ns = 0; |
|
| 2160 | 2160 | $nl++; |
| 2161 | - if($border AND ($nl==2)) { |
|
| 2162 | - $b=$b2; |
|
| 2161 | + if ($border AND ($nl == 2)) { |
|
| 2162 | + $b = $b2; |
|
| 2163 | 2163 | } |
| 2164 | 2164 | } |
| 2165 | 2165 | else { |
@@ -2167,25 +2167,25 @@ discard block |
||
| 2167 | 2167 | } |
| 2168 | 2168 | } |
| 2169 | 2169 | //Last chunk |
| 2170 | - if($this->ws>0) { |
|
| 2171 | - $this->ws=0; |
|
| 2170 | + if ($this->ws > 0) { |
|
| 2171 | + $this->ws = 0; |
|
| 2172 | 2172 | $this->_out('0 Tw'); |
| 2173 | 2173 | } |
| 2174 | - if($border and is_int(strpos($border,'B'))) { |
|
| 2175 | - $b.='B'; |
|
| 2174 | + if ($border and is_int(strpos($border, 'B'))) { |
|
| 2175 | + $b .= 'B'; |
|
| 2176 | 2176 | } |
| 2177 | - $this->Cell($w, $h, substr($s, $j, $i-$j), $b, 2, $align, $fill); |
|
| 2177 | + $this->Cell($w, $h, substr($s, $j, $i - $j), $b, 2, $align, $fill); |
|
| 2178 | 2178 | |
| 2179 | 2179 | // move cursor to specified position |
| 2180 | 2180 | // since: 2007-03-03 |
| 2181 | - if($ln == 1) { |
|
| 2181 | + if ($ln == 1) { |
|
| 2182 | 2182 | // go to the beginning of the next line |
| 2183 | 2183 | $this->x = $this->lMargin; |
| 2184 | - } elseif($ln == 0) { |
|
| 2184 | + } elseif ($ln == 0) { |
|
| 2185 | 2185 | // go to the top-right of the cell |
| 2186 | 2186 | $this->y = $prevy; |
| 2187 | 2187 | $this->x = $prevx + $w; |
| 2188 | - } elseif($ln == 2) { |
|
| 2188 | + } elseif ($ln == 2) { |
|
| 2189 | 2189 | // go to the bottom-left of the cell |
| 2190 | 2190 | $this->x = $prevx; |
| 2191 | 2191 | } |
@@ -2210,7 +2210,7 @@ discard block |
||
| 2210 | 2210 | * @since 1.5 |
| 2211 | 2211 | * @see SetFont(), SetTextColor(), AddLink(), MultiCell(), SetAutoPageBreak() |
| 2212 | 2212 | */ |
| 2213 | - function Write($h, $txt, $link='', $fill=0) { |
|
| 2213 | + function Write($h, $txt, $link = '', $fill = 0) { |
|
| 2214 | 2214 | |
| 2215 | 2215 | //Output text in flowing mode |
| 2216 | 2216 | $cw = &$this->CurrentFont['cw']; |
@@ -2221,27 +2221,27 @@ discard block |
||
| 2221 | 2221 | $nb = strlen($s); |
| 2222 | 2222 | |
| 2223 | 2223 | // handle single space character |
| 2224 | - if(($nb==1) AND preg_match("/[ ]/u", $s)) { |
|
| 2224 | + if (($nb == 1) AND preg_match("/[ ]/u", $s)) { |
|
| 2225 | 2225 | $this->x += $this->GetStringWidth($s); |
| 2226 | 2226 | return; |
| 2227 | 2227 | } |
| 2228 | 2228 | |
| 2229 | - $sep=-1; |
|
| 2230 | - $i=0; |
|
| 2231 | - $j=0; |
|
| 2232 | - $l=0; |
|
| 2233 | - $nl=1; |
|
| 2234 | - while($i<$nb) { |
|
| 2229 | + $sep = -1; |
|
| 2230 | + $i = 0; |
|
| 2231 | + $j = 0; |
|
| 2232 | + $l = 0; |
|
| 2233 | + $nl = 1; |
|
| 2234 | + while ($i < $nb) { |
|
| 2235 | 2235 | //Get next character |
| 2236 | - $c=$s{$i}; |
|
| 2237 | - if(preg_match("/[\n]/u", $c)) { |
|
| 2236 | + $c = $s{$i}; |
|
| 2237 | + if (preg_match("/[\n]/u", $c)) { |
|
| 2238 | 2238 | //Explicit line break |
| 2239 | - $this->Cell($w, $h, substr($s, $j, $i-$j), 0, 2, '', $fill, $link); |
|
| 2239 | + $this->Cell($w, $h, substr($s, $j, $i - $j), 0, 2, '', $fill, $link); |
|
| 2240 | 2240 | $i++; |
| 2241 | 2241 | $sep = -1; |
| 2242 | 2242 | $j = $i; |
| 2243 | 2243 | $l = 0; |
| 2244 | - if($nl == 1) { |
|
| 2244 | + if ($nl == 1) { |
|
| 2245 | 2245 | $this->x = $this->lMargin; |
| 2246 | 2246 | $w = $this->w - $this->rMargin - $this->x; |
| 2247 | 2247 | $wmax = ($w - 2 * $this->cMargin); |
@@ -2249,38 +2249,38 @@ discard block |
||
| 2249 | 2249 | $nl++; |
| 2250 | 2250 | continue; |
| 2251 | 2251 | } |
| 2252 | - if(preg_match("/[ ]/u", $c)) { |
|
| 2253 | - $sep= $i; |
|
| 2252 | + if (preg_match("/[ ]/u", $c)) { |
|
| 2253 | + $sep = $i; |
|
| 2254 | 2254 | } |
| 2255 | 2255 | |
| 2256 | - $l = $this->GetStringWidth(substr($s, $j, $i-$j)); |
|
| 2256 | + $l = $this->GetStringWidth(substr($s, $j, $i - $j)); |
|
| 2257 | 2257 | |
| 2258 | - if($l > $wmax) { |
|
| 2258 | + if ($l > $wmax) { |
|
| 2259 | 2259 | //Automatic line break (word wrapping) |
| 2260 | - if($sep == -1) { |
|
| 2261 | - if($this->x > $this->lMargin) { |
|
| 2260 | + if ($sep == -1) { |
|
| 2261 | + if ($this->x > $this->lMargin) { |
|
| 2262 | 2262 | //Move to next line |
| 2263 | 2263 | $this->x = $this->lMargin; |
| 2264 | 2264 | $this->y += $h; |
| 2265 | - $w=$this->w - $this->rMargin - $this->x; |
|
| 2266 | - $wmax=($w - 2 * $this->cMargin); |
|
| 2265 | + $w = $this->w - $this->rMargin - $this->x; |
|
| 2266 | + $wmax = ($w - 2 * $this->cMargin); |
|
| 2267 | 2267 | $i++; |
| 2268 | 2268 | $nl++; |
| 2269 | 2269 | continue; |
| 2270 | 2270 | } |
| 2271 | - if($i==$j) { |
|
| 2271 | + if ($i == $j) { |
|
| 2272 | 2272 | $i++; |
| 2273 | 2273 | } |
| 2274 | - $this->Cell($w, $h, substr($s, $j, $i-$j), 0, 2, '', $fill, $link); |
|
| 2274 | + $this->Cell($w, $h, substr($s, $j, $i - $j), 0, 2, '', $fill, $link); |
|
| 2275 | 2275 | } |
| 2276 | 2276 | else { |
| 2277 | - $this->Cell($w, $h, substr($s, $j, $sep-$j), 0, 2, '', $fill, $link); |
|
| 2278 | - $i=$sep+1; |
|
| 2277 | + $this->Cell($w, $h, substr($s, $j, $sep - $j), 0, 2, '', $fill, $link); |
|
| 2278 | + $i = $sep + 1; |
|
| 2279 | 2279 | } |
| 2280 | 2280 | $sep = -1; |
| 2281 | 2281 | $j = $i; |
| 2282 | 2282 | $l = 0; |
| 2283 | - if($nl==1) { |
|
| 2283 | + if ($nl == 1) { |
|
| 2284 | 2284 | $this->x = $this->lMargin; |
| 2285 | 2285 | $w = $this->w - $this->rMargin - $this->x; |
| 2286 | 2286 | $wmax = ($w - 2 * $this->cMargin); |
@@ -2293,7 +2293,7 @@ discard block |
||
| 2293 | 2293 | } |
| 2294 | 2294 | |
| 2295 | 2295 | //Last chunk |
| 2296 | - if($i!=$j) { |
|
| 2296 | + if ($i != $j) { |
|
| 2297 | 2297 | $this->Cell($this->GetStringWidth(substr($s, $j)), $h, substr($s, $j), 0, 0, '', $fill, $link); |
| 2298 | 2298 | } |
| 2299 | 2299 | } |
@@ -2318,56 +2318,56 @@ discard block |
||
| 2318 | 2318 | * @since 1.1 |
| 2319 | 2319 | * @see AddLink() |
| 2320 | 2320 | */ |
| 2321 | - function Image($file, $x, $y, $w=0, $h=0, $type='', $link='') { |
|
| 2321 | + function Image($file, $x, $y, $w = 0, $h = 0, $type = '', $link = '') { |
|
| 2322 | 2322 | //Put an image on the page |
| 2323 | - if(!isset($this->images[$file])) { |
|
| 2323 | + if (!isset($this->images[$file])) { |
|
| 2324 | 2324 | //First use of image, get info |
| 2325 | - if($type == '') { |
|
| 2326 | - $pos = strrpos($file,'.'); |
|
| 2327 | - if(empty($pos)) { |
|
| 2325 | + if ($type == '') { |
|
| 2326 | + $pos = strrpos($file, '.'); |
|
| 2327 | + if (empty($pos)) { |
|
| 2328 | 2328 | $this->Error('Image file has no extension and no type was specified: '.$file); |
| 2329 | 2329 | } |
| 2330 | - $type = substr($file, $pos+1); |
|
| 2330 | + $type = substr($file, $pos + 1); |
|
| 2331 | 2331 | } |
| 2332 | 2332 | $type = strtolower($type); |
| 2333 | 2333 | $mqr = get_magic_quotes_runtime(); |
| 2334 | 2334 | set_magic_quotes_runtime(0); |
| 2335 | - if($type == 'jpg' or $type == 'jpeg') { |
|
| 2336 | - $info=$this->_parsejpg($file); |
|
| 2335 | + if ($type == 'jpg' or $type == 'jpeg') { |
|
| 2336 | + $info = $this->_parsejpg($file); |
|
| 2337 | 2337 | } |
| 2338 | - elseif($type == 'png') { |
|
| 2339 | - $info=$this->_parsepng($file); |
|
| 2338 | + elseif ($type == 'png') { |
|
| 2339 | + $info = $this->_parsepng($file); |
|
| 2340 | 2340 | } |
| 2341 | 2341 | else { |
| 2342 | 2342 | //Allow for additional formats |
| 2343 | - $mtd='_parse'.$type; |
|
| 2344 | - if(!method_exists($this,$mtd)) { |
|
| 2343 | + $mtd = '_parse'.$type; |
|
| 2344 | + if (!method_exists($this, $mtd)) { |
|
| 2345 | 2345 | $this->Error('Unsupported image type: '.$type); |
| 2346 | 2346 | } |
| 2347 | - $info=$this->$mtd($file); |
|
| 2347 | + $info = $this->$mtd($file); |
|
| 2348 | 2348 | } |
| 2349 | 2349 | set_magic_quotes_runtime($mqr); |
| 2350 | - $info['i']=count($this->images)+1; |
|
| 2351 | - $this->images[$file]=$info; |
|
| 2350 | + $info['i'] = count($this->images) + 1; |
|
| 2351 | + $this->images[$file] = $info; |
|
| 2352 | 2352 | } |
| 2353 | 2353 | else { |
| 2354 | - $info=$this->images[$file]; |
|
| 2354 | + $info = $this->images[$file]; |
|
| 2355 | 2355 | } |
| 2356 | 2356 | //Automatic width and height calculation if needed |
| 2357 | - if(($w == 0) and ($h == 0)) { |
|
| 2357 | + if (($w == 0) and ($h == 0)) { |
|
| 2358 | 2358 | //Put image at 72 dpi |
| 2359 | 2359 | // 2004-06-14 :: Nicola Asuni, scale factor where added |
| 2360 | 2360 | $w = $info['w'] / ($this->imgscale * $this->k); |
| 2361 | 2361 | $h = $info['h'] / ($this->imgscale * $this->k); |
| 2362 | 2362 | } |
| 2363 | - if($w == 0) { |
|
| 2363 | + if ($w == 0) { |
|
| 2364 | 2364 | $w = $h * $info['w'] / $info['h']; |
| 2365 | 2365 | } |
| 2366 | - if($h == 0) { |
|
| 2366 | + if ($h == 0) { |
|
| 2367 | 2367 | $h = $w * $info['h'] / $info['w']; |
| 2368 | 2368 | } |
| 2369 | - $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'])); |
|
| 2370 | - if($link) { |
|
| 2369 | + $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'])); |
|
| 2370 | + if ($link) { |
|
| 2371 | 2371 | $this->Link($x, $y, $w, $h, $link); |
| 2372 | 2372 | } |
| 2373 | 2373 | |
@@ -2383,14 +2383,14 @@ discard block |
||
| 2383 | 2383 | * @since 1.0 |
| 2384 | 2384 | * @see Cell() |
| 2385 | 2385 | */ |
| 2386 | - function Ln($h='') { |
|
| 2386 | + function Ln($h = '') { |
|
| 2387 | 2387 | //Line feed; default value is last cell height |
| 2388 | - $this->x=$this->lMargin; |
|
| 2389 | - if(is_string($h)) { |
|
| 2390 | - $this->y+=$this->lasth; |
|
| 2388 | + $this->x = $this->lMargin; |
|
| 2389 | + if (is_string($h)) { |
|
| 2390 | + $this->y += $this->lasth; |
|
| 2391 | 2391 | } |
| 2392 | 2392 | else { |
| 2393 | - $this->y+=$h; |
|
| 2393 | + $this->y += $h; |
|
| 2394 | 2394 | } |
| 2395 | 2395 | } |
| 2396 | 2396 | |
@@ -2413,11 +2413,11 @@ discard block |
||
| 2413 | 2413 | */ |
| 2414 | 2414 | function SetX($x) { |
| 2415 | 2415 | //Set x position |
| 2416 | - if($x>=0) { |
|
| 2417 | - $this->x=$x; |
|
| 2416 | + if ($x >= 0) { |
|
| 2417 | + $this->x = $x; |
|
| 2418 | 2418 | } |
| 2419 | 2419 | else { |
| 2420 | - $this->x=$this->w+$x; |
|
| 2420 | + $this->x = $this->w + $x; |
|
| 2421 | 2421 | } |
| 2422 | 2422 | } |
| 2423 | 2423 | |
@@ -2440,12 +2440,12 @@ discard block |
||
| 2440 | 2440 | */ |
| 2441 | 2441 | function SetY($y) { |
| 2442 | 2442 | //Set y position and reset x |
| 2443 | - $this->x=$this->lMargin; |
|
| 2444 | - if($y>=0) { |
|
| 2445 | - $this->y=$y; |
|
| 2443 | + $this->x = $this->lMargin; |
|
| 2444 | + if ($y >= 0) { |
|
| 2445 | + $this->y = $y; |
|
| 2446 | 2446 | } |
| 2447 | 2447 | else { |
| 2448 | - $this->y=$this->h+$y; |
|
| 2448 | + $this->y = $this->h + $y; |
|
| 2449 | 2449 | } |
| 2450 | 2450 | } |
| 2451 | 2451 | |
@@ -2470,35 +2470,35 @@ discard block |
||
| 2470 | 2470 | * @since 1.0 |
| 2471 | 2471 | * @see Close() |
| 2472 | 2472 | */ |
| 2473 | - function Output($name='',$dest='') { |
|
| 2473 | + function Output($name = '', $dest = '') { |
|
| 2474 | 2474 | //Output PDF to some destination |
| 2475 | 2475 | //Finish document if necessary |
| 2476 | - if($this->state < 3) { |
|
| 2476 | + if ($this->state < 3) { |
|
| 2477 | 2477 | $this->Close(); |
| 2478 | 2478 | } |
| 2479 | 2479 | //Normalize parameters |
| 2480 | - if(is_bool($dest)) { |
|
| 2481 | - $dest=$dest ? 'D' : 'F'; |
|
| 2482 | - } |
|
| 2483 | - $dest=strtoupper($dest); |
|
| 2484 | - if($dest=='') { |
|
| 2485 | - if($name=='') { |
|
| 2486 | - $name='doc.pdf'; |
|
| 2487 | - $dest='I'; |
|
| 2480 | + if (is_bool($dest)) { |
|
| 2481 | + $dest = $dest ? 'D' : 'F'; |
|
| 2482 | + } |
|
| 2483 | + $dest = strtoupper($dest); |
|
| 2484 | + if ($dest == '') { |
|
| 2485 | + if ($name == '') { |
|
| 2486 | + $name = 'doc.pdf'; |
|
| 2487 | + $dest = 'I'; |
|
| 2488 | 2488 | } else { |
| 2489 | - $dest='F'; |
|
| 2489 | + $dest = 'F'; |
|
| 2490 | 2490 | } |
| 2491 | 2491 | } |
| 2492 | - switch($dest) { |
|
| 2492 | + switch ($dest) { |
|
| 2493 | 2493 | case 'I': { |
| 2494 | 2494 | //Send to standard output |
| 2495 | - if(ob_get_contents()) { |
|
| 2495 | + if (ob_get_contents()) { |
|
| 2496 | 2496 | $this->Error('Some data has already been output, can\'t send PDF file'); |
| 2497 | 2497 | } |
| 2498 | - if(php_sapi_name()!='cli') { |
|
| 2498 | + if (php_sapi_name() != 'cli') { |
|
| 2499 | 2499 | //We send to a browser |
| 2500 | 2500 | header('Content-Type: application/pdf'); |
| 2501 | - if(headers_sent()) { |
|
| 2501 | + if (headers_sent()) { |
|
| 2502 | 2502 | $this->Error('Some data has already been output to browser, can\'t send PDF file'); |
| 2503 | 2503 | } |
| 2504 | 2504 | header('Content-Length: '.strlen($this->buffer)); |
@@ -2509,15 +2509,15 @@ discard block |
||
| 2509 | 2509 | } |
| 2510 | 2510 | case 'D': { |
| 2511 | 2511 | //Download file |
| 2512 | - if(ob_get_contents()) { |
|
| 2512 | + if (ob_get_contents()) { |
|
| 2513 | 2513 | $this->Error('Some data has already been output, can\'t send PDF file'); |
| 2514 | 2514 | } |
| 2515 | - if(isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'],'MSIE')) { |
|
| 2515 | + if (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) { |
|
| 2516 | 2516 | header('Content-Type: application/force-download'); |
| 2517 | 2517 | } else { |
| 2518 | 2518 | header('Content-Type: application/octet-stream'); |
| 2519 | 2519 | } |
| 2520 | - if(headers_sent()) { |
|
| 2520 | + if (headers_sent()) { |
|
| 2521 | 2521 | $this->Error('Some data has already been output to browser, can\'t send PDF file'); |
| 2522 | 2522 | } |
| 2523 | 2523 | header('Content-Length: '.strlen($this->buffer)); |
@@ -2527,11 +2527,11 @@ discard block |
||
| 2527 | 2527 | } |
| 2528 | 2528 | case 'F': { |
| 2529 | 2529 | //Save to local file |
| 2530 | - $f=fopen($name,'wb'); |
|
| 2531 | - if(!$f) { |
|
| 2530 | + $f = fopen($name, 'wb'); |
|
| 2531 | + if (!$f) { |
|
| 2532 | 2532 | $this->Error('Unable to create output file: '.$name); |
| 2533 | 2533 | } |
| 2534 | - fwrite($f,$this->buffer,strlen($this->buffer)); |
|
| 2534 | + fwrite($f, $this->buffer, strlen($this->buffer)); |
|
| 2535 | 2535 | fclose($f); |
| 2536 | 2536 | break; |
| 2537 | 2537 | } |
@@ -2554,12 +2554,12 @@ discard block |
||
| 2554 | 2554 | */ |
| 2555 | 2555 | function _dochecks() { |
| 2556 | 2556 | //Check for locale-related bug |
| 2557 | - if(1.1==1) { |
|
| 2557 | + if (1.1 == 1) { |
|
| 2558 | 2558 | $this->Error('Don\'t alter the locale before including class file'); |
| 2559 | 2559 | } |
| 2560 | 2560 | //Check for decimal separator |
| 2561 | - if(sprintf('%.1f',1.0)!='1.0') { |
|
| 2562 | - setlocale(LC_NUMERIC,'C'); |
|
| 2561 | + if (sprintf('%.1f', 1.0) != '1.0') { |
|
| 2562 | + setlocale(LC_NUMERIC, 'C'); |
|
| 2563 | 2563 | } |
| 2564 | 2564 | } |
| 2565 | 2565 | |
@@ -2568,7 +2568,7 @@ discard block |
||
| 2568 | 2568 | * @access protected |
| 2569 | 2569 | */ |
| 2570 | 2570 | function _getfontpath() { |
| 2571 | - if(!defined('FPDF_FONTPATH') AND is_dir(dirname(__FILE__).'/font')) { |
|
| 2571 | + if (!defined('FPDF_FONTPATH') AND is_dir(dirname(__FILE__).'/font')) { |
|
| 2572 | 2572 | define('FPDF_FONTPATH', dirname(__FILE__).'/font/'); |
| 2573 | 2573 | } |
| 2574 | 2574 | return defined('FPDF_FONTPATH') ? FPDF_FONTPATH : ''; |
@@ -2580,7 +2580,7 @@ discard block |
||
| 2580 | 2580 | */ |
| 2581 | 2581 | function _begindoc() { |
| 2582 | 2582 | //Start document |
| 2583 | - $this->state=1; |
|
| 2583 | + $this->state = 1; |
|
| 2584 | 2584 | $this->_out('%PDF-1.3'); |
| 2585 | 2585 | } |
| 2586 | 2586 | |
@@ -2590,68 +2590,68 @@ discard block |
||
| 2590 | 2590 | */ |
| 2591 | 2591 | function _putpages() { |
| 2592 | 2592 | $nb = $this->page; |
| 2593 | - if(!empty($this->AliasNbPages)) { |
|
| 2593 | + if (!empty($this->AliasNbPages)) { |
|
| 2594 | 2594 | $nbstr = $this->UTF8ToUTF16BE($nb, false); |
| 2595 | 2595 | //Replace number of pages |
| 2596 | - for($n=1;$n<=$nb;$n++) { |
|
| 2597 | - $this->pages[$n]=str_replace($this->AliasNbPages, $nbstr, $this->pages[$n]); |
|
| 2596 | + for ($n = 1; $n <= $nb; $n++) { |
|
| 2597 | + $this->pages[$n] = str_replace($this->AliasNbPages, $nbstr, $this->pages[$n]); |
|
| 2598 | 2598 | } |
| 2599 | 2599 | } |
| 2600 | - if($this->DefOrientation=='P') { |
|
| 2601 | - $wPt=$this->fwPt; |
|
| 2602 | - $hPt=$this->fhPt; |
|
| 2600 | + if ($this->DefOrientation == 'P') { |
|
| 2601 | + $wPt = $this->fwPt; |
|
| 2602 | + $hPt = $this->fhPt; |
|
| 2603 | 2603 | } |
| 2604 | 2604 | else { |
| 2605 | - $wPt=$this->fhPt; |
|
| 2606 | - $hPt=$this->fwPt; |
|
| 2605 | + $wPt = $this->fhPt; |
|
| 2606 | + $hPt = $this->fwPt; |
|
| 2607 | 2607 | } |
| 2608 | - $filter=($this->compress) ? '/Filter /FlateDecode ' : ''; |
|
| 2609 | - for($n=1;$n<=$nb;$n++) { |
|
| 2608 | + $filter = ($this->compress) ? '/Filter /FlateDecode ' : ''; |
|
| 2609 | + for ($n = 1; $n <= $nb; $n++) { |
|
| 2610 | 2610 | //Page |
| 2611 | 2611 | $this->_newobj(); |
| 2612 | 2612 | $this->_out('<</Type /Page'); |
| 2613 | 2613 | $this->_out('/Parent 1 0 R'); |
| 2614 | - if(isset($this->OrientationChanges[$n])) { |
|
| 2615 | - $this->_out(sprintf('/MediaBox [0 0 %.2f %.2f]',$hPt,$wPt)); |
|
| 2614 | + if (isset($this->OrientationChanges[$n])) { |
|
| 2615 | + $this->_out(sprintf('/MediaBox [0 0 %.2f %.2f]', $hPt, $wPt)); |
|
| 2616 | 2616 | } |
| 2617 | 2617 | $this->_out('/Resources 2 0 R'); |
| 2618 | - if(isset($this->PageLinks[$n])) { |
|
| 2618 | + if (isset($this->PageLinks[$n])) { |
|
| 2619 | 2619 | //Links |
| 2620 | - $annots='/Annots ['; |
|
| 2621 | - foreach($this->PageLinks[$n] as $pl) { |
|
| 2622 | - $rect=sprintf('%.2f %.2f %.2f %.2f',$pl[0],$pl[1],$pl[0]+$pl[2],$pl[1]-$pl[3]); |
|
| 2623 | - $annots.='<</Type /Annot /Subtype /Link /Rect ['.$rect.'] /Border [0 0 0] '; |
|
| 2624 | - if(is_string($pl[4])) { |
|
| 2625 | - $annots.='/A <</S /URI /URI ('.$this->_escape($pl[4]).')>>>>'; |
|
| 2620 | + $annots = '/Annots ['; |
|
| 2621 | + foreach ($this->PageLinks[$n] as $pl) { |
|
| 2622 | + $rect = sprintf('%.2f %.2f %.2f %.2f', $pl[0], $pl[1], $pl[0] + $pl[2], $pl[1] - $pl[3]); |
|
| 2623 | + $annots .= '<</Type /Annot /Subtype /Link /Rect ['.$rect.'] /Border [0 0 0] '; |
|
| 2624 | + if (is_string($pl[4])) { |
|
| 2625 | + $annots .= '/A <</S /URI /URI ('.$this->_escape($pl[4]).')>>>>'; |
|
| 2626 | 2626 | } |
| 2627 | 2627 | else { |
| 2628 | - $l=$this->links[$pl[4]]; |
|
| 2629 | - $h=isset($this->OrientationChanges[$l[0]]) ? $wPt : $hPt; |
|
| 2630 | - $annots.=sprintf('/Dest [%d 0 R /XYZ 0 %.2f null]>>',1+2*$l[0],$h-$l[1]*$this->k); |
|
| 2628 | + $l = $this->links[$pl[4]]; |
|
| 2629 | + $h = isset($this->OrientationChanges[$l[0]]) ? $wPt : $hPt; |
|
| 2630 | + $annots .= sprintf('/Dest [%d 0 R /XYZ 0 %.2f null]>>', 1 + 2 * $l[0], $h - $l[1] * $this->k); |
|
| 2631 | 2631 | } |
| 2632 | 2632 | } |
| 2633 | 2633 | $this->_out($annots.']'); |
| 2634 | 2634 | } |
| 2635 | - $this->_out('/Contents '.($this->n+1).' 0 R>>'); |
|
| 2635 | + $this->_out('/Contents '.($this->n + 1).' 0 R>>'); |
|
| 2636 | 2636 | $this->_out('endobj'); |
| 2637 | 2637 | //Page content |
| 2638 | - $p=($this->compress) ? gzcompress($this->pages[$n]) : $this->pages[$n]; |
|
| 2638 | + $p = ($this->compress) ? gzcompress($this->pages[$n]) : $this->pages[$n]; |
|
| 2639 | 2639 | $this->_newobj(); |
| 2640 | 2640 | $this->_out('<<'.$filter.'/Length '.strlen($p).'>>'); |
| 2641 | 2641 | $this->_putstream($p); |
| 2642 | 2642 | $this->_out('endobj'); |
| 2643 | 2643 | } |
| 2644 | 2644 | //Pages root |
| 2645 | - $this->offsets[1]=strlen($this->buffer); |
|
| 2645 | + $this->offsets[1] = strlen($this->buffer); |
|
| 2646 | 2646 | $this->_out('1 0 obj'); |
| 2647 | 2647 | $this->_out('<</Type /Pages'); |
| 2648 | - $kids='/Kids ['; |
|
| 2649 | - for($i=0;$i<$nb;$i++) { |
|
| 2650 | - $kids.=(3+2*$i).' 0 R '; |
|
| 2648 | + $kids = '/Kids ['; |
|
| 2649 | + for ($i = 0; $i < $nb; $i++) { |
|
| 2650 | + $kids .= (3 + 2 * $i).' 0 R '; |
|
| 2651 | 2651 | } |
| 2652 | 2652 | $this->_out($kids.']'); |
| 2653 | 2653 | $this->_out('/Count '.$nb); |
| 2654 | - $this->_out(sprintf('/MediaBox [0 0 %.2f %.2f]',$wPt,$hPt)); |
|
| 2654 | + $this->_out(sprintf('/MediaBox [0 0 %.2f %.2f]', $wPt, $hPt)); |
|
| 2655 | 2655 | $this->_out('>>'); |
| 2656 | 2656 | $this->_out('endobj'); |
| 2657 | 2657 | } |
@@ -2662,46 +2662,46 @@ discard block |
||
| 2662 | 2662 | * @access protected |
| 2663 | 2663 | */ |
| 2664 | 2664 | function _putfonts() { |
| 2665 | - $nf=$this->n; |
|
| 2666 | - foreach($this->diffs as $diff) { |
|
| 2665 | + $nf = $this->n; |
|
| 2666 | + foreach ($this->diffs as $diff) { |
|
| 2667 | 2667 | //Encodings |
| 2668 | 2668 | $this->_newobj(); |
| 2669 | 2669 | $this->_out('<</Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences ['.$diff.']>>'); |
| 2670 | 2670 | $this->_out('endobj'); |
| 2671 | 2671 | } |
| 2672 | - $mqr=get_magic_quotes_runtime(); |
|
| 2672 | + $mqr = get_magic_quotes_runtime(); |
|
| 2673 | 2673 | set_magic_quotes_runtime(0); |
| 2674 | - foreach($this->FontFiles as $file=>$info) { |
|
| 2674 | + foreach ($this->FontFiles as $file=>$info) { |
|
| 2675 | 2675 | //Font file embedding |
| 2676 | 2676 | $this->_newobj(); |
| 2677 | - $this->FontFiles[$file]['n']=$this->n; |
|
| 2678 | - $font=''; |
|
| 2679 | - $f=fopen($this->_getfontpath().$file,'rb',1); |
|
| 2680 | - if(!$f) { |
|
| 2677 | + $this->FontFiles[$file]['n'] = $this->n; |
|
| 2678 | + $font = ''; |
|
| 2679 | + $f = fopen($this->_getfontpath().$file, 'rb', 1); |
|
| 2680 | + if (!$f) { |
|
| 2681 | 2681 | $this->Error('Font file not found'); |
| 2682 | 2682 | } |
| 2683 | - while(!feof($f)) { |
|
| 2683 | + while (!feof($f)) { |
|
| 2684 | 2684 | $font .= fread($f, 8192); |
| 2685 | 2685 | } |
| 2686 | 2686 | fclose($f); |
| 2687 | - $compressed=(substr($file,-2)=='.z'); |
|
| 2688 | - if(!$compressed && isset($info['length2'])) { |
|
| 2689 | - $header=(ord($font{0})==128); |
|
| 2690 | - if($header) { |
|
| 2687 | + $compressed = (substr($file, -2) == '.z'); |
|
| 2688 | + if (!$compressed && isset($info['length2'])) { |
|
| 2689 | + $header = (ord($font{0}) == 128); |
|
| 2690 | + if ($header) { |
|
| 2691 | 2691 | //Strip first binary header |
| 2692 | - $font=substr($font,6); |
|
| 2692 | + $font = substr($font, 6); |
|
| 2693 | 2693 | } |
| 2694 | - if($header && ord($font{$info['length1']})==128) { |
|
| 2694 | + if ($header && ord($font{$info['length1']}) == 128) { |
|
| 2695 | 2695 | //Strip second binary header |
| 2696 | - $font=substr($font,0,$info['length1']).substr($font,$info['length1']+6); |
|
| 2696 | + $font = substr($font, 0, $info['length1']).substr($font, $info['length1'] + 6); |
|
| 2697 | 2697 | } |
| 2698 | 2698 | } |
| 2699 | 2699 | $this->_out('<</Length '.strlen($font)); |
| 2700 | - if($compressed) { |
|
| 2700 | + if ($compressed) { |
|
| 2701 | 2701 | $this->_out('/Filter /FlateDecode'); |
| 2702 | 2702 | } |
| 2703 | 2703 | $this->_out('/Length1 '.$info['length1']); |
| 2704 | - if(isset($info['length2'])) { |
|
| 2704 | + if (isset($info['length2'])) { |
|
| 2705 | 2705 | $this->_out('/Length2 '.$info['length2'].' /Length3 0'); |
| 2706 | 2706 | } |
| 2707 | 2707 | $this->_out('>>'); |
@@ -2709,34 +2709,34 @@ discard block |
||
| 2709 | 2709 | $this->_out('endobj'); |
| 2710 | 2710 | } |
| 2711 | 2711 | set_magic_quotes_runtime($mqr); |
| 2712 | - foreach($this->fonts as $k=>$font) { |
|
| 2712 | + foreach ($this->fonts as $k=>$font) { |
|
| 2713 | 2713 | //Font objects |
| 2714 | - $this->fonts[$k]['n']=$this->n+1; |
|
| 2715 | - $type=$font['type']; |
|
| 2716 | - $name=$font['name']; |
|
| 2717 | - if($type=='core') { |
|
| 2714 | + $this->fonts[$k]['n'] = $this->n + 1; |
|
| 2715 | + $type = $font['type']; |
|
| 2716 | + $name = $font['name']; |
|
| 2717 | + if ($type == 'core') { |
|
| 2718 | 2718 | //Standard font |
| 2719 | 2719 | $this->_newobj(); |
| 2720 | 2720 | $this->_out('<</Type /Font'); |
| 2721 | 2721 | $this->_out('/BaseFont /'.$name); |
| 2722 | 2722 | $this->_out('/Subtype /Type1'); |
| 2723 | - if($name!='Symbol' && $name!='ZapfDingbats') { |
|
| 2723 | + if ($name != 'Symbol' && $name != 'ZapfDingbats') { |
|
| 2724 | 2724 | $this->_out('/Encoding /WinAnsiEncoding'); |
| 2725 | 2725 | } |
| 2726 | 2726 | $this->_out('>>'); |
| 2727 | 2727 | $this->_out('endobj'); |
| 2728 | - } elseif($type=='Type1' || $type=='TrueType') { |
|
| 2728 | + } elseif ($type == 'Type1' || $type == 'TrueType') { |
|
| 2729 | 2729 | //Additional Type1 or TrueType font |
| 2730 | 2730 | $this->_newobj(); |
| 2731 | 2731 | $this->_out('<</Type /Font'); |
| 2732 | 2732 | $this->_out('/BaseFont /'.$name); |
| 2733 | 2733 | $this->_out('/Subtype /'.$type); |
| 2734 | 2734 | $this->_out('/FirstChar 32 /LastChar 255'); |
| 2735 | - $this->_out('/Widths '.($this->n+1).' 0 R'); |
|
| 2736 | - $this->_out('/FontDescriptor '.($this->n+2).' 0 R'); |
|
| 2737 | - if($font['enc']) { |
|
| 2738 | - if(isset($font['diff'])) { |
|
| 2739 | - $this->_out('/Encoding '.($nf+$font['diff']).' 0 R'); |
|
| 2735 | + $this->_out('/Widths '.($this->n + 1).' 0 R'); |
|
| 2736 | + $this->_out('/FontDescriptor '.($this->n + 2).' 0 R'); |
|
| 2737 | + if ($font['enc']) { |
|
| 2738 | + if (isset($font['diff'])) { |
|
| 2739 | + $this->_out('/Encoding '.($nf + $font['diff']).' 0 R'); |
|
| 2740 | 2740 | } else { |
| 2741 | 2741 | $this->_out('/Encoding /WinAnsiEncoding'); |
| 2742 | 2742 | } |
@@ -2745,29 +2745,29 @@ discard block |
||
| 2745 | 2745 | $this->_out('endobj'); |
| 2746 | 2746 | //Widths |
| 2747 | 2747 | $this->_newobj(); |
| 2748 | - $cw=&$font['cw']; |
|
| 2749 | - $s='['; |
|
| 2750 | - for($i=32;$i<=255;$i++) { |
|
| 2751 | - $s.=$cw[chr($i)].' '; |
|
| 2748 | + $cw = &$font['cw']; |
|
| 2749 | + $s = '['; |
|
| 2750 | + for ($i = 32; $i <= 255; $i++) { |
|
| 2751 | + $s .= $cw[chr($i)].' '; |
|
| 2752 | 2752 | } |
| 2753 | 2753 | $this->_out($s.']'); |
| 2754 | 2754 | $this->_out('endobj'); |
| 2755 | 2755 | //Descriptor |
| 2756 | 2756 | $this->_newobj(); |
| 2757 | - $s='<</Type /FontDescriptor /FontName /'.$name; |
|
| 2758 | - foreach($font['desc'] as $k=>$v) { |
|
| 2759 | - $s.=' /'.$k.' '.$v; |
|
| 2757 | + $s = '<</Type /FontDescriptor /FontName /'.$name; |
|
| 2758 | + foreach ($font['desc'] as $k=>$v) { |
|
| 2759 | + $s .= ' /'.$k.' '.$v; |
|
| 2760 | 2760 | } |
| 2761 | 2761 | $file = $font['file']; |
| 2762 | - if($file) { |
|
| 2763 | - $s.=' /FontFile'.($type=='Type1' ? '' : '2').' '.$this->FontFiles[$file]['n'].' 0 R'; |
|
| 2762 | + if ($file) { |
|
| 2763 | + $s .= ' /FontFile'.($type == 'Type1' ? '' : '2').' '.$this->FontFiles[$file]['n'].' 0 R'; |
|
| 2764 | 2764 | } |
| 2765 | 2765 | $this->_out($s.'>>'); |
| 2766 | 2766 | $this->_out('endobj'); |
| 2767 | 2767 | } else { |
| 2768 | 2768 | //Allow for additional types |
| 2769 | - $mtd='_put'.strtolower($type); |
|
| 2770 | - if(!method_exists($this, $mtd)) { |
|
| 2769 | + $mtd = '_put'.strtolower($type); |
|
| 2770 | + if (!method_exists($this, $mtd)) { |
|
| 2771 | 2771 | $this->Error('Unsupported font type: '.$type); |
| 2772 | 2772 | } |
| 2773 | 2773 | $this->$mtd($font); |
@@ -2780,35 +2780,35 @@ discard block |
||
| 2780 | 2780 | * @access protected |
| 2781 | 2781 | */ |
| 2782 | 2782 | function _putimages() { |
| 2783 | - $filter=($this->compress) ? '/Filter /FlateDecode ' : ''; |
|
| 2783 | + $filter = ($this->compress) ? '/Filter /FlateDecode ' : ''; |
|
| 2784 | 2784 | reset($this->images); |
| 2785 | - while(list($file,$info)=each($this->images)) { |
|
| 2785 | + while (list($file, $info) = each($this->images)) { |
|
| 2786 | 2786 | $this->_newobj(); |
| 2787 | - $this->images[$file]['n']=$this->n; |
|
| 2787 | + $this->images[$file]['n'] = $this->n; |
|
| 2788 | 2788 | $this->_out('<</Type /XObject'); |
| 2789 | 2789 | $this->_out('/Subtype /Image'); |
| 2790 | 2790 | $this->_out('/Width '.$info['w']); |
| 2791 | 2791 | $this->_out('/Height '.$info['h']); |
| 2792 | - if($info['cs']=='Indexed') { |
|
| 2793 | - $this->_out('/ColorSpace [/Indexed /DeviceRGB '.(strlen($info['pal'])/3-1).' '.($this->n+1).' 0 R]'); |
|
| 2792 | + if ($info['cs'] == 'Indexed') { |
|
| 2793 | + $this->_out('/ColorSpace [/Indexed /DeviceRGB '.(strlen($info['pal']) / 3 - 1).' '.($this->n + 1).' 0 R]'); |
|
| 2794 | 2794 | } |
| 2795 | 2795 | else { |
| 2796 | 2796 | $this->_out('/ColorSpace /'.$info['cs']); |
| 2797 | - if($info['cs']=='DeviceCMYK') { |
|
| 2797 | + if ($info['cs'] == 'DeviceCMYK') { |
|
| 2798 | 2798 | $this->_out('/Decode [1 0 1 0 1 0 1 0]'); |
| 2799 | 2799 | } |
| 2800 | 2800 | } |
| 2801 | 2801 | $this->_out('/BitsPerComponent '.$info['bpc']); |
| 2802 | - if(isset($info['f'])) { |
|
| 2802 | + if (isset($info['f'])) { |
|
| 2803 | 2803 | $this->_out('/Filter /'.$info['f']); |
| 2804 | 2804 | } |
| 2805 | - if(isset($info['parms'])) { |
|
| 2805 | + if (isset($info['parms'])) { |
|
| 2806 | 2806 | $this->_out($info['parms']); |
| 2807 | 2807 | } |
| 2808 | - if(isset($info['trns']) and is_array($info['trns'])) { |
|
| 2809 | - $trns=''; |
|
| 2810 | - for($i=0;$i<count($info['trns']);$i++) { |
|
| 2811 | - $trns.=$info['trns'][$i].' '.$info['trns'][$i].' '; |
|
| 2808 | + if (isset($info['trns']) and is_array($info['trns'])) { |
|
| 2809 | + $trns = ''; |
|
| 2810 | + for ($i = 0; $i < count($info['trns']); $i++) { |
|
| 2811 | + $trns .= $info['trns'][$i].' '.$info['trns'][$i].' '; |
|
| 2812 | 2812 | } |
| 2813 | 2813 | $this->_out('/Mask ['.$trns.']'); |
| 2814 | 2814 | } |
@@ -2817,9 +2817,9 @@ discard block |
||
| 2817 | 2817 | unset($this->images[$file]['data']); |
| 2818 | 2818 | $this->_out('endobj'); |
| 2819 | 2819 | //Palette |
| 2820 | - if($info['cs']=='Indexed') { |
|
| 2820 | + if ($info['cs'] == 'Indexed') { |
|
| 2821 | 2821 | $this->_newobj(); |
| 2822 | - $pal=($this->compress) ? gzcompress($info['pal']) : $info['pal']; |
|
| 2822 | + $pal = ($this->compress) ? gzcompress($info['pal']) : $info['pal']; |
|
| 2823 | 2823 | $this->_out('<<'.$filter.'/Length '.strlen($pal).'>>'); |
| 2824 | 2824 | $this->_putstream($pal); |
| 2825 | 2825 | $this->_out('endobj'); |
@@ -2832,7 +2832,7 @@ discard block |
||
| 2832 | 2832 | * @access protected |
| 2833 | 2833 | */ |
| 2834 | 2834 | function _putxobjectdict() { |
| 2835 | - foreach($this->images as $image) { |
|
| 2835 | + foreach ($this->images as $image) { |
|
| 2836 | 2836 | $this->_out('/I'.$image['i'].' '.$image['n'].' 0 R'); |
| 2837 | 2837 | } |
| 2838 | 2838 | } |
@@ -2841,10 +2841,10 @@ discard block |
||
| 2841 | 2841 | * _putresourcedict |
| 2842 | 2842 | * @access protected |
| 2843 | 2843 | */ |
| 2844 | - function _putresourcedict(){ |
|
| 2844 | + function _putresourcedict() { |
|
| 2845 | 2845 | $this->_out('/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]'); |
| 2846 | 2846 | $this->_out('/Font <<'); |
| 2847 | - foreach($this->fonts as $font) { |
|
| 2847 | + foreach ($this->fonts as $font) { |
|
| 2848 | 2848 | $this->_out('/F'.$font['i'].' '.$font['n'].' 0 R'); |
| 2849 | 2849 | } |
| 2850 | 2850 | $this->_out('>>'); |
@@ -2861,7 +2861,7 @@ discard block |
||
| 2861 | 2861 | $this->_putfonts(); |
| 2862 | 2862 | $this->_putimages(); |
| 2863 | 2863 | //Resource dictionary |
| 2864 | - $this->offsets[2]=strlen($this->buffer); |
|
| 2864 | + $this->offsets[2] = strlen($this->buffer); |
|
| 2865 | 2865 | $this->_out('2 0 obj'); |
| 2866 | 2866 | $this->_out('<<'); |
| 2867 | 2867 | $this->_putresourcedict(); |
@@ -2875,19 +2875,19 @@ discard block |
||
| 2875 | 2875 | */ |
| 2876 | 2876 | function _putinfo() { |
| 2877 | 2877 | $this->_out('/Producer '.$this->_textstring(PDF_PRODUCER)); |
| 2878 | - if(!empty($this->title)) { |
|
| 2878 | + if (!empty($this->title)) { |
|
| 2879 | 2879 | $this->_out('/Title '.$this->_textstring($this->title)); |
| 2880 | 2880 | } |
| 2881 | - if(!empty($this->subject)) { |
|
| 2881 | + if (!empty($this->subject)) { |
|
| 2882 | 2882 | $this->_out('/Subject '.$this->_textstring($this->subject)); |
| 2883 | 2883 | } |
| 2884 | - if(!empty($this->author)) { |
|
| 2884 | + if (!empty($this->author)) { |
|
| 2885 | 2885 | $this->_out('/Author '.$this->_textstring($this->author)); |
| 2886 | 2886 | } |
| 2887 | - if(!empty($this->keywords)) { |
|
| 2887 | + if (!empty($this->keywords)) { |
|
| 2888 | 2888 | $this->_out('/Keywords '.$this->_textstring($this->keywords)); |
| 2889 | 2889 | } |
| 2890 | - if(!empty($this->creator)) { |
|
| 2890 | + if (!empty($this->creator)) { |
|
| 2891 | 2891 | $this->_out('/Creator '.$this->_textstring($this->creator)); |
| 2892 | 2892 | } |
| 2893 | 2893 | $this->_out('/CreationDate '.$this->_textstring('D:'.date('YmdHis'))); |
@@ -2900,25 +2900,25 @@ discard block |
||
| 2900 | 2900 | function _putcatalog() { |
| 2901 | 2901 | $this->_out('/Type /Catalog'); |
| 2902 | 2902 | $this->_out('/Pages 1 0 R'); |
| 2903 | - if($this->ZoomMode=='fullpage') { |
|
| 2903 | + if ($this->ZoomMode == 'fullpage') { |
|
| 2904 | 2904 | $this->_out('/OpenAction [3 0 R /Fit]'); |
| 2905 | 2905 | } |
| 2906 | - elseif($this->ZoomMode=='fullwidth') { |
|
| 2906 | + elseif ($this->ZoomMode == 'fullwidth') { |
|
| 2907 | 2907 | $this->_out('/OpenAction [3 0 R /FitH null]'); |
| 2908 | 2908 | } |
| 2909 | - elseif($this->ZoomMode=='real') { |
|
| 2909 | + elseif ($this->ZoomMode == 'real') { |
|
| 2910 | 2910 | $this->_out('/OpenAction [3 0 R /XYZ null null 1]'); |
| 2911 | 2911 | } |
| 2912 | - elseif(!is_string($this->ZoomMode)) { |
|
| 2913 | - $this->_out('/OpenAction [3 0 R /XYZ null null '.($this->ZoomMode/100).']'); |
|
| 2912 | + elseif (!is_string($this->ZoomMode)) { |
|
| 2913 | + $this->_out('/OpenAction [3 0 R /XYZ null null '.($this->ZoomMode / 100).']'); |
|
| 2914 | 2914 | } |
| 2915 | - if($this->LayoutMode=='single') { |
|
| 2915 | + if ($this->LayoutMode == 'single') { |
|
| 2916 | 2916 | $this->_out('/PageLayout /SinglePage'); |
| 2917 | 2917 | } |
| 2918 | - elseif($this->LayoutMode=='continuous') { |
|
| 2918 | + elseif ($this->LayoutMode == 'continuous') { |
|
| 2919 | 2919 | $this->_out('/PageLayout /OneColumn'); |
| 2920 | 2920 | } |
| 2921 | - elseif($this->LayoutMode=='two') { |
|
| 2921 | + elseif ($this->LayoutMode == 'two') { |
|
| 2922 | 2922 | $this->_out('/PageLayout /TwoColumnLeft'); |
| 2923 | 2923 | } |
| 2924 | 2924 | } |
@@ -2928,9 +2928,9 @@ discard block |
||
| 2928 | 2928 | * @access protected |
| 2929 | 2929 | */ |
| 2930 | 2930 | function _puttrailer() { |
| 2931 | - $this->_out('/Size '.($this->n+1)); |
|
| 2931 | + $this->_out('/Size '.($this->n + 1)); |
|
| 2932 | 2932 | $this->_out('/Root '.$this->n.' 0 R'); |
| 2933 | - $this->_out('/Info '.($this->n-1).' 0 R'); |
|
| 2933 | + $this->_out('/Info '.($this->n - 1).' 0 R'); |
|
| 2934 | 2934 | } |
| 2935 | 2935 | |
| 2936 | 2936 | /** |
@@ -2962,12 +2962,12 @@ discard block |
||
| 2962 | 2962 | $this->_out('>>'); |
| 2963 | 2963 | $this->_out('endobj'); |
| 2964 | 2964 | //Cross-ref |
| 2965 | - $o=strlen($this->buffer); |
|
| 2965 | + $o = strlen($this->buffer); |
|
| 2966 | 2966 | $this->_out('xref'); |
| 2967 | - $this->_out('0 '.($this->n+1)); |
|
| 2967 | + $this->_out('0 '.($this->n + 1)); |
|
| 2968 | 2968 | $this->_out('0000000000 65535 f '); |
| 2969 | - for($i=1;$i<=$this->n;$i++) { |
|
| 2970 | - $this->_out(sprintf('%010d 00000 n ',$this->offsets[$i])); |
|
| 2969 | + for ($i = 1; $i <= $this->n; $i++) { |
|
| 2970 | + $this->_out(sprintf('%010d 00000 n ', $this->offsets[$i])); |
|
| 2971 | 2971 | } |
| 2972 | 2972 | //Trailer |
| 2973 | 2973 | $this->_out('trailer'); |
@@ -2977,7 +2977,7 @@ discard block |
||
| 2977 | 2977 | $this->_out('startxref'); |
| 2978 | 2978 | $this->_out($o); |
| 2979 | 2979 | $this->_out('%%EOF'); |
| 2980 | - $this->state=3; |
|
| 2980 | + $this->state = 3; |
|
| 2981 | 2981 | } |
| 2982 | 2982 | |
| 2983 | 2983 | /** |
@@ -2986,37 +2986,37 @@ discard block |
||
| 2986 | 2986 | */ |
| 2987 | 2987 | function _beginpage($orientation) { |
| 2988 | 2988 | $this->page++; |
| 2989 | - $this->pages[$this->page]=''; |
|
| 2990 | - $this->state=2; |
|
| 2991 | - $this->x=$this->lMargin; |
|
| 2992 | - $this->y=$this->tMargin; |
|
| 2993 | - $this->FontFamily=''; |
|
| 2989 | + $this->pages[$this->page] = ''; |
|
| 2990 | + $this->state = 2; |
|
| 2991 | + $this->x = $this->lMargin; |
|
| 2992 | + $this->y = $this->tMargin; |
|
| 2993 | + $this->FontFamily = ''; |
|
| 2994 | 2994 | //Page orientation |
| 2995 | - if(empty($orientation)) { |
|
| 2996 | - $orientation=$this->DefOrientation; |
|
| 2995 | + if (empty($orientation)) { |
|
| 2996 | + $orientation = $this->DefOrientation; |
|
| 2997 | 2997 | } |
| 2998 | 2998 | else { |
| 2999 | - $orientation=strtoupper($orientation{0}); |
|
| 3000 | - if($orientation!=$this->DefOrientation) { |
|
| 3001 | - $this->OrientationChanges[$this->page]=true; |
|
| 2999 | + $orientation = strtoupper($orientation{0}); |
|
| 3000 | + if ($orientation != $this->DefOrientation) { |
|
| 3001 | + $this->OrientationChanges[$this->page] = true; |
|
| 3002 | 3002 | } |
| 3003 | 3003 | } |
| 3004 | - if($orientation!=$this->CurOrientation) { |
|
| 3004 | + if ($orientation != $this->CurOrientation) { |
|
| 3005 | 3005 | //Change orientation |
| 3006 | - if($orientation=='P') { |
|
| 3007 | - $this->wPt=$this->fwPt; |
|
| 3008 | - $this->hPt=$this->fhPt; |
|
| 3009 | - $this->w=$this->fw; |
|
| 3010 | - $this->h=$this->fh; |
|
| 3006 | + if ($orientation == 'P') { |
|
| 3007 | + $this->wPt = $this->fwPt; |
|
| 3008 | + $this->hPt = $this->fhPt; |
|
| 3009 | + $this->w = $this->fw; |
|
| 3010 | + $this->h = $this->fh; |
|
| 3011 | 3011 | } |
| 3012 | 3012 | else { |
| 3013 | - $this->wPt=$this->fhPt; |
|
| 3014 | - $this->hPt=$this->fwPt; |
|
| 3015 | - $this->w=$this->fh; |
|
| 3016 | - $this->h=$this->fw; |
|
| 3013 | + $this->wPt = $this->fhPt; |
|
| 3014 | + $this->hPt = $this->fwPt; |
|
| 3015 | + $this->w = $this->fh; |
|
| 3016 | + $this->h = $this->fw; |
|
| 3017 | 3017 | } |
| 3018 | - $this->PageBreakTrigger=$this->h-$this->bMargin; |
|
| 3019 | - $this->CurOrientation=$orientation; |
|
| 3018 | + $this->PageBreakTrigger = $this->h - $this->bMargin; |
|
| 3019 | + $this->CurOrientation = $orientation; |
|
| 3020 | 3020 | } |
| 3021 | 3021 | } |
| 3022 | 3022 | |
@@ -3025,7 +3025,7 @@ discard block |
||
| 3025 | 3025 | * @access protected |
| 3026 | 3026 | */ |
| 3027 | 3027 | function _endpage() { |
| 3028 | - $this->state=1; |
|
| 3028 | + $this->state = 1; |
|
| 3029 | 3029 | } |
| 3030 | 3030 | |
| 3031 | 3031 | /** |
@@ -3034,7 +3034,7 @@ discard block |
||
| 3034 | 3034 | */ |
| 3035 | 3035 | function _newobj() { |
| 3036 | 3036 | $this->n++; |
| 3037 | - $this->offsets[$this->n]=strlen($this->buffer); |
|
| 3037 | + $this->offsets[$this->n] = strlen($this->buffer); |
|
| 3038 | 3038 | $this->_out($this->n.' 0 obj'); |
| 3039 | 3039 | } |
| 3040 | 3040 | |
@@ -3042,10 +3042,10 @@ discard block |
||
| 3042 | 3042 | * Underline text |
| 3043 | 3043 | * @access protected |
| 3044 | 3044 | */ |
| 3045 | - function _dounderline($x,$y,$txt) { |
|
| 3045 | + function _dounderline($x, $y, $txt) { |
|
| 3046 | 3046 | $up = $this->CurrentFont['up']; |
| 3047 | 3047 | $ut = $this->CurrentFont['ut']; |
| 3048 | - $w = $this->GetStringWidth($txt) + $this->ws * substr_count($txt,' '); |
|
| 3048 | + $w = $this->GetStringWidth($txt) + $this->ws * substr_count($txt, ' '); |
|
| 3049 | 3049 | 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); |
| 3050 | 3050 | } |
| 3051 | 3051 | |
@@ -3054,31 +3054,31 @@ discard block |
||
| 3054 | 3054 | * @access protected |
| 3055 | 3055 | */ |
| 3056 | 3056 | function _parsejpg($file) { |
| 3057 | - $a=GetImageSize($file); |
|
| 3058 | - if(empty($a)) { |
|
| 3057 | + $a = GetImageSize($file); |
|
| 3058 | + if (empty($a)) { |
|
| 3059 | 3059 | $this->Error('Missing or incorrect image file: '.$file); |
| 3060 | 3060 | } |
| 3061 | - if($a[2]!=2) { |
|
| 3061 | + if ($a[2] != 2) { |
|
| 3062 | 3062 | $this->Error('Not a JPEG file: '.$file); |
| 3063 | 3063 | } |
| 3064 | - if(!isset($a['channels']) or $a['channels']==3) { |
|
| 3065 | - $colspace='DeviceRGB'; |
|
| 3064 | + if (!isset($a['channels']) or $a['channels'] == 3) { |
|
| 3065 | + $colspace = 'DeviceRGB'; |
|
| 3066 | 3066 | } |
| 3067 | - elseif($a['channels']==4) { |
|
| 3068 | - $colspace='DeviceCMYK'; |
|
| 3067 | + elseif ($a['channels'] == 4) { |
|
| 3068 | + $colspace = 'DeviceCMYK'; |
|
| 3069 | 3069 | } |
| 3070 | 3070 | else { |
| 3071 | - $colspace='DeviceGray'; |
|
| 3071 | + $colspace = 'DeviceGray'; |
|
| 3072 | 3072 | } |
| 3073 | - $bpc=isset($a['bits']) ? $a['bits'] : 8; |
|
| 3073 | + $bpc = isset($a['bits']) ? $a['bits'] : 8; |
|
| 3074 | 3074 | //Read whole file |
| 3075 | - $f=fopen($file,'rb'); |
|
| 3076 | - $data=''; |
|
| 3077 | - while(!feof($f)) { |
|
| 3078 | - $data.=fread($f,4096); |
|
| 3075 | + $f = fopen($file, 'rb'); |
|
| 3076 | + $data = ''; |
|
| 3077 | + while (!feof($f)) { |
|
| 3078 | + $data .= fread($f, 4096); |
|
| 3079 | 3079 | } |
| 3080 | 3080 | fclose($f); |
| 3081 | - return array('w'=>$a[0],'h'=>$a[1],'cs'=>$colspace,'bpc'=>$bpc,'f'=>'DCTDecode','data'=>$data); |
|
| 3081 | + return array('w'=>$a[0], 'h'=>$a[1], 'cs'=>$colspace, 'bpc'=>$bpc, 'f'=>'DCTDecode', 'data'=>$data); |
|
| 3082 | 3082 | } |
| 3083 | 3083 | |
| 3084 | 3084 | /** |
@@ -3086,92 +3086,92 @@ discard block |
||
| 3086 | 3086 | * @access protected |
| 3087 | 3087 | */ |
| 3088 | 3088 | function _parsepng($file) { |
| 3089 | - $f=fopen($file,'rb'); |
|
| 3090 | - if(empty($f)) { |
|
| 3089 | + $f = fopen($file, 'rb'); |
|
| 3090 | + if (empty($f)) { |
|
| 3091 | 3091 | $this->Error('Can\'t open image file: '.$file); |
| 3092 | 3092 | } |
| 3093 | 3093 | //Check signature |
| 3094 | - if(fread($f,8)!=chr(137).'PNG'.chr(13).chr(10).chr(26).chr(10)) { |
|
| 3094 | + if (fread($f, 8) != chr(137).'PNG'.chr(13).chr(10).chr(26).chr(10)) { |
|
| 3095 | 3095 | $this->Error('Not a PNG file: '.$file); |
| 3096 | 3096 | } |
| 3097 | 3097 | //Read header chunk |
| 3098 | - fread($f,4); |
|
| 3099 | - if(fread($f,4)!='IHDR') { |
|
| 3098 | + fread($f, 4); |
|
| 3099 | + if (fread($f, 4) != 'IHDR') { |
|
| 3100 | 3100 | $this->Error('Incorrect PNG file: '.$file); |
| 3101 | 3101 | } |
| 3102 | - $w=$this->_freadint($f); |
|
| 3103 | - $h=$this->_freadint($f); |
|
| 3104 | - $bpc=ord(fread($f,1)); |
|
| 3105 | - if($bpc>8) { |
|
| 3102 | + $w = $this->_freadint($f); |
|
| 3103 | + $h = $this->_freadint($f); |
|
| 3104 | + $bpc = ord(fread($f, 1)); |
|
| 3105 | + if ($bpc > 8) { |
|
| 3106 | 3106 | $this->Error('16-bit depth not supported: '.$file); |
| 3107 | 3107 | } |
| 3108 | - $ct=ord(fread($f,1)); |
|
| 3109 | - if($ct==0) { |
|
| 3110 | - $colspace='DeviceGray'; |
|
| 3108 | + $ct = ord(fread($f, 1)); |
|
| 3109 | + if ($ct == 0) { |
|
| 3110 | + $colspace = 'DeviceGray'; |
|
| 3111 | 3111 | } |
| 3112 | - elseif($ct==2) { |
|
| 3113 | - $colspace='DeviceRGB'; |
|
| 3112 | + elseif ($ct == 2) { |
|
| 3113 | + $colspace = 'DeviceRGB'; |
|
| 3114 | 3114 | } |
| 3115 | - elseif($ct==3) { |
|
| 3116 | - $colspace='Indexed'; |
|
| 3115 | + elseif ($ct == 3) { |
|
| 3116 | + $colspace = 'Indexed'; |
|
| 3117 | 3117 | } |
| 3118 | 3118 | else { |
| 3119 | 3119 | $this->Error('Alpha channel not supported: '.$file); |
| 3120 | 3120 | } |
| 3121 | - if(ord(fread($f,1))!=0) { |
|
| 3121 | + if (ord(fread($f, 1)) != 0) { |
|
| 3122 | 3122 | $this->Error('Unknown compression method: '.$file); |
| 3123 | 3123 | } |
| 3124 | - if(ord(fread($f,1))!=0) { |
|
| 3124 | + if (ord(fread($f, 1)) != 0) { |
|
| 3125 | 3125 | $this->Error('Unknown filter method: '.$file); |
| 3126 | 3126 | } |
| 3127 | - if(ord(fread($f,1))!=0) { |
|
| 3127 | + if (ord(fread($f, 1)) != 0) { |
|
| 3128 | 3128 | $this->Error('Interlacing not supported: '.$file); |
| 3129 | 3129 | } |
| 3130 | - fread($f,4); |
|
| 3131 | - $parms='/DecodeParms <</Predictor 15 /Colors '.($ct==2 ? 3 : 1).' /BitsPerComponent '.$bpc.' /Columns '.$w.'>>'; |
|
| 3130 | + fread($f, 4); |
|
| 3131 | + $parms = '/DecodeParms <</Predictor 15 /Colors '.($ct == 2 ? 3 : 1).' /BitsPerComponent '.$bpc.' /Columns '.$w.'>>'; |
|
| 3132 | 3132 | //Scan chunks looking for palette, transparency and image data |
| 3133 | - $pal=''; |
|
| 3134 | - $trns=''; |
|
| 3135 | - $data=''; |
|
| 3133 | + $pal = ''; |
|
| 3134 | + $trns = ''; |
|
| 3135 | + $data = ''; |
|
| 3136 | 3136 | do { |
| 3137 | - $n=$this->_freadint($f); |
|
| 3138 | - $type=fread($f,4); |
|
| 3139 | - if($type=='PLTE') { |
|
| 3137 | + $n = $this->_freadint($f); |
|
| 3138 | + $type = fread($f, 4); |
|
| 3139 | + if ($type == 'PLTE') { |
|
| 3140 | 3140 | //Read palette |
| 3141 | - $pal=fread($f,$n); |
|
| 3142 | - fread($f,4); |
|
| 3141 | + $pal = fread($f, $n); |
|
| 3142 | + fread($f, 4); |
|
| 3143 | 3143 | } |
| 3144 | - elseif($type=='tRNS') { |
|
| 3144 | + elseif ($type == 'tRNS') { |
|
| 3145 | 3145 | //Read transparency info |
| 3146 | - $t=fread($f,$n); |
|
| 3147 | - if($ct==0) { |
|
| 3148 | - $trns=array(ord(substr($t,1,1))); |
|
| 3146 | + $t = fread($f, $n); |
|
| 3147 | + if ($ct == 0) { |
|
| 3148 | + $trns = array(ord(substr($t, 1, 1))); |
|
| 3149 | 3149 | } |
| 3150 | - elseif($ct==2) { |
|
| 3151 | - $trns=array(ord(substr($t,1,1)),ord(substr($t,3,1)),ord(substr($t,5,1))); |
|
| 3150 | + elseif ($ct == 2) { |
|
| 3151 | + $trns = array(ord(substr($t, 1, 1)), ord(substr($t, 3, 1)), ord(substr($t, 5, 1))); |
|
| 3152 | 3152 | } |
| 3153 | 3153 | else { |
| 3154 | - $pos=strpos($t,chr(0)); |
|
| 3155 | - if($pos!==false) { |
|
| 3156 | - $trns=array($pos); |
|
| 3154 | + $pos = strpos($t, chr(0)); |
|
| 3155 | + if ($pos !== false) { |
|
| 3156 | + $trns = array($pos); |
|
| 3157 | 3157 | } |
| 3158 | 3158 | } |
| 3159 | - fread($f,4); |
|
| 3159 | + fread($f, 4); |
|
| 3160 | 3160 | } |
| 3161 | - elseif($type=='IDAT') { |
|
| 3161 | + elseif ($type == 'IDAT') { |
|
| 3162 | 3162 | //Read image data block |
| 3163 | - $data.=fread($f,$n); |
|
| 3164 | - fread($f,4); |
|
| 3163 | + $data .= fread($f, $n); |
|
| 3164 | + fread($f, 4); |
|
| 3165 | 3165 | } |
| 3166 | - elseif($type=='IEND') { |
|
| 3166 | + elseif ($type == 'IEND') { |
|
| 3167 | 3167 | break; |
| 3168 | 3168 | } |
| 3169 | 3169 | else { |
| 3170 | - fread($f,$n+4); |
|
| 3170 | + fread($f, $n + 4); |
|
| 3171 | 3171 | } |
| 3172 | 3172 | } |
| 3173 | - while($n); |
|
| 3174 | - if($colspace=='Indexed' and empty($pal)) { |
|
| 3173 | + while ($n); |
|
| 3174 | + if ($colspace == 'Indexed' and empty($pal)) { |
|
| 3175 | 3175 | $this->Error('Missing palette in '.$file); |
| 3176 | 3176 | } |
| 3177 | 3177 | fclose($f); |
@@ -3184,7 +3184,7 @@ discard block |
||
| 3184 | 3184 | */ |
| 3185 | 3185 | function _freadint($f) { |
| 3186 | 3186 | //Read a 4-byte integer from file |
| 3187 | - $a=unpack('Ni',fread($f,4)); |
|
| 3187 | + $a = unpack('Ni', fread($f, 4)); |
|
| 3188 | 3188 | return $a['i']; |
| 3189 | 3189 | } |
| 3190 | 3190 | |
@@ -3193,11 +3193,11 @@ discard block |
||
| 3193 | 3193 | * @access protected |
| 3194 | 3194 | */ |
| 3195 | 3195 | function _textstring($s) { |
| 3196 | - if($this->isunicode) { |
|
| 3196 | + if ($this->isunicode) { |
|
| 3197 | 3197 | //Convert string to UTF-16BE |
| 3198 | 3198 | $s = $this->UTF8ToUTF16BE($s, true); |
| 3199 | 3199 | } |
| 3200 | - return '('. $this->_escape($s).')'; |
|
| 3200 | + return '('.$this->_escape($s).')'; |
|
| 3201 | 3201 | } |
| 3202 | 3202 | |
| 3203 | 3203 | /** |
@@ -3205,7 +3205,7 @@ discard block |
||
| 3205 | 3205 | * @access protected |
| 3206 | 3206 | */ |
| 3207 | 3207 | function _escapetext($s) { |
| 3208 | - if($this->isunicode) { |
|
| 3208 | + if ($this->isunicode) { |
|
| 3209 | 3209 | //Convert string to UTF-16BE |
| 3210 | 3210 | $s = $this->UTF8ToUTF16BE($s, false); |
| 3211 | 3211 | } |
@@ -3236,7 +3236,7 @@ discard block |
||
| 3236 | 3236 | * @access protected |
| 3237 | 3237 | */ |
| 3238 | 3238 | function _out($s) { |
| 3239 | - if($this->state==2) { |
|
| 3239 | + if ($this->state == 2) { |
|
| 3240 | 3240 | $this->pages[$this->page] .= $s."\n"; |
| 3241 | 3241 | } |
| 3242 | 3242 | else { |
@@ -3272,7 +3272,7 @@ discard block |
||
| 3272 | 3272 | $this->_out('/BaseFont /'.$font['name'].''); |
| 3273 | 3273 | $this->_out('/CIDSystemInfo '.($this->n + 2).' 0 R'); |
| 3274 | 3274 | $this->_out('/FontDescriptor '.($this->n + 3).' 0 R'); |
| 3275 | - if (isset($font['desc']['MissingWidth'])){ |
|
| 3275 | + if (isset($font['desc']['MissingWidth'])) { |
|
| 3276 | 3276 | $this->_out('/DW '.$font['desc']['MissingWidth'].''); // The default width for glyphs in the CIDFont MissingWidth |
| 3277 | 3277 | } |
| 3278 | 3278 | $w = ""; |
@@ -3341,12 +3341,12 @@ discard block |
||
| 3341 | 3341 | // A specification of the mapping from CIDs to glyph indices |
| 3342 | 3342 | $this->_newobj(); |
| 3343 | 3343 | $ctgfile = $this->_getfontpath().$font['ctg']; |
| 3344 | - if(!file_exists($ctgfile)) { |
|
| 3344 | + if (!file_exists($ctgfile)) { |
|
| 3345 | 3345 | $this->Error('Font file not found: '.$ctgfile); |
| 3346 | 3346 | } |
| 3347 | 3347 | $size = filesize($ctgfile); |
| 3348 | 3348 | $this->_out('<</Length '.$size.''); |
| 3349 | - if(substr($ctgfile, -2) == '.z') { // check file extension |
|
| 3349 | + if (substr($ctgfile, -2) == '.z') { // check file extension |
|
| 3350 | 3350 | /* Decompresses data encoded using the public-domain |
| 3351 | 3351 | zlib/deflate compression method, reproducing the |
| 3352 | 3352 | original text or binary data */ |
@@ -3392,19 +3392,19 @@ discard block |
||
| 3392 | 3392 | * @since 1.53.0.TC005 (2005-01-05) |
| 3393 | 3393 | */ |
| 3394 | 3394 | function UTF8StringToArray($str) { |
| 3395 | - if(!$this->isunicode) { |
|
| 3395 | + if (!$this->isunicode) { |
|
| 3396 | 3396 | return $str; // string is not in unicode |
| 3397 | 3397 | } |
| 3398 | 3398 | $unicode = array(); // array containing unicode values |
| 3399 | - $bytes = array(); // array containing single character byte sequences |
|
| 3400 | - $numbytes = 1; // number of octetc needed to represent the UTF-8 character |
|
| 3399 | + $bytes = array(); // array containing single character byte sequences |
|
| 3400 | + $numbytes = 1; // number of octetc needed to represent the UTF-8 character |
|
| 3401 | 3401 | |
| 3402 | 3402 | $str .= ""; // force $str to be a string |
| 3403 | 3403 | $length = strlen($str); |
| 3404 | 3404 | |
| 3405 | - for($i = 0; $i < $length; $i++) { |
|
| 3405 | + for ($i = 0; $i < $length; $i++) { |
|
| 3406 | 3406 | $char = ord($str{$i}); // get one string character at time |
| 3407 | - if(count($bytes) == 0) { // get starting octect |
|
| 3407 | + if (count($bytes) == 0) { // get starting octect |
|
| 3408 | 3408 | if ($char <= 0x7F) { |
| 3409 | 3409 | $unicode[] = $char; // use the character "as is" because is ASCII |
| 3410 | 3410 | $numbytes = 1; |
@@ -3428,7 +3428,7 @@ discard block |
||
| 3428 | 3428 | if (count($bytes) == $numbytes) { |
| 3429 | 3429 | // compose UTF-8 bytes to a single unicode value |
| 3430 | 3430 | $char = $bytes[0]; |
| 3431 | - for($j = 1; $j < $numbytes; $j++) { |
|
| 3431 | + for ($j = 1; $j < $numbytes; $j++) { |
|
| 3432 | 3432 | $char += ($bytes[$j] << (($numbytes - $j - 1) * 0x06)); |
| 3433 | 3433 | } |
| 3434 | 3434 | if ((($char >= 0xD800) AND ($char <= 0xDFFF)) OR ($char >= 0x10FFFF)) { |
@@ -3493,8 +3493,8 @@ discard block |
||
| 3493 | 3493 | * @since 1.53.0.TC005 (2005-01-05) |
| 3494 | 3494 | * @uses UTF8StringToArray |
| 3495 | 3495 | */ |
| 3496 | - function UTF8ToUTF16BE($str, $setbom=true) { |
|
| 3497 | - if(!$this->isunicode) { |
|
| 3496 | + function UTF8ToUTF16BE($str, $setbom = true) { |
|
| 3497 | + if (!$this->isunicode) { |
|
| 3498 | 3498 | return $str; // string is not in unicode |
| 3499 | 3499 | } |
| 3500 | 3500 | $outstr = ""; // string to be returned |
@@ -3504,8 +3504,8 @@ discard block |
||
| 3504 | 3504 | if ($setbom) { |
| 3505 | 3505 | $outstr .= "\xFE\xFF"; // Byte Order Mark (BOM) |
| 3506 | 3506 | } |
| 3507 | - foreach($unicode as $char) { |
|
| 3508 | - if($char == 0xFFFD) { |
|
| 3507 | + foreach ($unicode as $char) { |
|
| 3508 | + if ($char == 0xFFFD) { |
|
| 3509 | 3509 | $outstr .= "\xFF\xFD"; // replacement character |
| 3510 | 3510 | } elseif ($char < 0x10000) { |
| 3511 | 3511 | $outstr .= chr($char >> 0x08); |
@@ -3556,7 +3556,7 @@ discard block |
||
| 3556 | 3556 | * Set document barcode. |
| 3557 | 3557 | * @param string $bc barcode |
| 3558 | 3558 | */ |
| 3559 | - function setBarcode($bc="") { |
|
| 3559 | + function setBarcode($bc = "") { |
|
| 3560 | 3560 | $this->barcode = $bc; |
| 3561 | 3561 | } |
| 3562 | 3562 | |
@@ -3593,8 +3593,8 @@ discard block |
||
| 3593 | 3593 | //$style |= BCS_STRETCH_TEXT; |
| 3594 | 3594 | //$style |= BCS_REVERSE_COLOR; |
| 3595 | 3595 | } |
| 3596 | - if (empty($font)) {$font = BCD_DEFAULT_FONT;} |
|
| 3597 | - if (empty($xres)) {$xres = BCD_DEFAULT_XRES;} |
|
| 3596 | + if (empty($font)) {$font = BCD_DEFAULT_FONT; } |
|
| 3597 | + if (empty($xres)) {$xres = BCD_DEFAULT_XRES; } |
|
| 3598 | 3598 | |
| 3599 | 3599 | $scale_factor = 1.5 * $xres * $this->k; |
| 3600 | 3600 | $bc_w = round($w * $scale_factor); //width in points |
@@ -3628,7 +3628,7 @@ discard block |
||
| 3628 | 3628 | $obj->DrawObject($xres); |
| 3629 | 3629 | |
| 3630 | 3630 | //use a temporary file.... |
| 3631 | - $tmpName = tempnam(K_PATH_CACHE,'img'); |
|
| 3631 | + $tmpName = tempnam(K_PATH_CACHE, 'img'); |
|
| 3632 | 3632 | imagepng($obj->getImage(), $tmpName); |
| 3633 | 3633 | $this->Image($tmpName, $x, $y, $w, $h, 'png'); |
| 3634 | 3634 | $obj->DestroyObject(); |
@@ -3640,7 +3640,7 @@ discard block |
||
| 3640 | 3640 | * Returns the PDF data. |
| 3641 | 3641 | */ |
| 3642 | 3642 | function getPDFData() { |
| 3643 | - if($this->state < 3) { |
|
| 3643 | + if ($this->state < 3) { |
|
| 3644 | 3644 | $this->Close(); |
| 3645 | 3645 | } |
| 3646 | 3646 | return $this->buffer; |
@@ -3655,10 +3655,10 @@ discard block |
||
| 3655 | 3655 | * @param boolean $ln if true add a new line after text (default = true) |
| 3656 | 3656 | * @param int $fill Indicates if the background must be painted (1) or transparent (0). Default value: 0. |
| 3657 | 3657 | */ |
| 3658 | - function writeHTML($html, $ln=true, $fill=0) { |
|
| 3658 | + function writeHTML($html, $ln = true, $fill = 0) { |
|
| 3659 | 3659 | |
| 3660 | 3660 | // store some variables |
| 3661 | - $html=strip_tags($html,"<h1><h2><h3><h4><h5><h6><b><u><i><a><img><p><br><br/><strong><em><font><blockquote><li><ul><ol><hr><td><th><tr><table><sup><sub><small>"); //remove all unsupported tags |
|
| 3661 | + $html = strip_tags($html, "<h1><h2><h3><h4><h5><h6><b><u><i><a><img><p><br><br/><strong><em><font><blockquote><li><ul><ol><hr><td><th><tr><table><sup><sub><small>"); //remove all unsupported tags |
|
| 3662 | 3662 | //replace carriage returns, newlines and tabs |
| 3663 | 3663 | $repTable = array("\t" => " ", "\n" => " ", "\r" => " ", "\0" => " ", "\x0B" => " "); |
| 3664 | 3664 | $html = strtr($html, $repTable); |
@@ -3670,17 +3670,17 @@ discard block |
||
| 3670 | 3670 | $this->lasth = $this->FontSize * K_CELL_HEIGHT_RATIO; |
| 3671 | 3671 | } |
| 3672 | 3672 | |
| 3673 | - foreach($a as $key=>$element) { |
|
| 3673 | + foreach ($a as $key=>$element) { |
|
| 3674 | 3674 | if (!preg_match($pattern, $element)) { |
| 3675 | 3675 | //Text |
| 3676 | - if($this->HREF) { |
|
| 3676 | + if ($this->HREF) { |
|
| 3677 | 3677 | $this->addHtmlLink($this->HREF, $element, $fill); |
| 3678 | 3678 | } |
| 3679 | - elseif($this->tdbegin) { |
|
| 3680 | - if((strlen(trim($element)) > 0) AND ($element != " ")) { |
|
| 3679 | + elseif ($this->tdbegin) { |
|
| 3680 | + if ((strlen(trim($element)) > 0) AND ($element != " ")) { |
|
| 3681 | 3681 | $this->Cell($this->tdwidth, $this->tdheight, $this->unhtmlentities($element), $this->tableborder, '', $this->tdalign, $this->tdbgcolor); |
| 3682 | 3682 | } |
| 3683 | - elseif($element == " ") { |
|
| 3683 | + elseif ($element == " ") { |
|
| 3684 | 3684 | $this->Cell($this->tdwidth, $this->tdheight, '', $this->tableborder, '', $this->tdalign, $this->tdbgcolor); |
| 3685 | 3685 | } |
| 3686 | 3686 | } |
@@ -3691,7 +3691,7 @@ discard block |
||
| 3691 | 3691 | else { |
| 3692 | 3692 | $element = substr($element, 1, -1); |
| 3693 | 3693 | //Tag |
| 3694 | - if($element{0}=='/') { |
|
| 3694 | + if ($element{0} == '/') { |
|
| 3695 | 3695 | $this->closedHTMLTagHandler(strtolower(substr($element, 1))); |
| 3696 | 3696 | } |
| 3697 | 3697 | else { |
@@ -3702,7 +3702,7 @@ discard block |
||
| 3702 | 3702 | // get attributes |
| 3703 | 3703 | preg_match_all('/([^=\s]*)=["\']?([^"\']*)["\']?/', $element, $attr_array, PREG_PATTERN_ORDER); |
| 3704 | 3704 | $attr = array(); // reset attribute array |
| 3705 | - while(list($id,$name)=each($attr_array[1])) { |
|
| 3705 | + while (list($id, $name) = each($attr_array[1])) { |
|
| 3706 | 3706 | $attr[strtolower($name)] = $attr_array[2][$id]; |
| 3707 | 3707 | } |
| 3708 | 3708 | $this->openHTMLTagHandler($tag, $attr, $fill); |
@@ -3728,7 +3728,7 @@ discard block |
||
| 3728 | 3728 | * @param int $fill Indicates if the cell background must be painted (1) or transparent (0). Default value: 0. |
| 3729 | 3729 | * @see Cell() |
| 3730 | 3730 | */ |
| 3731 | - function writeHTMLCell($w, $h, $x, $y, $html='', $border=0, $ln=0, $fill=0) { |
|
| 3731 | + function writeHTMLCell($w, $h, $x, $y, $html = '', $border = 0, $ln = 0, $fill = 0) { |
|
| 3732 | 3732 | |
| 3733 | 3733 | if (empty($this->lasth)) { |
| 3734 | 3734 | //set row height |
@@ -3748,7 +3748,7 @@ discard block |
||
| 3748 | 3748 | $this->SetX($x); |
| 3749 | 3749 | $this->SetY($y); |
| 3750 | 3750 | |
| 3751 | - if(empty($w)) { |
|
| 3751 | + if (empty($w)) { |
|
| 3752 | 3752 | $w = $this->fw - $x - $this->rMargin; |
| 3753 | 3753 | } |
| 3754 | 3754 | |
@@ -3765,7 +3765,7 @@ discard block |
||
| 3765 | 3765 | |
| 3766 | 3766 | $this->writeHTML($html, true, $fill); // write html text |
| 3767 | 3767 | |
| 3768 | - $currentY = $this->GetY(); |
|
| 3768 | + $currentY = $this->GetY(); |
|
| 3769 | 3769 | |
| 3770 | 3770 | // check if a new page has been created |
| 3771 | 3771 | if ($this->page > $pagenum) { |
@@ -3803,9 +3803,9 @@ discard block |
||
| 3803 | 3803 | * @param int $fill Indicates if the cell background must be painted (1) or transparent (0). Default value: 0. |
| 3804 | 3804 | * @access private |
| 3805 | 3805 | */ |
| 3806 | - function openHTMLTagHandler($tag, $attr, $fill=0) { |
|
| 3806 | + function openHTMLTagHandler($tag, $attr, $fill = 0) { |
|
| 3807 | 3807 | //Opening tag |
| 3808 | - switch($tag) { |
|
| 3808 | + switch ($tag) { |
|
| 3809 | 3809 | case 'table': { |
| 3810 | 3810 | if ((isset($attr['border'])) AND ($attr['border'] != '')) { |
| 3811 | 3811 | $this->tableborder = $attr['border']; |
@@ -3821,13 +3821,13 @@ discard block |
||
| 3821 | 3821 | case 'td': |
| 3822 | 3822 | case 'th': { |
| 3823 | 3823 | if ((isset($attr['width'])) AND ($attr['width'] != '')) { |
| 3824 | - $this->tdwidth = ($attr['width']/4); |
|
| 3824 | + $this->tdwidth = ($attr['width'] / 4); |
|
| 3825 | 3825 | } |
| 3826 | 3826 | else { |
| 3827 | 3827 | $this->tdwidth = (($this->w - $this->lMargin - $this->rMargin) / $this->default_table_columns); |
| 3828 | 3828 | } |
| 3829 | 3829 | if ((isset($attr['height'])) AND ($attr['height'] != '')) { |
| 3830 | - $this->tdheight=($attr['height'] / $this->k); |
|
| 3830 | + $this->tdheight = ($attr['height'] / $this->k); |
|
| 3831 | 3831 | } |
| 3832 | 3832 | else { |
| 3833 | 3833 | $this->tdheight = $this->lasth; |
@@ -3852,9 +3852,9 @@ discard block |
||
| 3852 | 3852 | if ((isset($attr['bgcolor'])) AND ($attr['bgcolor'] != '')) { |
| 3853 | 3853 | $coul = $this->convertColorHexToDec($attr['bgcolor']); |
| 3854 | 3854 | $this->SetFillColor($coul['R'], $coul['G'], $coul['B']); |
| 3855 | - $this->tdbgcolor=true; |
|
| 3855 | + $this->tdbgcolor = true; |
|
| 3856 | 3856 | } |
| 3857 | - $this->tdbegin=true; |
|
| 3857 | + $this->tdbegin = true; |
|
| 3858 | 3858 | break; |
| 3859 | 3859 | } |
| 3860 | 3860 | case 'hr': { |
@@ -3892,17 +3892,17 @@ discard block |
||
| 3892 | 3892 | break; |
| 3893 | 3893 | } |
| 3894 | 3894 | case 'img': { |
| 3895 | - if(isset($attr['src'])) { |
|
| 3895 | + if (isset($attr['src'])) { |
|
| 3896 | 3896 | // replace relative path with real server path |
| 3897 | 3897 | $attr['src'] = str_replace(K_PATH_URL_CACHE, K_PATH_CACHE, $attr['src']); |
| 3898 | - if(!isset($attr['width'])) { |
|
| 3898 | + if (!isset($attr['width'])) { |
|
| 3899 | 3899 | $attr['width'] = 0; |
| 3900 | 3900 | } |
| 3901 | - if(!isset($attr['height'])) { |
|
| 3901 | + if (!isset($attr['height'])) { |
|
| 3902 | 3902 | $attr['height'] = 0; |
| 3903 | 3903 | } |
| 3904 | 3904 | |
| 3905 | - $this->Image($attr['src'], $this->GetX(),$this->GetY(), $this->pixelsToMillimeters($attr['width']), $this->pixelsToMillimeters($attr['height'])); |
|
| 3905 | + $this->Image($attr['src'], $this->GetX(), $this->GetY(), $this->pixelsToMillimeters($attr['width']), $this->pixelsToMillimeters($attr['height'])); |
|
| 3906 | 3906 | //$this->SetX($this->img_rb_x); |
| 3907 | 3907 | $this->SetY($this->img_rb_y); |
| 3908 | 3908 | |
@@ -3934,7 +3934,7 @@ discard block |
||
| 3934 | 3934 | case 'blockquote': |
| 3935 | 3935 | case 'br': { |
| 3936 | 3936 | $this->Ln(); |
| 3937 | - if(strlen($this->lispacer) > 0) { |
|
| 3937 | + if (strlen($this->lispacer) > 0) { |
|
| 3938 | 3938 | $this->x += $this->GetStringWidth($this->lispacer); |
| 3939 | 3939 | } |
| 3940 | 3940 | break; |
@@ -3948,32 +3948,32 @@ discard block |
||
| 3948 | 3948 | $currentFontSize = $this->FontSize; |
| 3949 | 3949 | $this->tempfontsize = $this->FontSizePt; |
| 3950 | 3950 | $this->SetFontSize($this->FontSizePt * K_SMALL_RATIO); |
| 3951 | - $this->SetXY($this->GetX(), $this->GetY() - (($currentFontSize - $this->FontSize)*(K_SMALL_RATIO))); |
|
| 3951 | + $this->SetXY($this->GetX(), $this->GetY() - (($currentFontSize - $this->FontSize) * (K_SMALL_RATIO))); |
|
| 3952 | 3952 | break; |
| 3953 | 3953 | } |
| 3954 | 3954 | case 'sub': { |
| 3955 | 3955 | $currentFontSize = $this->FontSize; |
| 3956 | 3956 | $this->tempfontsize = $this->FontSizePt; |
| 3957 | 3957 | $this->SetFontSize($this->FontSizePt * K_SMALL_RATIO); |
| 3958 | - $this->SetXY($this->GetX(), $this->GetY() + (($currentFontSize - $this->FontSize)*(K_SMALL_RATIO))); |
|
| 3958 | + $this->SetXY($this->GetX(), $this->GetY() + (($currentFontSize - $this->FontSize) * (K_SMALL_RATIO))); |
|
| 3959 | 3959 | break; |
| 3960 | 3960 | } |
| 3961 | 3961 | case 'small': { |
| 3962 | 3962 | $currentFontSize = $this->FontSize; |
| 3963 | 3963 | $this->tempfontsize = $this->FontSizePt; |
| 3964 | 3964 | $this->SetFontSize($this->FontSizePt * K_SMALL_RATIO); |
| 3965 | - $this->SetXY($this->GetX(), $this->GetY() + (($currentFontSize - $this->FontSize)/3)); |
|
| 3965 | + $this->SetXY($this->GetX(), $this->GetY() + (($currentFontSize - $this->FontSize) / 3)); |
|
| 3966 | 3966 | break; |
| 3967 | 3967 | } |
| 3968 | 3968 | case 'font': { |
| 3969 | - if (isset($attr['color']) AND $attr['color']!='') { |
|
| 3969 | + if (isset($attr['color']) AND $attr['color'] != '') { |
|
| 3970 | 3970 | $coul = $this->convertColorHexToDec($attr['color']); |
| 3971 | - $this->SetTextColor($coul['R'],$coul['G'],$coul['B']); |
|
| 3972 | - $this->issetcolor=true; |
|
| 3971 | + $this->SetTextColor($coul['R'], $coul['G'], $coul['B']); |
|
| 3972 | + $this->issetcolor = true; |
|
| 3973 | 3973 | } |
| 3974 | 3974 | if (isset($attr['face']) and in_array(strtolower($attr['face']), $this->fontlist)) { |
| 3975 | 3975 | $this->SetFont(strtolower($attr['face'])); |
| 3976 | - $this->issetfont=true; |
|
| 3976 | + $this->issetfont = true; |
|
| 3977 | 3977 | } |
| 3978 | 3978 | if (isset($attr['size'])) { |
| 3979 | 3979 | $headsize = intval($attr['size']); |
@@ -4010,7 +4010,7 @@ discard block |
||
| 4010 | 4010 | */ |
| 4011 | 4011 | function closedHTMLTagHandler($tag) { |
| 4012 | 4012 | //Closing tag |
| 4013 | - switch($tag) { |
|
| 4013 | + switch ($tag) { |
|
| 4014 | 4014 | case 'td': |
| 4015 | 4015 | case 'th': { |
| 4016 | 4016 | $this->tdbegin = false; |
@@ -4026,7 +4026,7 @@ discard block |
||
| 4026 | 4026 | break; |
| 4027 | 4027 | } |
| 4028 | 4028 | case 'table': { |
| 4029 | - $this->tableborder=0; |
|
| 4029 | + $this->tableborder = 0; |
|
| 4030 | 4030 | break; |
| 4031 | 4031 | } |
| 4032 | 4032 | case 'strong': { |
@@ -4051,21 +4051,21 @@ discard block |
||
| 4051 | 4051 | $currentFontSize = $this->FontSize; |
| 4052 | 4052 | $this->SetFontSize($this->tempfontsize); |
| 4053 | 4053 | $this->tempfontsize = $this->FontSizePt; |
| 4054 | - $this->SetXY($this->GetX(), $this->GetY() - (($currentFontSize - $this->FontSize)*(K_SMALL_RATIO))); |
|
| 4054 | + $this->SetXY($this->GetX(), $this->GetY() - (($currentFontSize - $this->FontSize) * (K_SMALL_RATIO))); |
|
| 4055 | 4055 | break; |
| 4056 | 4056 | } |
| 4057 | 4057 | case 'sub': { |
| 4058 | 4058 | $currentFontSize = $this->FontSize; |
| 4059 | 4059 | $this->SetFontSize($this->tempfontsize); |
| 4060 | 4060 | $this->tempfontsize = $this->FontSizePt; |
| 4061 | - $this->SetXY($this->GetX(), $this->GetY() + (($currentFontSize - $this->FontSize)*(K_SMALL_RATIO))); |
|
| 4061 | + $this->SetXY($this->GetX(), $this->GetY() + (($currentFontSize - $this->FontSize) * (K_SMALL_RATIO))); |
|
| 4062 | 4062 | break; |
| 4063 | 4063 | } |
| 4064 | 4064 | case 'small': { |
| 4065 | 4065 | $currentFontSize = $this->FontSize; |
| 4066 | 4066 | $this->SetFontSize($this->tempfontsize); |
| 4067 | 4067 | $this->tempfontsize = $this->FontSizePt; |
| 4068 | - $this->SetXY($this->GetX(), $this->GetY() - (($this->FontSize - $currentFontSize)/3)); |
|
| 4068 | + $this->SetXY($this->GetX(), $this->GetY() - (($this->FontSize - $currentFontSize) / 3)); |
|
| 4069 | 4069 | break; |
| 4070 | 4070 | } |
| 4071 | 4071 | case 'font': { |
@@ -4126,9 +4126,9 @@ discard block |
||
| 4126 | 4126 | function setStyle($tag, $enable) { |
| 4127 | 4127 | //Modify style and select corresponding font |
| 4128 | 4128 | $this->$tag += ($enable ? 1 : -1); |
| 4129 | - $style=''; |
|
| 4130 | - foreach(array('b', 'i', 'u') as $s) { |
|
| 4131 | - if($this->$s > 0) { |
|
| 4129 | + $style = ''; |
|
| 4130 | + foreach (array('b', 'i', 'u') as $s) { |
|
| 4131 | + if ($this->$s > 0) { |
|
| 4132 | 4132 | $style .= $s; |
| 4133 | 4133 | } |
| 4134 | 4134 | } |
@@ -4142,7 +4142,7 @@ discard block |
||
| 4142 | 4142 | * @param int $fill Indicates if the cell background must be painted (1) or transparent (0). Default value: 0. |
| 4143 | 4143 | * @access public |
| 4144 | 4144 | */ |
| 4145 | - function addHtmlLink($url, $name, $fill=0) { |
|
| 4145 | + function addHtmlLink($url, $name, $fill = 0) { |
|
| 4146 | 4146 | //Put a hyperlink |
| 4147 | 4147 | $this->SetTextColor(0, 0, 255); |
| 4148 | 4148 | $this->setStyle('u', true); |
@@ -4158,7 +4158,7 @@ discard block |
||
| 4158 | 4158 | * @return array |
| 4159 | 4159 | * @access private |
| 4160 | 4160 | */ |
| 4161 | - function convertColorHexToDec($color = "#000000"){ |
|
| 4161 | + function convertColorHexToDec($color = "#000000") { |
|
| 4162 | 4162 | $tbl_color = array(); |
| 4163 | 4163 | $tbl_color['R'] = hexdec(substr($color, 1, 2)); |
| 4164 | 4164 | $tbl_color['G'] = hexdec(substr($color, 3, 2)); |
@@ -4172,7 +4172,7 @@ discard block |
||
| 4172 | 4172 | * @return float millimeters |
| 4173 | 4173 | * @access private |
| 4174 | 4174 | */ |
| 4175 | - function pixelsToMillimeters($px){ |
|
| 4175 | + function pixelsToMillimeters($px) { |
|
| 4176 | 4176 | return $px * 25.4 / 72; |
| 4177 | 4177 | } |
| 4178 | 4178 | |
@@ -4190,7 +4190,7 @@ discard block |
||
| 4190 | 4190 | } // END OF CLASS |
| 4191 | 4191 | |
| 4192 | 4192 | //Handle special IE contype request |
| 4193 | - if(isset($_SERVER['HTTP_USER_AGENT']) AND ($_SERVER['HTTP_USER_AGENT']=='contype')) { |
|
| 4193 | + if (isset($_SERVER['HTTP_USER_AGENT']) AND ($_SERVER['HTTP_USER_AGENT'] == 'contype')) { |
|
| 4194 | 4194 | header('Content-Type: application/pdf'); |
| 4195 | 4195 | exit; |
| 4196 | 4196 | } |
@@ -854,8 +854,7 @@ discard block |
||
| 854 | 854 | } |
| 855 | 855 | $this->fwPt=$format[0]; |
| 856 | 856 | $this->fhPt=$format[1]; |
| 857 | - } |
|
| 858 | - else { |
|
| 857 | + } else { |
|
| 859 | 858 | $this->fwPt=$format[0]*$this->k; |
| 860 | 859 | $this->fhPt=$format[1]*$this->k; |
| 861 | 860 | } |
@@ -869,13 +868,11 @@ discard block |
||
| 869 | 868 | $this->DefOrientation='P'; |
| 870 | 869 | $this->wPt=$this->fwPt; |
| 871 | 870 | $this->hPt=$this->fhPt; |
| 872 | - } |
|
| 873 | - elseif($orientation=='l' or $orientation=='landscape') { |
|
| 871 | + } elseif($orientation=='l' or $orientation=='landscape') { |
|
| 874 | 872 | $this->DefOrientation='L'; |
| 875 | 873 | $this->wPt=$this->fhPt; |
| 876 | 874 | $this->hPt=$this->fwPt; |
| 877 | - } |
|
| 878 | - else { |
|
| 875 | + } else { |
|
| 879 | 876 | $this->Error('Incorrect orientation: '.$orientation); |
| 880 | 877 | } |
| 881 | 878 | |
@@ -1055,14 +1052,12 @@ discard block |
||
| 1055 | 1052 | //Set display mode in viewer |
| 1056 | 1053 | if($zoom=='fullpage' or $zoom=='fullwidth' or $zoom=='real' or $zoom=='default' or !is_string($zoom)) { |
| 1057 | 1054 | $this->ZoomMode=$zoom; |
| 1058 | - } |
|
| 1059 | - else { |
|
| 1055 | + } else { |
|
| 1060 | 1056 | $this->Error('Incorrect zoom display mode: '.$zoom); |
| 1061 | 1057 | } |
| 1062 | 1058 | if($layout=='single' or $layout=='continuous' or $layout=='two' or $layout=='default') { |
| 1063 | 1059 | $this->LayoutMode=$layout; |
| 1064 | - } |
|
| 1065 | - else { |
|
| 1060 | + } else { |
|
| 1066 | 1061 | $this->Error('Incorrect layout display mode: '.$layout); |
| 1067 | 1062 | } |
| 1068 | 1063 | } |
@@ -1077,8 +1072,7 @@ discard block |
||
| 1077 | 1072 | //Set page compression |
| 1078 | 1073 | if(function_exists('gzcompress')) { |
| 1079 | 1074 | $this->compress=$compress; |
| 1080 | - } |
|
| 1081 | - else { |
|
| 1075 | + } else { |
|
| 1082 | 1076 | $this->compress=false; |
| 1083 | 1077 | } |
| 1084 | 1078 | } |
@@ -1353,8 +1347,7 @@ discard block |
||
| 1353 | 1347 | |
| 1354 | 1348 | if (($this->header_logo) AND ($this->header_logo != K_BLANK_IMAGE)) { |
| 1355 | 1349 | $this->Image(K_PATH_IMAGES.$this->header_logo, $this->original_lMargin, $this->header_margin, $this->header_logo_width); |
| 1356 | - } |
|
| 1357 | - else { |
|
| 1350 | + } else { |
|
| 1358 | 1351 | $this->img_rb_y = $this->GetY(); |
| 1359 | 1352 | } |
| 1360 | 1353 | |
@@ -1451,8 +1444,7 @@ discard block |
||
| 1451 | 1444 | //Set color for all stroking operations |
| 1452 | 1445 | if(($r==0 and $g==0 and $b==0) or $g==-1) { |
| 1453 | 1446 | $this->DrawColor=sprintf('%.3f G',$r/255); |
| 1454 | - } |
|
| 1455 | - else { |
|
| 1447 | + } else { |
|
| 1456 | 1448 | $this->DrawColor=sprintf('%.3f %.3f %.3f RG',$r/255,$g/255,$b/255); |
| 1457 | 1449 | } |
| 1458 | 1450 | if($this->page>0) { |
@@ -1473,8 +1465,7 @@ discard block |
||
| 1473 | 1465 | //Set color for all filling operations |
| 1474 | 1466 | if(($r==0 and $g==0 and $b==0) or $g==-1) { |
| 1475 | 1467 | $this->FillColor=sprintf('%.3f g',$r/255); |
| 1476 | - } |
|
| 1477 | - else { |
|
| 1468 | + } else { |
|
| 1478 | 1469 | $this->FillColor=sprintf('%.3f %.3f %.3f rg',$r/255,$g/255,$b/255); |
| 1479 | 1470 | } |
| 1480 | 1471 | $this->ColorFlag=($this->FillColor!=$this->TextColor); |
@@ -1500,8 +1491,7 @@ discard block |
||
| 1500 | 1491 | //Set color for text |
| 1501 | 1492 | if(($r==0 and $g==0 and $b==0) or $g==-1) { |
| 1502 | 1493 | $this->TextColor=sprintf('%.3f g',$r/255); |
| 1503 | - } |
|
| 1504 | - else { |
|
| 1494 | + } else { |
|
| 1505 | 1495 | $this->TextColor=sprintf('%.3f %.3f %.3f rg',$r/255,$g/255,$b/255); |
| 1506 | 1496 | } |
| 1507 | 1497 | $this->ColorFlag=($this->FillColor!=$this->TextColor); |
@@ -1593,11 +1583,9 @@ discard block |
||
| 1593 | 1583 | //Draw a rectangle |
| 1594 | 1584 | if($style=='F') { |
| 1595 | 1585 | $op='f'; |
| 1596 | - } |
|
| 1597 | - elseif($style=='FD' or $style=='DF') { |
|
| 1586 | + } elseif($style=='FD' or $style=='DF') { |
|
| 1598 | 1587 | $op='B'; |
| 1599 | - } |
|
| 1600 | - else { |
|
| 1588 | + } else { |
|
| 1601 | 1589 | $op='S'; |
| 1602 | 1590 | } |
| 1603 | 1591 | $this->_out(sprintf('%.2f %.2f %.2f %.2f re %s',$x*$this->k,($this->h-$y)*$this->k,$w*$this->k,-$h*$this->k,$op)); |
@@ -1683,8 +1671,7 @@ discard block |
||
| 1683 | 1671 | if(!empty($file)) { |
| 1684 | 1672 | if((strcasecmp($type,"TrueType") == 0) OR (strcasecmp($type,"TrueTypeUnicode") == 0)) { |
| 1685 | 1673 | $this->FontFiles[$file]=array('length1'=>$originalsize); |
| 1686 | - } |
|
| 1687 | - else { |
|
| 1674 | + } else { |
|
| 1688 | 1675 | $this->FontFiles[$file]=array('length1'=>$size1,'length2'=>$size2); |
| 1689 | 1676 | } |
| 1690 | 1677 | } |
@@ -1731,8 +1718,7 @@ discard block |
||
| 1731 | 1718 | } |
| 1732 | 1719 | if((!$this->isunicode) AND ($family == 'arial')) { |
| 1733 | 1720 | $family = 'helvetica'; |
| 1734 | - } |
|
| 1735 | - elseif(($family=="symbol") OR ($family=="zapfdingbats")) { |
|
| 1721 | + } elseif(($family=="symbol") OR ($family=="zapfdingbats")) { |
|
| 1736 | 1722 | $style=''; |
| 1737 | 1723 | } |
| 1738 | 1724 | $style=strtoupper($style); |
@@ -1740,8 +1726,7 @@ discard block |
||
| 1740 | 1726 | if(strpos($style,'U')!==false) { |
| 1741 | 1727 | $this->underline=true; |
| 1742 | 1728 | $style=str_replace('U','',$style); |
| 1743 | - } |
|
| 1744 | - else { |
|
| 1729 | + } else { |
|
| 1745 | 1730 | $this->underline=false; |
| 1746 | 1731 | } |
| 1747 | 1732 | if($style=='IB') { |
@@ -1794,8 +1779,7 @@ discard block |
||
| 1794 | 1779 | } else { |
| 1795 | 1780 | $this->fonts[$fontkey]=array('i'=>$i, 'type'=>'core', 'name'=>$this->CoreFonts[$fontkey], 'up'=>-100, 'ut'=>50, 'cw'=>$fpdf_charwidths[$fontkey]); |
| 1796 | 1781 | } |
| 1797 | - } |
|
| 1798 | - else { |
|
| 1782 | + } else { |
|
| 1799 | 1783 | $this->Error('Undefined font: '.$family.' '.$style); |
| 1800 | 1784 | } |
| 1801 | 1785 | } |
@@ -1985,8 +1969,7 @@ discard block |
||
| 1985 | 1969 | if(($fill == 1) OR ($border == 1)) { |
| 1986 | 1970 | if($fill == 1) { |
| 1987 | 1971 | $op = ($border == 1) ? 'B' : 'f'; |
| 1988 | - } |
|
| 1989 | - else { |
|
| 1972 | + } else { |
|
| 1990 | 1973 | $op = 'S'; |
| 1991 | 1974 | } |
| 1992 | 1975 | $s = sprintf('%.2f %.2f %.2f %.2f re %s ', $this->x * $k, ($this->h - $this->y) * $k, $w * $k, -$h * $k, $op); |
@@ -2011,11 +1994,9 @@ discard block |
||
| 2011 | 1994 | $width = $this->GetStringWidth($txt); |
| 2012 | 1995 | if($align == 'R') { |
| 2013 | 1996 | $dx = $w - $this->cMargin - $width; |
| 2014 | - } |
|
| 2015 | - elseif($align=='C') { |
|
| 1997 | + } elseif($align=='C') { |
|
| 2016 | 1998 | $dx = ($w - $width)/2; |
| 2017 | - } |
|
| 2018 | - else { |
|
| 1999 | + } else { |
|
| 2019 | 2000 | $dx = $this->cMargin; |
| 2020 | 2001 | } |
| 2021 | 2002 | if($this->ColorFlag) { |
@@ -2043,8 +2024,7 @@ discard block |
||
| 2043 | 2024 | if($ln == 1) { |
| 2044 | 2025 | $this->x = $this->lMargin; |
| 2045 | 2026 | } |
| 2046 | - } |
|
| 2047 | - else { |
|
| 2027 | + } else { |
|
| 2048 | 2028 | $this->x += $w; |
| 2049 | 2029 | } |
| 2050 | 2030 | } |
@@ -2086,8 +2066,7 @@ discard block |
||
| 2086 | 2066 | $border='LTRB'; |
| 2087 | 2067 | $b='LRT'; |
| 2088 | 2068 | $b2='LR'; |
| 2089 | - } |
|
| 2090 | - else { |
|
| 2069 | + } else { |
|
| 2091 | 2070 | $b2=''; |
| 2092 | 2071 | if(strpos($border,'L')!==false) { |
| 2093 | 2072 | $b2.='L'; |
@@ -2144,8 +2123,7 @@ discard block |
||
| 2144 | 2123 | $this->_out('0 Tw'); |
| 2145 | 2124 | } |
| 2146 | 2125 | $this->Cell($w, $h, substr($s, $j, $i-$j), $b, 2, $align, $fill); |
| 2147 | - } |
|
| 2148 | - else { |
|
| 2126 | + } else { |
|
| 2149 | 2127 | if($align=='J') { |
| 2150 | 2128 | $this->ws = ($ns>1) ? ($wmax-$ls)/($ns-1) : 0; |
| 2151 | 2129 | $this->_out(sprintf('%.3f Tw', $this->ws * $this->k)); |
@@ -2161,8 +2139,7 @@ discard block |
||
| 2161 | 2139 | if($border AND ($nl==2)) { |
| 2162 | 2140 | $b=$b2; |
| 2163 | 2141 | } |
| 2164 | - } |
|
| 2165 | - else { |
|
| 2142 | + } else { |
|
| 2166 | 2143 | $i++; |
| 2167 | 2144 | } |
| 2168 | 2145 | } |
@@ -2272,8 +2249,7 @@ discard block |
||
| 2272 | 2249 | $i++; |
| 2273 | 2250 | } |
| 2274 | 2251 | $this->Cell($w, $h, substr($s, $j, $i-$j), 0, 2, '', $fill, $link); |
| 2275 | - } |
|
| 2276 | - else { |
|
| 2252 | + } else { |
|
| 2277 | 2253 | $this->Cell($w, $h, substr($s, $j, $sep-$j), 0, 2, '', $fill, $link); |
| 2278 | 2254 | $i=$sep+1; |
| 2279 | 2255 | } |
@@ -2286,8 +2262,7 @@ discard block |
||
| 2286 | 2262 | $wmax = ($w - 2 * $this->cMargin); |
| 2287 | 2263 | } |
| 2288 | 2264 | $nl++; |
| 2289 | - } |
|
| 2290 | - else { |
|
| 2265 | + } else { |
|
| 2291 | 2266 | $i++; |
| 2292 | 2267 | } |
| 2293 | 2268 | } |
@@ -2334,11 +2309,9 @@ discard block |
||
| 2334 | 2309 | set_magic_quotes_runtime(0); |
| 2335 | 2310 | if($type == 'jpg' or $type == 'jpeg') { |
| 2336 | 2311 | $info=$this->_parsejpg($file); |
| 2337 | - } |
|
| 2338 | - elseif($type == 'png') { |
|
| 2312 | + } elseif($type == 'png') { |
|
| 2339 | 2313 | $info=$this->_parsepng($file); |
| 2340 | - } |
|
| 2341 | - else { |
|
| 2314 | + } else { |
|
| 2342 | 2315 | //Allow for additional formats |
| 2343 | 2316 | $mtd='_parse'.$type; |
| 2344 | 2317 | if(!method_exists($this,$mtd)) { |
@@ -2349,8 +2322,7 @@ discard block |
||
| 2349 | 2322 | set_magic_quotes_runtime($mqr); |
| 2350 | 2323 | $info['i']=count($this->images)+1; |
| 2351 | 2324 | $this->images[$file]=$info; |
| 2352 | - } |
|
| 2353 | - else { |
|
| 2325 | + } else { |
|
| 2354 | 2326 | $info=$this->images[$file]; |
| 2355 | 2327 | } |
| 2356 | 2328 | //Automatic width and height calculation if needed |
@@ -2388,8 +2360,7 @@ discard block |
||
| 2388 | 2360 | $this->x=$this->lMargin; |
| 2389 | 2361 | if(is_string($h)) { |
| 2390 | 2362 | $this->y+=$this->lasth; |
| 2391 | - } |
|
| 2392 | - else { |
|
| 2363 | + } else { |
|
| 2393 | 2364 | $this->y+=$h; |
| 2394 | 2365 | } |
| 2395 | 2366 | } |
@@ -2415,8 +2386,7 @@ discard block |
||
| 2415 | 2386 | //Set x position |
| 2416 | 2387 | if($x>=0) { |
| 2417 | 2388 | $this->x=$x; |
| 2418 | - } |
|
| 2419 | - else { |
|
| 2389 | + } else { |
|
| 2420 | 2390 | $this->x=$this->w+$x; |
| 2421 | 2391 | } |
| 2422 | 2392 | } |
@@ -2443,8 +2413,7 @@ discard block |
||
| 2443 | 2413 | $this->x=$this->lMargin; |
| 2444 | 2414 | if($y>=0) { |
| 2445 | 2415 | $this->y=$y; |
| 2446 | - } |
|
| 2447 | - else { |
|
| 2416 | + } else { |
|
| 2448 | 2417 | $this->y=$this->h+$y; |
| 2449 | 2418 | } |
| 2450 | 2419 | } |
@@ -2600,8 +2569,7 @@ discard block |
||
| 2600 | 2569 | if($this->DefOrientation=='P') { |
| 2601 | 2570 | $wPt=$this->fwPt; |
| 2602 | 2571 | $hPt=$this->fhPt; |
| 2603 | - } |
|
| 2604 | - else { |
|
| 2572 | + } else { |
|
| 2605 | 2573 | $wPt=$this->fhPt; |
| 2606 | 2574 | $hPt=$this->fwPt; |
| 2607 | 2575 | } |
@@ -2623,8 +2591,7 @@ discard block |
||
| 2623 | 2591 | $annots.='<</Type /Annot /Subtype /Link /Rect ['.$rect.'] /Border [0 0 0] '; |
| 2624 | 2592 | if(is_string($pl[4])) { |
| 2625 | 2593 | $annots.='/A <</S /URI /URI ('.$this->_escape($pl[4]).')>>>>'; |
| 2626 | - } |
|
| 2627 | - else { |
|
| 2594 | + } else { |
|
| 2628 | 2595 | $l=$this->links[$pl[4]]; |
| 2629 | 2596 | $h=isset($this->OrientationChanges[$l[0]]) ? $wPt : $hPt; |
| 2630 | 2597 | $annots.=sprintf('/Dest [%d 0 R /XYZ 0 %.2f null]>>',1+2*$l[0],$h-$l[1]*$this->k); |
@@ -2791,8 +2758,7 @@ discard block |
||
| 2791 | 2758 | $this->_out('/Height '.$info['h']); |
| 2792 | 2759 | if($info['cs']=='Indexed') { |
| 2793 | 2760 | $this->_out('/ColorSpace [/Indexed /DeviceRGB '.(strlen($info['pal'])/3-1).' '.($this->n+1).' 0 R]'); |
| 2794 | - } |
|
| 2795 | - else { |
|
| 2761 | + } else { |
|
| 2796 | 2762 | $this->_out('/ColorSpace /'.$info['cs']); |
| 2797 | 2763 | if($info['cs']=='DeviceCMYK') { |
| 2798 | 2764 | $this->_out('/Decode [1 0 1 0 1 0 1 0]'); |
@@ -2902,23 +2868,18 @@ discard block |
||
| 2902 | 2868 | $this->_out('/Pages 1 0 R'); |
| 2903 | 2869 | if($this->ZoomMode=='fullpage') { |
| 2904 | 2870 | $this->_out('/OpenAction [3 0 R /Fit]'); |
| 2905 | - } |
|
| 2906 | - elseif($this->ZoomMode=='fullwidth') { |
|
| 2871 | + } elseif($this->ZoomMode=='fullwidth') { |
|
| 2907 | 2872 | $this->_out('/OpenAction [3 0 R /FitH null]'); |
| 2908 | - } |
|
| 2909 | - elseif($this->ZoomMode=='real') { |
|
| 2873 | + } elseif($this->ZoomMode=='real') { |
|
| 2910 | 2874 | $this->_out('/OpenAction [3 0 R /XYZ null null 1]'); |
| 2911 | - } |
|
| 2912 | - elseif(!is_string($this->ZoomMode)) { |
|
| 2875 | + } elseif(!is_string($this->ZoomMode)) { |
|
| 2913 | 2876 | $this->_out('/OpenAction [3 0 R /XYZ null null '.($this->ZoomMode/100).']'); |
| 2914 | 2877 | } |
| 2915 | 2878 | if($this->LayoutMode=='single') { |
| 2916 | 2879 | $this->_out('/PageLayout /SinglePage'); |
| 2917 | - } |
|
| 2918 | - elseif($this->LayoutMode=='continuous') { |
|
| 2880 | + } elseif($this->LayoutMode=='continuous') { |
|
| 2919 | 2881 | $this->_out('/PageLayout /OneColumn'); |
| 2920 | - } |
|
| 2921 | - elseif($this->LayoutMode=='two') { |
|
| 2882 | + } elseif($this->LayoutMode=='two') { |
|
| 2922 | 2883 | $this->_out('/PageLayout /TwoColumnLeft'); |
| 2923 | 2884 | } |
| 2924 | 2885 | } |
@@ -2994,8 +2955,7 @@ discard block |
||
| 2994 | 2955 | //Page orientation |
| 2995 | 2956 | if(empty($orientation)) { |
| 2996 | 2957 | $orientation=$this->DefOrientation; |
| 2997 | - } |
|
| 2998 | - else { |
|
| 2958 | + } else { |
|
| 2999 | 2959 | $orientation=strtoupper($orientation{0}); |
| 3000 | 2960 | if($orientation!=$this->DefOrientation) { |
| 3001 | 2961 | $this->OrientationChanges[$this->page]=true; |
@@ -3008,8 +2968,7 @@ discard block |
||
| 3008 | 2968 | $this->hPt=$this->fhPt; |
| 3009 | 2969 | $this->w=$this->fw; |
| 3010 | 2970 | $this->h=$this->fh; |
| 3011 | - } |
|
| 3012 | - else { |
|
| 2971 | + } else { |
|
| 3013 | 2972 | $this->wPt=$this->fhPt; |
| 3014 | 2973 | $this->hPt=$this->fwPt; |
| 3015 | 2974 | $this->w=$this->fh; |
@@ -3063,11 +3022,9 @@ discard block |
||
| 3063 | 3022 | } |
| 3064 | 3023 | if(!isset($a['channels']) or $a['channels']==3) { |
| 3065 | 3024 | $colspace='DeviceRGB'; |
| 3066 | - } |
|
| 3067 | - elseif($a['channels']==4) { |
|
| 3025 | + } elseif($a['channels']==4) { |
|
| 3068 | 3026 | $colspace='DeviceCMYK'; |
| 3069 | - } |
|
| 3070 | - else { |
|
| 3027 | + } else { |
|
| 3071 | 3028 | $colspace='DeviceGray'; |
| 3072 | 3029 | } |
| 3073 | 3030 | $bpc=isset($a['bits']) ? $a['bits'] : 8; |
@@ -3108,14 +3065,11 @@ discard block |
||
| 3108 | 3065 | $ct=ord(fread($f,1)); |
| 3109 | 3066 | if($ct==0) { |
| 3110 | 3067 | $colspace='DeviceGray'; |
| 3111 | - } |
|
| 3112 | - elseif($ct==2) { |
|
| 3068 | + } elseif($ct==2) { |
|
| 3113 | 3069 | $colspace='DeviceRGB'; |
| 3114 | - } |
|
| 3115 | - elseif($ct==3) { |
|
| 3070 | + } elseif($ct==3) { |
|
| 3116 | 3071 | $colspace='Indexed'; |
| 3117 | - } |
|
| 3118 | - else { |
|
| 3072 | + } else { |
|
| 3119 | 3073 | $this->Error('Alpha channel not supported: '.$file); |
| 3120 | 3074 | } |
| 3121 | 3075 | if(ord(fread($f,1))!=0) { |
@@ -3140,33 +3094,27 @@ discard block |
||
| 3140 | 3094 | //Read palette |
| 3141 | 3095 | $pal=fread($f,$n); |
| 3142 | 3096 | fread($f,4); |
| 3143 | - } |
|
| 3144 | - elseif($type=='tRNS') { |
|
| 3097 | + } elseif($type=='tRNS') { |
|
| 3145 | 3098 | //Read transparency info |
| 3146 | 3099 | $t=fread($f,$n); |
| 3147 | 3100 | if($ct==0) { |
| 3148 | 3101 | $trns=array(ord(substr($t,1,1))); |
| 3149 | - } |
|
| 3150 | - elseif($ct==2) { |
|
| 3102 | + } elseif($ct==2) { |
|
| 3151 | 3103 | $trns=array(ord(substr($t,1,1)),ord(substr($t,3,1)),ord(substr($t,5,1))); |
| 3152 | - } |
|
| 3153 | - else { |
|
| 3104 | + } else { |
|
| 3154 | 3105 | $pos=strpos($t,chr(0)); |
| 3155 | 3106 | if($pos!==false) { |
| 3156 | 3107 | $trns=array($pos); |
| 3157 | 3108 | } |
| 3158 | 3109 | } |
| 3159 | 3110 | fread($f,4); |
| 3160 | - } |
|
| 3161 | - elseif($type=='IDAT') { |
|
| 3111 | + } elseif($type=='IDAT') { |
|
| 3162 | 3112 | //Read image data block |
| 3163 | 3113 | $data.=fread($f,$n); |
| 3164 | 3114 | fread($f,4); |
| 3165 | - } |
|
| 3166 | - elseif($type=='IEND') { |
|
| 3115 | + } elseif($type=='IEND') { |
|
| 3167 | 3116 | break; |
| 3168 | - } |
|
| 3169 | - else { |
|
| 3117 | + } else { |
|
| 3170 | 3118 | fread($f,$n+4); |
| 3171 | 3119 | } |
| 3172 | 3120 | } |
@@ -3238,8 +3186,7 @@ discard block |
||
| 3238 | 3186 | function _out($s) { |
| 3239 | 3187 | if($this->state==2) { |
| 3240 | 3188 | $this->pages[$this->page] .= $s."\n"; |
| 3241 | - } |
|
| 3242 | - else { |
|
| 3189 | + } else { |
|
| 3243 | 3190 | $this->buffer .= $s."\n"; |
| 3244 | 3191 | } |
| 3245 | 3192 | } |
@@ -3437,8 +3384,7 @@ discard block |
||
| 3437 | 3384 | encoding form (as surrogate pairs) and do not directly represent |
| 3438 | 3385 | characters. */ |
| 3439 | 3386 | $unicode[] = 0xFFFD; // use replacement character |
| 3440 | - } |
|
| 3441 | - else { |
|
| 3387 | + } else { |
|
| 3442 | 3388 | $unicode[] = $char; // add char to array |
| 3443 | 3389 | } |
| 3444 | 3390 | // reset data for next char |
@@ -3675,26 +3621,21 @@ discard block |
||
| 3675 | 3621 | //Text |
| 3676 | 3622 | if($this->HREF) { |
| 3677 | 3623 | $this->addHtmlLink($this->HREF, $element, $fill); |
| 3678 | - } |
|
| 3679 | - elseif($this->tdbegin) { |
|
| 3624 | + } elseif($this->tdbegin) { |
|
| 3680 | 3625 | if((strlen(trim($element)) > 0) AND ($element != " ")) { |
| 3681 | 3626 | $this->Cell($this->tdwidth, $this->tdheight, $this->unhtmlentities($element), $this->tableborder, '', $this->tdalign, $this->tdbgcolor); |
| 3682 | - } |
|
| 3683 | - elseif($element == " ") { |
|
| 3627 | + } elseif($element == " ") { |
|
| 3684 | 3628 | $this->Cell($this->tdwidth, $this->tdheight, '', $this->tableborder, '', $this->tdalign, $this->tdbgcolor); |
| 3685 | 3629 | } |
| 3686 | - } |
|
| 3687 | - else { |
|
| 3630 | + } else { |
|
| 3688 | 3631 | $this->Write($this->lasth, stripslashes($this->unhtmlentities($element)), '', $fill); |
| 3689 | 3632 | } |
| 3690 | - } |
|
| 3691 | - else { |
|
| 3633 | + } else { |
|
| 3692 | 3634 | $element = substr($element, 1, -1); |
| 3693 | 3635 | //Tag |
| 3694 | 3636 | if($element{0}=='/') { |
| 3695 | 3637 | $this->closedHTMLTagHandler(strtolower(substr($element, 1))); |
| 3696 | - } |
|
| 3697 | - else { |
|
| 3638 | + } else { |
|
| 3698 | 3639 | //Extract attributes |
| 3699 | 3640 | // get tag name |
| 3700 | 3641 | preg_match('/([a-zA-Z0-9]*)/', $element, $tag); |
@@ -3809,8 +3750,7 @@ discard block |
||
| 3809 | 3750 | case 'table': { |
| 3810 | 3751 | if ((isset($attr['border'])) AND ($attr['border'] != '')) { |
| 3811 | 3752 | $this->tableborder = $attr['border']; |
| 3812 | - } |
|
| 3813 | - else { |
|
| 3753 | + } else { |
|
| 3814 | 3754 | $this->tableborder = 0; |
| 3815 | 3755 | } |
| 3816 | 3756 | break; |
@@ -3822,14 +3762,12 @@ discard block |
||
| 3822 | 3762 | case 'th': { |
| 3823 | 3763 | if ((isset($attr['width'])) AND ($attr['width'] != '')) { |
| 3824 | 3764 | $this->tdwidth = ($attr['width']/4); |
| 3825 | - } |
|
| 3826 | - else { |
|
| 3765 | + } else { |
|
| 3827 | 3766 | $this->tdwidth = (($this->w - $this->lMargin - $this->rMargin) / $this->default_table_columns); |
| 3828 | 3767 | } |
| 3829 | 3768 | if ((isset($attr['height'])) AND ($attr['height'] != '')) { |
| 3830 | 3769 | $this->tdheight=($attr['height'] / $this->k); |
| 3831 | - } |
|
| 3832 | - else { |
|
| 3770 | + } else { |
|
| 3833 | 3771 | $this->tdheight = $this->lasth; |
| 3834 | 3772 | } |
| 3835 | 3773 | if ((isset($attr['align'])) AND ($attr['align'] != '')) { |
@@ -3861,8 +3799,7 @@ discard block |
||
| 3861 | 3799 | $this->Ln(); |
| 3862 | 3800 | if ((isset($attr['width'])) AND ($attr['width'] != '')) { |
| 3863 | 3801 | $hrWidth = $attr['width']; |
| 3864 | - } |
|
| 3865 | - else { |
|
| 3802 | + } else { |
|
| 3866 | 3803 | $hrWidth = $this->w - $this->lMargin - $this->rMargin; |
| 3867 | 3804 | } |
| 3868 | 3805 | $x = $this->GetX(); |
@@ -3923,8 +3860,7 @@ discard block |
||
| 3923 | 3860 | $this->Ln(); |
| 3924 | 3861 | if ($this->listordered) { |
| 3925 | 3862 | $this->lispacer = " ".(++$this->listcount).". "; |
| 3926 | - } |
|
| 3927 | - else { |
|
| 3863 | + } else { |
|
| 3928 | 3864 | //unordered list simbol |
| 3929 | 3865 | $this->lispacer = " - "; |
| 3930 | 3866 | } |
@@ -37,137 +37,137 @@ discard block |
||
| 37 | 37 | /** |
| 38 | 38 | * installation path |
| 39 | 39 | */ |
| 40 | - define ("K_PATH_MAIN", BOOKSHOP_PATH.'pdf/'); |
|
| 40 | + define("K_PATH_MAIN", BOOKSHOP_PATH.'pdf/'); |
|
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | 43 | * url path |
| 44 | 44 | */ |
| 45 | - define ("K_PATH_URL", BOOKSHOP_URL.'/pdf/'); |
|
| 45 | + define("K_PATH_URL", BOOKSHOP_URL.'/pdf/'); |
|
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | 48 | * path for PDF fonts |
| 49 | 49 | */ |
| 50 | - define ("FPDF_FONTPATH", K_PATH_MAIN."fonts/"); |
|
| 50 | + define("FPDF_FONTPATH", K_PATH_MAIN."fonts/"); |
|
| 51 | 51 | |
| 52 | 52 | /** |
| 53 | 53 | * cache directory for temporary files (full path) |
| 54 | 54 | */ |
| 55 | - define ("K_PATH_CACHE", K_PATH_MAIN."cache/"); |
|
| 55 | + define("K_PATH_CACHE", K_PATH_MAIN."cache/"); |
|
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | 58 | * cache directory for temporary files (url path) |
| 59 | 59 | */ |
| 60 | - define ("K_PATH_URL_CACHE", K_PATH_URL."cache/"); |
|
| 60 | + define("K_PATH_URL_CACHE", K_PATH_URL."cache/"); |
|
| 61 | 61 | |
| 62 | 62 | /** |
| 63 | 63 | *images directory |
| 64 | 64 | */ |
| 65 | - define ("K_PATH_IMAGES", K_PATH_MAIN."images/"); |
|
| 65 | + define("K_PATH_IMAGES", K_PATH_MAIN."images/"); |
|
| 66 | 66 | |
| 67 | 67 | /** |
| 68 | 68 | * blank image |
| 69 | 69 | */ |
| 70 | - define ("K_BLANK_IMAGE", K_PATH_IMAGES."_blank.png"); |
|
| 70 | + define("K_BLANK_IMAGE", K_PATH_IMAGES."_blank.png"); |
|
| 71 | 71 | |
| 72 | 72 | /** |
| 73 | 73 | * page format |
| 74 | 74 | */ |
| 75 | - define ("PDF_PAGE_FORMAT", "A4"); |
|
| 75 | + define("PDF_PAGE_FORMAT", "A4"); |
|
| 76 | 76 | |
| 77 | 77 | /** |
| 78 | 78 | * page orientation (P=portrait, L=landscape) |
| 79 | 79 | */ |
| 80 | - define ("PDF_PAGE_ORIENTATION", "P"); |
|
| 80 | + define("PDF_PAGE_ORIENTATION", "P"); |
|
| 81 | 81 | |
| 82 | 82 | /** |
| 83 | 83 | * document creator |
| 84 | 84 | */ |
| 85 | - define ("PDF_CREATOR", "Instant Zero (http://www.instant-zero.com)"); |
|
| 85 | + define("PDF_CREATOR", "Instant Zero (http://www.instant-zero.com)"); |
|
| 86 | 86 | |
| 87 | 87 | /** |
| 88 | 88 | * document author |
| 89 | 89 | */ |
| 90 | - define ("PDF_AUTHOR", "Instant Zero (http://www.instant-zero.com)"); |
|
| 90 | + define("PDF_AUTHOR", "Instant Zero (http://www.instant-zero.com)"); |
|
| 91 | 91 | |
| 92 | 92 | /** |
| 93 | 93 | * header title |
| 94 | 94 | */ |
| 95 | - define ("PDF_HEADER_TITLE", "Bookshop"); |
|
| 95 | + define("PDF_HEADER_TITLE", "Bookshop"); |
|
| 96 | 96 | |
| 97 | 97 | /** |
| 98 | 98 | * header description string |
| 99 | 99 | */ |
| 100 | - define ("PDF_HEADER_STRING", "first row\nsecond row\nthird row"); |
|
| 100 | + define("PDF_HEADER_STRING", "first row\nsecond row\nthird row"); |
|
| 101 | 101 | |
| 102 | 102 | /** |
| 103 | 103 | * image logo |
| 104 | 104 | */ |
| 105 | - define ("PDF_HEADER_LOGO", "logo_example.png"); |
|
| 105 | + define("PDF_HEADER_LOGO", "logo_example.png"); |
|
| 106 | 106 | |
| 107 | 107 | /** |
| 108 | 108 | * header logo image width [mm] |
| 109 | 109 | */ |
| 110 | - define ("PDF_HEADER_LOGO_WIDTH", 20); |
|
| 110 | + define("PDF_HEADER_LOGO_WIDTH", 20); |
|
| 111 | 111 | |
| 112 | 112 | /** |
| 113 | 113 | * document unit of measure [pt=point, mm=millimeter, cm=centimeter, in=inch] |
| 114 | 114 | */ |
| 115 | - define ("PDF_UNIT", "mm"); |
|
| 115 | + define("PDF_UNIT", "mm"); |
|
| 116 | 116 | |
| 117 | 117 | /** |
| 118 | 118 | * header margin |
| 119 | 119 | */ |
| 120 | - define ("PDF_MARGIN_HEADER", 5); |
|
| 120 | + define("PDF_MARGIN_HEADER", 5); |
|
| 121 | 121 | |
| 122 | 122 | /** |
| 123 | 123 | * footer margin |
| 124 | 124 | */ |
| 125 | - define ("PDF_MARGIN_FOOTER", 10); |
|
| 125 | + define("PDF_MARGIN_FOOTER", 10); |
|
| 126 | 126 | |
| 127 | 127 | /** |
| 128 | 128 | * top margin |
| 129 | 129 | */ |
| 130 | - define ("PDF_MARGIN_TOP", 27); |
|
| 130 | + define("PDF_MARGIN_TOP", 27); |
|
| 131 | 131 | |
| 132 | 132 | /** |
| 133 | 133 | * bottom margin |
| 134 | 134 | */ |
| 135 | - define ("PDF_MARGIN_BOTTOM", 25); |
|
| 135 | + define("PDF_MARGIN_BOTTOM", 25); |
|
| 136 | 136 | |
| 137 | 137 | /** |
| 138 | 138 | * left margin |
| 139 | 139 | */ |
| 140 | - define ("PDF_MARGIN_LEFT", 15); |
|
| 140 | + define("PDF_MARGIN_LEFT", 15); |
|
| 141 | 141 | |
| 142 | 142 | /** |
| 143 | 143 | * right margin |
| 144 | 144 | */ |
| 145 | - define ("PDF_MARGIN_RIGHT", 15); |
|
| 145 | + define("PDF_MARGIN_RIGHT", 15); |
|
| 146 | 146 | |
| 147 | 147 | /** |
| 148 | 148 | * main font name |
| 149 | 149 | */ |
| 150 | - define ("PDF_FONT_NAME_MAIN", "FreeSerif"); //vera |
|
| 150 | + define("PDF_FONT_NAME_MAIN", "FreeSerif"); //vera |
|
| 151 | 151 | |
| 152 | 152 | /** |
| 153 | 153 | * main font size |
| 154 | 154 | */ |
| 155 | - define ("PDF_FONT_SIZE_MAIN", 10); |
|
| 155 | + define("PDF_FONT_SIZE_MAIN", 10); |
|
| 156 | 156 | |
| 157 | 157 | /** |
| 158 | 158 | * data font name |
| 159 | 159 | */ |
| 160 | - define ("PDF_FONT_NAME_DATA", "FreeSerif"); //verase |
|
| 160 | + define("PDF_FONT_NAME_DATA", "FreeSerif"); //verase |
|
| 161 | 161 | |
| 162 | 162 | /** |
| 163 | 163 | * data font size |
| 164 | 164 | */ |
| 165 | - define ("PDF_FONT_SIZE_DATA", 8); |
|
| 165 | + define("PDF_FONT_SIZE_DATA", 8); |
|
| 166 | 166 | |
| 167 | 167 | /** |
| 168 | 168 | * scale factor for images (number of points in user unit) |
| 169 | 169 | */ |
| 170 | - define ("PDF_IMAGE_SCALE_RATIO", 2); |
|
| 170 | + define("PDF_IMAGE_SCALE_RATIO", 2); |
|
| 171 | 171 | |
| 172 | 172 | /** |
| 173 | 173 | * magnification factor for titles |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | /** |
| 188 | 188 | * reduction factor for small font |
| 189 | 189 | */ |
| 190 | - define("K_SMALL_RATIO", 2/3); |
|
| 190 | + define("K_SMALL_RATIO", 2 / 3); |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | //============================================================+ |
@@ -44,7 +44,7 @@ |
||
| 44 | 44 | * @return string converted |
| 45 | 45 | */ |
| 46 | 46 | function html_entity_decode_php4($text_to_convert) { |
| 47 | - $htmlentities_table = array ( |
|
| 47 | + $htmlentities_table = array( |
|
| 48 | 48 | "Á" => "".chr(195).chr(129)."", |
| 49 | 49 | "á" => "".chr(195).chr(161)."", |
| 50 | 50 | "Â" => "".chr(195).chr(130)."", |
@@ -57,109 +57,109 @@ discard block |
||
| 57 | 57 | $this->BarcodeObject($Width, $Height, $Style); |
| 58 | 58 | $this->mValue = $Value; |
| 59 | 59 | $this->mChars = " !\"#$%&'()*+�-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{ }~"; |
| 60 | - $this->mCharSet = array ( |
|
| 61 | - "212222", /* 00 */ |
|
| 62 | - "222122", /* 01 */ |
|
| 63 | - "222221", /* 02 */ |
|
| 64 | - "121223", /* 03 */ |
|
| 65 | - "121322", /* 04 */ |
|
| 66 | - "131222", /* 05 */ |
|
| 67 | - "122213", /* 06 */ |
|
| 68 | - "122312", /* 07 */ |
|
| 69 | - "132212", /* 08 */ |
|
| 70 | - "221213", /* 09 */ |
|
| 71 | - "221312", /* 10 */ |
|
| 72 | - "231212", /* 11 */ |
|
| 73 | - "112232", /* 12 */ |
|
| 74 | - "122132", /* 13 */ |
|
| 75 | - "122231", /* 14 */ |
|
| 76 | - "113222", /* 15 */ |
|
| 77 | - "123122", /* 16 */ |
|
| 78 | - "123221", /* 17 */ |
|
| 79 | - "223211", /* 18 */ |
|
| 80 | - "221132", /* 19 */ |
|
| 81 | - "221231", /* 20 */ |
|
| 82 | - "213212", /* 21 */ |
|
| 83 | - "223112", /* 22 */ |
|
| 84 | - "312131", /* 23 */ |
|
| 85 | - "311222", /* 24 */ |
|
| 86 | - "321122", /* 25 */ |
|
| 87 | - "321221", /* 26 */ |
|
| 88 | - "312212", /* 27 */ |
|
| 89 | - "322112", /* 28 */ |
|
| 90 | - "322211", /* 29 */ |
|
| 91 | - "212123", /* 30 */ |
|
| 92 | - "212321", /* 31 */ |
|
| 93 | - "232121", /* 32 */ |
|
| 94 | - "111323", /* 33 */ |
|
| 95 | - "131123", /* 34 */ |
|
| 96 | - "131321", /* 35 */ |
|
| 97 | - "112313", /* 36 */ |
|
| 98 | - "132113", /* 37 */ |
|
| 99 | - "132311", /* 38 */ |
|
| 100 | - "211313", /* 39 */ |
|
| 101 | - "231113", /* 40 */ |
|
| 102 | - "231311", /* 41 */ |
|
| 103 | - "112133", /* 42 */ |
|
| 104 | - "112331", /* 43 */ |
|
| 105 | - "132131", /* 44 */ |
|
| 106 | - "113123", /* 45 */ |
|
| 107 | - "113321", /* 46 */ |
|
| 108 | - "133121", /* 47 */ |
|
| 109 | - "313121", /* 48 */ |
|
| 110 | - "211331", /* 49 */ |
|
| 111 | - "231131", /* 50 */ |
|
| 112 | - "213113", /* 51 */ |
|
| 113 | - "213311", /* 52 */ |
|
| 114 | - "213131", /* 53 */ |
|
| 115 | - "311123", /* 54 */ |
|
| 116 | - "311321", /* 55 */ |
|
| 117 | - "331121", /* 56 */ |
|
| 118 | - "312113", /* 57 */ |
|
| 119 | - "312311", /* 58 */ |
|
| 120 | - "332111", /* 59 */ |
|
| 121 | - "314111", /* 60 */ |
|
| 122 | - "221411", /* 61 */ |
|
| 123 | - "431111", /* 62 */ |
|
| 124 | - "111224", /* 63 */ |
|
| 125 | - "111422", /* 64 */ |
|
| 126 | - "121124", /* 65 */ |
|
| 127 | - "121421", /* 66 */ |
|
| 128 | - "141122", /* 67 */ |
|
| 129 | - "141221", /* 68 */ |
|
| 130 | - "112214", /* 69 */ |
|
| 131 | - "112412", /* 70 */ |
|
| 132 | - "122114", /* 71 */ |
|
| 133 | - "122411", /* 72 */ |
|
| 134 | - "142112", /* 73 */ |
|
| 135 | - "142211", /* 74 */ |
|
| 136 | - "241211", /* 75 */ |
|
| 137 | - "221114", /* 76 */ |
|
| 138 | - "413111", /* 77 */ |
|
| 139 | - "241112", /* 78 */ |
|
| 140 | - "134111", /* 79 */ |
|
| 141 | - "111242", /* 80 */ |
|
| 142 | - "121142", /* 81 */ |
|
| 143 | - "121241", /* 82 */ |
|
| 144 | - "114212", /* 83 */ |
|
| 145 | - "124112", /* 84 */ |
|
| 146 | - "124211", /* 85 */ |
|
| 147 | - "411212", /* 86 */ |
|
| 148 | - "421112", /* 87 */ |
|
| 149 | - "421211", /* 88 */ |
|
| 150 | - "212141", /* 89 */ |
|
| 151 | - "214121", /* 90 */ |
|
| 152 | - "412121", /* 91 */ |
|
| 153 | - "111143", /* 92 */ |
|
| 154 | - "111341", /* 93 */ |
|
| 155 | - "131141", /* 94 */ |
|
| 156 | - "114113", /* 95 */ |
|
| 157 | - "114311", /* 96 */ |
|
| 158 | - "411113", /* 97 */ |
|
| 159 | - "411311", /* 98 */ |
|
| 160 | - "113141", /* 99 */ |
|
| 161 | - "114131", /* 100 */ |
|
| 162 | - "311141", /* 101 */ |
|
| 60 | + $this->mCharSet = array( |
|
| 61 | + "212222", /* 00 */ |
|
| 62 | + "222122", /* 01 */ |
|
| 63 | + "222221", /* 02 */ |
|
| 64 | + "121223", /* 03 */ |
|
| 65 | + "121322", /* 04 */ |
|
| 66 | + "131222", /* 05 */ |
|
| 67 | + "122213", /* 06 */ |
|
| 68 | + "122312", /* 07 */ |
|
| 69 | + "132212", /* 08 */ |
|
| 70 | + "221213", /* 09 */ |
|
| 71 | + "221312", /* 10 */ |
|
| 72 | + "231212", /* 11 */ |
|
| 73 | + "112232", /* 12 */ |
|
| 74 | + "122132", /* 13 */ |
|
| 75 | + "122231", /* 14 */ |
|
| 76 | + "113222", /* 15 */ |
|
| 77 | + "123122", /* 16 */ |
|
| 78 | + "123221", /* 17 */ |
|
| 79 | + "223211", /* 18 */ |
|
| 80 | + "221132", /* 19 */ |
|
| 81 | + "221231", /* 20 */ |
|
| 82 | + "213212", /* 21 */ |
|
| 83 | + "223112", /* 22 */ |
|
| 84 | + "312131", /* 23 */ |
|
| 85 | + "311222", /* 24 */ |
|
| 86 | + "321122", /* 25 */ |
|
| 87 | + "321221", /* 26 */ |
|
| 88 | + "312212", /* 27 */ |
|
| 89 | + "322112", /* 28 */ |
|
| 90 | + "322211", /* 29 */ |
|
| 91 | + "212123", /* 30 */ |
|
| 92 | + "212321", /* 31 */ |
|
| 93 | + "232121", /* 32 */ |
|
| 94 | + "111323", /* 33 */ |
|
| 95 | + "131123", /* 34 */ |
|
| 96 | + "131321", /* 35 */ |
|
| 97 | + "112313", /* 36 */ |
|
| 98 | + "132113", /* 37 */ |
|
| 99 | + "132311", /* 38 */ |
|
| 100 | + "211313", /* 39 */ |
|
| 101 | + "231113", /* 40 */ |
|
| 102 | + "231311", /* 41 */ |
|
| 103 | + "112133", /* 42 */ |
|
| 104 | + "112331", /* 43 */ |
|
| 105 | + "132131", /* 44 */ |
|
| 106 | + "113123", /* 45 */ |
|
| 107 | + "113321", /* 46 */ |
|
| 108 | + "133121", /* 47 */ |
|
| 109 | + "313121", /* 48 */ |
|
| 110 | + "211331", /* 49 */ |
|
| 111 | + "231131", /* 50 */ |
|
| 112 | + "213113", /* 51 */ |
|
| 113 | + "213311", /* 52 */ |
|
| 114 | + "213131", /* 53 */ |
|
| 115 | + "311123", /* 54 */ |
|
| 116 | + "311321", /* 55 */ |
|
| 117 | + "331121", /* 56 */ |
|
| 118 | + "312113", /* 57 */ |
|
| 119 | + "312311", /* 58 */ |
|
| 120 | + "332111", /* 59 */ |
|
| 121 | + "314111", /* 60 */ |
|
| 122 | + "221411", /* 61 */ |
|
| 123 | + "431111", /* 62 */ |
|
| 124 | + "111224", /* 63 */ |
|
| 125 | + "111422", /* 64 */ |
|
| 126 | + "121124", /* 65 */ |
|
| 127 | + "121421", /* 66 */ |
|
| 128 | + "141122", /* 67 */ |
|
| 129 | + "141221", /* 68 */ |
|
| 130 | + "112214", /* 69 */ |
|
| 131 | + "112412", /* 70 */ |
|
| 132 | + "122114", /* 71 */ |
|
| 133 | + "122411", /* 72 */ |
|
| 134 | + "142112", /* 73 */ |
|
| 135 | + "142211", /* 74 */ |
|
| 136 | + "241211", /* 75 */ |
|
| 137 | + "221114", /* 76 */ |
|
| 138 | + "413111", /* 77 */ |
|
| 139 | + "241112", /* 78 */ |
|
| 140 | + "134111", /* 79 */ |
|
| 141 | + "111242", /* 80 */ |
|
| 142 | + "121142", /* 81 */ |
|
| 143 | + "121241", /* 82 */ |
|
| 144 | + "114212", /* 83 */ |
|
| 145 | + "124112", /* 84 */ |
|
| 146 | + "124211", /* 85 */ |
|
| 147 | + "411212", /* 86 */ |
|
| 148 | + "421112", /* 87 */ |
|
| 149 | + "421211", /* 88 */ |
|
| 150 | + "212141", /* 89 */ |
|
| 151 | + "214121", /* 90 */ |
|
| 152 | + "412121", /* 91 */ |
|
| 153 | + "111143", /* 92 */ |
|
| 154 | + "111341", /* 93 */ |
|
| 155 | + "131141", /* 94 */ |
|
| 156 | + "114113", /* 95 */ |
|
| 157 | + "114311", /* 96 */ |
|
| 158 | + "411113", /* 97 */ |
|
| 159 | + "411311", /* 98 */ |
|
| 160 | + "113141", /* 99 */ |
|
| 161 | + "114131", /* 100 */ |
|
| 162 | + "311141", /* 101 */ |
|
| 163 | 163 | "411131" /* 102 */ |
| 164 | 164 | ); |
| 165 | 165 | } |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | * @access private |
| 172 | 172 | */ |
| 173 | 173 | function GetCharIndex($char) { |
| 174 | - for ($i=0;$i<95;$i++) { |
|
| 174 | + for ($i = 0; $i < 95; $i++) { |
|
| 175 | 175 | if ($this->mChars[$i] == $char) { |
| 176 | 176 | return $i; |
| 177 | 177 | } |
@@ -220,12 +220,12 @@ discard block |
||
| 220 | 220 | function GetSize($xres) { |
| 221 | 221 | $len = strlen($this->mValue); |
| 222 | 222 | |
| 223 | - if ($len == 0) { |
|
| 223 | + if ($len == 0) { |
|
| 224 | 224 | $this->mError = "Null value"; |
| 225 | 225 | return false; |
| 226 | 226 | } |
| 227 | 227 | $ret = 0; |
| 228 | - for ($i=0;$i<$len;$i++) { |
|
| 228 | + for ($i = 0; $i < $len; $i++) { |
|
| 229 | 229 | if (($id = $this->GetCharIndex($this->mValue[$i])) == -1) { |
| 230 | 230 | $this->mError = "C128B not include the char '".$this->mValue[$i]."'"; |
| 231 | 231 | return false; |
@@ -242,12 +242,12 @@ discard block |
||
| 242 | 242 | /* length of Check character */ |
| 243 | 243 | $cset = $this->GetCheckCharValue(); |
| 244 | 244 | $CheckSize = 0; |
| 245 | - for ($i=0;$i<6;$i++) { |
|
| 245 | + for ($i = 0; $i < 6; $i++) { |
|
| 246 | 246 | $CheckSize += $this->GetBarSize($cset[$i], $xres); |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | - $StartSize = 2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres; |
|
| 250 | - $StopSize = 2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + 2*BCD_C128_BAR_3*$xres; |
|
| 249 | + $StartSize = 2 * BCD_C128_BAR_2 * $xres + 3 * BCD_C128_BAR_1 * $xres + BCD_C128_BAR_4 * $xres; |
|
| 250 | + $StopSize = 2 * BCD_C128_BAR_2 * $xres + 3 * BCD_C128_BAR_1 * $xres + 2 * BCD_C128_BAR_3 * $xres; |
|
| 251 | 251 | |
| 252 | 252 | return $StartSize + $ret + $CheckSize + $StopSize; |
| 253 | 253 | } |
@@ -260,10 +260,10 @@ discard block |
||
| 260 | 260 | function GetCheckCharValue() { |
| 261 | 261 | $len = strlen($this->mValue); |
| 262 | 262 | $sum = 104; // 'B' type; |
| 263 | - for ($i=0;$i<$len;$i++) { |
|
| 264 | - $sum += $this->GetCharIndex($this->mValue[$i]) * ($i+1); |
|
| 263 | + for ($i = 0; $i < $len; $i++) { |
|
| 264 | + $sum += $this->GetCharIndex($this->mValue[$i]) * ($i + 1); |
|
| 265 | 265 | } |
| 266 | - $check = $sum % 103; |
|
| 266 | + $check = $sum % 103; |
|
| 267 | 267 | return $this->mCharSet[$check]; |
| 268 | 268 | } |
| 269 | 269 | |
@@ -301,16 +301,16 @@ discard block |
||
| 301 | 301 | */ |
| 302 | 302 | function DrawStop($DrawPos, $yPos, $ySize, $xres) { |
| 303 | 303 | /* Stop code is '2331112' */ |
| 304 | - $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres) , $ySize); |
|
| 304 | + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres), $ySize); |
|
| 305 | 305 | $DrawPos += $this->GetBarSize('2', $xres); |
| 306 | 306 | $DrawPos += $this->GetBarSize('3', $xres); |
| 307 | - $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('3', $xres) , $ySize); |
|
| 307 | + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('3', $xres), $ySize); |
|
| 308 | 308 | $DrawPos += $this->GetBarSize('3', $xres); |
| 309 | 309 | $DrawPos += $this->GetBarSize('1', $xres); |
| 310 | - $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('1', $xres) , $ySize); |
|
| 310 | + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('1', $xres), $ySize); |
|
| 311 | 311 | $DrawPos += $this->GetBarSize('1', $xres); |
| 312 | 312 | $DrawPos += $this->GetBarSize('1', $xres); |
| 313 | - $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres) , $ySize); |
|
| 313 | + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres), $ySize); |
|
| 314 | 314 | $DrawPos += $this->GetBarSize('2', $xres); |
| 315 | 315 | return $DrawPos; |
| 316 | 316 | } |
@@ -326,13 +326,13 @@ discard block |
||
| 326 | 326 | */ |
| 327 | 327 | function DrawCheckChar($DrawPos, $yPos, $ySize, $xres) { |
| 328 | 328 | $cset = $this->GetCheckCharValue(); |
| 329 | - $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[0], $xres) , $ySize); |
|
| 329 | + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[0], $xres), $ySize); |
|
| 330 | 330 | $DrawPos += $this->GetBarSize($cset[0], $xres); |
| 331 | 331 | $DrawPos += $this->GetBarSize($cset[1], $xres); |
| 332 | - $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[2], $xres) , $ySize); |
|
| 332 | + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[2], $xres), $ySize); |
|
| 333 | 333 | $DrawPos += $this->GetBarSize($cset[2], $xres); |
| 334 | 334 | $DrawPos += $this->GetBarSize($cset[3], $xres); |
| 335 | - $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[4], $xres) , $ySize); |
|
| 335 | + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[4], $xres), $ySize); |
|
| 336 | 336 | $DrawPos += $this->GetBarSize($cset[4], $xres); |
| 337 | 337 | $DrawPos += $this->GetBarSize($cset[5], $xres); |
| 338 | 338 | return $DrawPos; |
@@ -345,11 +345,11 @@ discard block |
||
| 345 | 345 | */ |
| 346 | 346 | function DrawObject($xres) { |
| 347 | 347 | $len = strlen($this->mValue); |
| 348 | - if (($size = $this->GetSize($xres))==0) { |
|
| 348 | + if (($size = $this->GetSize($xres)) == 0) { |
|
| 349 | 349 | return false; |
| 350 | 350 | } |
| 351 | 351 | |
| 352 | - if ($this->mStyle & BCS_ALIGN_CENTER) $sPos = (integer)(($this->mWidth - $size ) / 2); |
|
| 352 | + if ($this->mStyle & BCS_ALIGN_CENTER) $sPos = (integer)(($this->mWidth - $size) / 2); |
|
| 353 | 353 | else if ($this->mStyle & BCS_ALIGN_RIGHT) $sPos = $this->mWidth - $size; |
| 354 | 354 | else $sPos = 0; |
| 355 | 355 | |
@@ -360,35 +360,35 @@ discard block |
||
| 360 | 360 | /* Draw text */ |
| 361 | 361 | if ($this->mStyle & BCS_DRAW_TEXT) { |
| 362 | 362 | if ($this->mStyle & BCS_STRETCH_TEXT) { |
| 363 | - for ($i=0;$i<$len;$i++) { |
|
| 364 | - $this->DrawChar($this->mFont, $sPos+(2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres)+($size/$len)*$i, |
|
| 363 | + for ($i = 0; $i < $len; $i++) { |
|
| 364 | + $this->DrawChar($this->mFont, $sPos + (2 * BCD_C128_BAR_2 * $xres + 3 * BCD_C128_BAR_1 * $xres + BCD_C128_BAR_4 * $xres) + ($size / $len) * $i, |
|
| 365 | 365 | $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET, $this->mValue[$i]); |
| 366 | 366 | } |
| 367 | 367 | } else {/* Center */ |
| 368 | 368 | $text_width = $this->GetFontWidth($this->mFont) * strlen($this->mValue); |
| 369 | - $this->DrawText($this->mFont, $sPos+(($size-$text_width)/2)+(2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres), |
|
| 369 | + $this->DrawText($this->mFont, $sPos + (($size - $text_width) / 2) + (2 * BCD_C128_BAR_2 * $xres + 3 * BCD_C128_BAR_1 * $xres + BCD_C128_BAR_4 * $xres), |
|
| 370 | 370 | $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET, $this->mValue); |
| 371 | 371 | } |
| 372 | 372 | } |
| 373 | 373 | |
| 374 | 374 | $cPos = 0; |
| 375 | - $DrawPos = $this->DrawStart($sPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres); |
|
| 375 | + $DrawPos = $this->DrawStart($sPos, BCD_DEFAULT_MAR_Y1, $ysize, $xres); |
|
| 376 | 376 | do { |
| 377 | 377 | $c = $this->GetCharIndex($this->mValue[$cPos]); |
| 378 | 378 | $cset = $this->mCharSet[$c]; |
| 379 | - $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[0], $xres) , $ysize); |
|
| 379 | + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[0], $xres), $ysize); |
|
| 380 | 380 | $DrawPos += $this->GetBarSize($cset[0], $xres); |
| 381 | 381 | $DrawPos += $this->GetBarSize($cset[1], $xres); |
| 382 | - $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[2], $xres) , $ysize); |
|
| 382 | + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[2], $xres), $ysize); |
|
| 383 | 383 | $DrawPos += $this->GetBarSize($cset[2], $xres); |
| 384 | 384 | $DrawPos += $this->GetBarSize($cset[3], $xres); |
| 385 | - $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[4], $xres) , $ysize); |
|
| 385 | + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[4], $xres), $ysize); |
|
| 386 | 386 | $DrawPos += $this->GetBarSize($cset[4], $xres); |
| 387 | 387 | $DrawPos += $this->GetBarSize($cset[5], $xres); |
| 388 | 388 | $cPos++; |
| 389 | - } while ($cPos<$len); |
|
| 390 | - $DrawPos = $this->DrawCheckChar($DrawPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres); |
|
| 391 | - $DrawPos = $this->DrawStop($DrawPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres); |
|
| 389 | + } while ($cPos < $len); |
|
| 390 | + $DrawPos = $this->DrawCheckChar($DrawPos, BCD_DEFAULT_MAR_Y1, $ysize, $xres); |
|
| 391 | + $DrawPos = $this->DrawStop($DrawPos, BCD_DEFAULT_MAR_Y1, $ysize, $xres); |
|
| 392 | 392 | return true; |
| 393 | 393 | } |
| 394 | 394 | } |
@@ -349,13 +349,20 @@ |
||
| 349 | 349 | return false; |
| 350 | 350 | } |
| 351 | 351 | |
| 352 | - if ($this->mStyle & BCS_ALIGN_CENTER) $sPos = (integer)(($this->mWidth - $size ) / 2); |
|
| 353 | - else if ($this->mStyle & BCS_ALIGN_RIGHT) $sPos = $this->mWidth - $size; |
|
| 354 | - else $sPos = 0; |
|
| 352 | + if ($this->mStyle & BCS_ALIGN_CENTER) { |
|
| 353 | + $sPos = (integer)(($this->mWidth - $size ) / 2); |
|
| 354 | + } else if ($this->mStyle & BCS_ALIGN_RIGHT) { |
|
| 355 | + $sPos = $this->mWidth - $size; |
|
| 356 | + } else { |
|
| 357 | + $sPos = 0; |
|
| 358 | + } |
|
| 355 | 359 | |
| 356 | 360 | /* Total height of bar code -Bars only- */ |
| 357 | - if ($this->mStyle & BCS_DRAW_TEXT) $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2 - $this->GetFontHeight($this->mFont); |
|
| 358 | - else $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2; |
|
| 361 | + if ($this->mStyle & BCS_DRAW_TEXT) { |
|
| 362 | + $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2 - $this->GetFontHeight($this->mFont); |
|
| 363 | + } else { |
|
| 364 | + $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2; |
|
| 365 | + } |
|
| 359 | 366 | |
| 360 | 367 | /* Draw text */ |
| 361 | 368 | if ($this->mStyle & BCS_DRAW_TEXT) { |
@@ -58,109 +58,109 @@ discard block |
||
| 58 | 58 | $this->BarcodeObject($Width, $Height, $Style); |
| 59 | 59 | $this->mValue = $Value; |
| 60 | 60 | $this->mChars = " !\"#$%&'()*+�-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"; |
| 61 | - $this->mCharSet = array ( |
|
| 62 | - "212222", /* 00 */ |
|
| 63 | - "222122", /* 01 */ |
|
| 64 | - "222221", /* 02 */ |
|
| 65 | - "121223", /* 03 */ |
|
| 66 | - "121322", /* 04 */ |
|
| 67 | - "131222", /* 05 */ |
|
| 68 | - "122213", /* 06 */ |
|
| 69 | - "122312", /* 07 */ |
|
| 70 | - "132212", /* 08 */ |
|
| 71 | - "221213", /* 09 */ |
|
| 72 | - "221312", /* 10 */ |
|
| 73 | - "231212", /* 11 */ |
|
| 74 | - "112232", /* 12 */ |
|
| 75 | - "122132", /* 13 */ |
|
| 76 | - "122231", /* 14 */ |
|
| 77 | - "113222", /* 15 */ |
|
| 78 | - "123122", /* 16 */ |
|
| 79 | - "123221", /* 17 */ |
|
| 80 | - "223211", /* 18 */ |
|
| 81 | - "221132", /* 19 */ |
|
| 82 | - "221231", /* 20 */ |
|
| 83 | - "213212", /* 21 */ |
|
| 84 | - "223112", /* 22 */ |
|
| 85 | - "312131", /* 23 */ |
|
| 86 | - "311222", /* 24 */ |
|
| 87 | - "321122", /* 25 */ |
|
| 88 | - "321221", /* 26 */ |
|
| 89 | - "312212", /* 27 */ |
|
| 90 | - "322112", /* 28 */ |
|
| 91 | - "322211", /* 29 */ |
|
| 92 | - "212123", /* 30 */ |
|
| 93 | - "212321", /* 31 */ |
|
| 94 | - "232121", /* 32 */ |
|
| 95 | - "111323", /* 33 */ |
|
| 96 | - "131123", /* 34 */ |
|
| 97 | - "131321", /* 35 */ |
|
| 98 | - "112313", /* 36 */ |
|
| 99 | - "132113", /* 37 */ |
|
| 100 | - "132311", /* 38 */ |
|
| 101 | - "211313", /* 39 */ |
|
| 102 | - "231113", /* 40 */ |
|
| 103 | - "231311", /* 41 */ |
|
| 104 | - "112133", /* 42 */ |
|
| 105 | - "112331", /* 43 */ |
|
| 106 | - "132131", /* 44 */ |
|
| 107 | - "113123", /* 45 */ |
|
| 108 | - "113321", /* 46 */ |
|
| 109 | - "133121", /* 47 */ |
|
| 110 | - "313121", /* 48 */ |
|
| 111 | - "211331", /* 49 */ |
|
| 112 | - "231131", /* 50 */ |
|
| 113 | - "213113", /* 51 */ |
|
| 114 | - "213311", /* 52 */ |
|
| 115 | - "213131", /* 53 */ |
|
| 116 | - "311123", /* 54 */ |
|
| 117 | - "311321", /* 55 */ |
|
| 118 | - "331121", /* 56 */ |
|
| 119 | - "312113", /* 57 */ |
|
| 120 | - "312311", /* 58 */ |
|
| 121 | - "332111", /* 59 */ |
|
| 122 | - "314111", /* 60 */ |
|
| 123 | - "221411", /* 61 */ |
|
| 124 | - "431111", /* 62 */ |
|
| 125 | - "111224", /* 63 */ |
|
| 126 | - "111422", /* 64 */ |
|
| 127 | - "121124", /* 65 */ |
|
| 128 | - "121421", /* 66 */ |
|
| 129 | - "141122", /* 67 */ |
|
| 130 | - "141221", /* 68 */ |
|
| 131 | - "112214", /* 69 */ |
|
| 132 | - "112412", /* 70 */ |
|
| 133 | - "122114", /* 71 */ |
|
| 134 | - "122411", /* 72 */ |
|
| 135 | - "142112", /* 73 */ |
|
| 136 | - "142211", /* 74 */ |
|
| 137 | - "241211", /* 75 */ |
|
| 138 | - "221114", /* 76 */ |
|
| 139 | - "413111", /* 77 */ |
|
| 140 | - "241112", /* 78 */ |
|
| 141 | - "134111", /* 79 */ |
|
| 142 | - "111242", /* 80 */ |
|
| 143 | - "121142", /* 81 */ |
|
| 144 | - "121241", /* 82 */ |
|
| 145 | - "114212", /* 83 */ |
|
| 146 | - "124112", /* 84 */ |
|
| 147 | - "124211", /* 85 */ |
|
| 148 | - "411212", /* 86 */ |
|
| 149 | - "421112", /* 87 */ |
|
| 150 | - "421211", /* 88 */ |
|
| 151 | - "212141", /* 89 */ |
|
| 152 | - "214121", /* 90 */ |
|
| 153 | - "412121", /* 91 */ |
|
| 154 | - "111143", /* 92 */ |
|
| 155 | - "111341", /* 93 */ |
|
| 156 | - "131141", /* 94 */ |
|
| 157 | - "114113", /* 95 */ |
|
| 158 | - "114311", /* 96 */ |
|
| 159 | - "411113", /* 97 */ |
|
| 160 | - "411311", /* 98 */ |
|
| 161 | - "113141", /* 99 */ |
|
| 162 | - "114131", /* 100 */ |
|
| 163 | - "311141", /* 101 */ |
|
| 61 | + $this->mCharSet = array( |
|
| 62 | + "212222", /* 00 */ |
|
| 63 | + "222122", /* 01 */ |
|
| 64 | + "222221", /* 02 */ |
|
| 65 | + "121223", /* 03 */ |
|
| 66 | + "121322", /* 04 */ |
|
| 67 | + "131222", /* 05 */ |
|
| 68 | + "122213", /* 06 */ |
|
| 69 | + "122312", /* 07 */ |
|
| 70 | + "132212", /* 08 */ |
|
| 71 | + "221213", /* 09 */ |
|
| 72 | + "221312", /* 10 */ |
|
| 73 | + "231212", /* 11 */ |
|
| 74 | + "112232", /* 12 */ |
|
| 75 | + "122132", /* 13 */ |
|
| 76 | + "122231", /* 14 */ |
|
| 77 | + "113222", /* 15 */ |
|
| 78 | + "123122", /* 16 */ |
|
| 79 | + "123221", /* 17 */ |
|
| 80 | + "223211", /* 18 */ |
|
| 81 | + "221132", /* 19 */ |
|
| 82 | + "221231", /* 20 */ |
|
| 83 | + "213212", /* 21 */ |
|
| 84 | + "223112", /* 22 */ |
|
| 85 | + "312131", /* 23 */ |
|
| 86 | + "311222", /* 24 */ |
|
| 87 | + "321122", /* 25 */ |
|
| 88 | + "321221", /* 26 */ |
|
| 89 | + "312212", /* 27 */ |
|
| 90 | + "322112", /* 28 */ |
|
| 91 | + "322211", /* 29 */ |
|
| 92 | + "212123", /* 30 */ |
|
| 93 | + "212321", /* 31 */ |
|
| 94 | + "232121", /* 32 */ |
|
| 95 | + "111323", /* 33 */ |
|
| 96 | + "131123", /* 34 */ |
|
| 97 | + "131321", /* 35 */ |
|
| 98 | + "112313", /* 36 */ |
|
| 99 | + "132113", /* 37 */ |
|
| 100 | + "132311", /* 38 */ |
|
| 101 | + "211313", /* 39 */ |
|
| 102 | + "231113", /* 40 */ |
|
| 103 | + "231311", /* 41 */ |
|
| 104 | + "112133", /* 42 */ |
|
| 105 | + "112331", /* 43 */ |
|
| 106 | + "132131", /* 44 */ |
|
| 107 | + "113123", /* 45 */ |
|
| 108 | + "113321", /* 46 */ |
|
| 109 | + "133121", /* 47 */ |
|
| 110 | + "313121", /* 48 */ |
|
| 111 | + "211331", /* 49 */ |
|
| 112 | + "231131", /* 50 */ |
|
| 113 | + "213113", /* 51 */ |
|
| 114 | + "213311", /* 52 */ |
|
| 115 | + "213131", /* 53 */ |
|
| 116 | + "311123", /* 54 */ |
|
| 117 | + "311321", /* 55 */ |
|
| 118 | + "331121", /* 56 */ |
|
| 119 | + "312113", /* 57 */ |
|
| 120 | + "312311", /* 58 */ |
|
| 121 | + "332111", /* 59 */ |
|
| 122 | + "314111", /* 60 */ |
|
| 123 | + "221411", /* 61 */ |
|
| 124 | + "431111", /* 62 */ |
|
| 125 | + "111224", /* 63 */ |
|
| 126 | + "111422", /* 64 */ |
|
| 127 | + "121124", /* 65 */ |
|
| 128 | + "121421", /* 66 */ |
|
| 129 | + "141122", /* 67 */ |
|
| 130 | + "141221", /* 68 */ |
|
| 131 | + "112214", /* 69 */ |
|
| 132 | + "112412", /* 70 */ |
|
| 133 | + "122114", /* 71 */ |
|
| 134 | + "122411", /* 72 */ |
|
| 135 | + "142112", /* 73 */ |
|
| 136 | + "142211", /* 74 */ |
|
| 137 | + "241211", /* 75 */ |
|
| 138 | + "221114", /* 76 */ |
|
| 139 | + "413111", /* 77 */ |
|
| 140 | + "241112", /* 78 */ |
|
| 141 | + "134111", /* 79 */ |
|
| 142 | + "111242", /* 80 */ |
|
| 143 | + "121142", /* 81 */ |
|
| 144 | + "121241", /* 82 */ |
|
| 145 | + "114212", /* 83 */ |
|
| 146 | + "124112", /* 84 */ |
|
| 147 | + "124211", /* 85 */ |
|
| 148 | + "411212", /* 86 */ |
|
| 149 | + "421112", /* 87 */ |
|
| 150 | + "421211", /* 88 */ |
|
| 151 | + "212141", /* 89 */ |
|
| 152 | + "214121", /* 90 */ |
|
| 153 | + "412121", /* 91 */ |
|
| 154 | + "111143", /* 92 */ |
|
| 155 | + "111341", /* 93 */ |
|
| 156 | + "131141", /* 94 */ |
|
| 157 | + "114113", /* 95 */ |
|
| 158 | + "114311", /* 96 */ |
|
| 159 | + "411113", /* 97 */ |
|
| 160 | + "411311", /* 98 */ |
|
| 161 | + "113141", /* 99 */ |
|
| 162 | + "114131", /* 100 */ |
|
| 163 | + "311141", /* 101 */ |
|
| 164 | 164 | "411131" /* 102 */ |
| 165 | 165 | ); |
| 166 | 166 | } |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | * @access private |
| 173 | 173 | */ |
| 174 | 174 | function GetCharIndex($char) { |
| 175 | - for ($i=0;$i<64;$i++) { |
|
| 175 | + for ($i = 0; $i < 64; $i++) { |
|
| 176 | 176 | if ($this->mChars[$i] == $char) { |
| 177 | 177 | return $i; |
| 178 | 178 | } |
@@ -221,12 +221,12 @@ discard block |
||
| 221 | 221 | function GetSize($xres) { |
| 222 | 222 | $len = strlen($this->mValue); |
| 223 | 223 | |
| 224 | - if ($len == 0) { |
|
| 224 | + if ($len == 0) { |
|
| 225 | 225 | $this->mError = "Null value"; |
| 226 | 226 | return false; |
| 227 | 227 | } |
| 228 | 228 | $ret = 0; |
| 229 | - for ($i=0;$i<$len;$i++) { |
|
| 229 | + for ($i = 0; $i < $len; $i++) { |
|
| 230 | 230 | if (($id = $this->GetCharIndex($this->mValue[$i])) == -1) { |
| 231 | 231 | $this->mError = "C128A not include the char '".$this->mValue[$i]."'"; |
| 232 | 232 | return false; |
@@ -244,11 +244,11 @@ discard block |
||
| 244 | 244 | /* length of Check character */ |
| 245 | 245 | $cset = $this->GetCheckCharValue(); |
| 246 | 246 | $CheckSize = 0; |
| 247 | - for ($i=0;$i<6;$i++) { |
|
| 247 | + for ($i = 0; $i < 6; $i++) { |
|
| 248 | 248 | $CheckSize += $this->GetBarSize($cset[$i], $xres); |
| 249 | 249 | } |
| 250 | - $StartSize = 2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres; |
|
| 251 | - $StopSize = 2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + 2*BCD_C128_BAR_3*$xres; |
|
| 250 | + $StartSize = 2 * BCD_C128_BAR_2 * $xres + 3 * BCD_C128_BAR_1 * $xres + BCD_C128_BAR_4 * $xres; |
|
| 251 | + $StopSize = 2 * BCD_C128_BAR_2 * $xres + 3 * BCD_C128_BAR_1 * $xres + 2 * BCD_C128_BAR_3 * $xres; |
|
| 252 | 252 | return $StartSize + $ret + $CheckSize + $StopSize; |
| 253 | 253 | } |
| 254 | 254 | |
@@ -260,10 +260,10 @@ discard block |
||
| 260 | 260 | function GetCheckCharValue() { |
| 261 | 261 | $len = strlen($this->mValue); |
| 262 | 262 | $sum = 103; // 'A' type; |
| 263 | - for ($i=0;$i<$len;$i++) { |
|
| 264 | - $sum += $this->GetCharIndex($this->mValue[$i]) * ($i+1); |
|
| 263 | + for ($i = 0; $i < $len; $i++) { |
|
| 264 | + $sum += $this->GetCharIndex($this->mValue[$i]) * ($i + 1); |
|
| 265 | 265 | } |
| 266 | - $check = $sum % 103; |
|
| 266 | + $check = $sum % 103; |
|
| 267 | 267 | return $this->mCharSet[$check]; |
| 268 | 268 | } |
| 269 | 269 | |
@@ -278,13 +278,13 @@ discard block |
||
| 278 | 278 | */ |
| 279 | 279 | function DrawStart($DrawPos, $yPos, $ySize, $xres) { |
| 280 | 280 | /* Start code is '211412' */ |
| 281 | - $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres) , $ySize); |
|
| 281 | + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres), $ySize); |
|
| 282 | 282 | $DrawPos += $this->GetBarSize('2', $xres); |
| 283 | 283 | $DrawPos += $this->GetBarSize('1', $xres); |
| 284 | - $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('1', $xres) , $ySize); |
|
| 284 | + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('1', $xres), $ySize); |
|
| 285 | 285 | $DrawPos += $this->GetBarSize('1', $xres); |
| 286 | 286 | $DrawPos += $this->GetBarSize('4', $xres); |
| 287 | - $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('1', $xres) , $ySize); |
|
| 287 | + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('1', $xres), $ySize); |
|
| 288 | 288 | $DrawPos += $this->GetBarSize('1', $xres); |
| 289 | 289 | $DrawPos += $this->GetBarSize('2', $xres); |
| 290 | 290 | return $DrawPos; |
@@ -301,16 +301,16 @@ discard block |
||
| 301 | 301 | */ |
| 302 | 302 | function DrawStop($DrawPos, $yPos, $ySize, $xres) { |
| 303 | 303 | /* Stop code is '2331112' */ |
| 304 | - $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres) , $ySize); |
|
| 304 | + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres), $ySize); |
|
| 305 | 305 | $DrawPos += $this->GetBarSize('2', $xres); |
| 306 | 306 | $DrawPos += $this->GetBarSize('3', $xres); |
| 307 | - $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('3', $xres) , $ySize); |
|
| 307 | + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('3', $xres), $ySize); |
|
| 308 | 308 | $DrawPos += $this->GetBarSize('3', $xres); |
| 309 | 309 | $DrawPos += $this->GetBarSize('1', $xres); |
| 310 | - $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('1', $xres) , $ySize); |
|
| 310 | + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('1', $xres), $ySize); |
|
| 311 | 311 | $DrawPos += $this->GetBarSize('1', $xres); |
| 312 | 312 | $DrawPos += $this->GetBarSize('1', $xres); |
| 313 | - $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres) , $ySize); |
|
| 313 | + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres), $ySize); |
|
| 314 | 314 | $DrawPos += $this->GetBarSize('2', $xres); |
| 315 | 315 | return $DrawPos; |
| 316 | 316 | } |
@@ -326,13 +326,13 @@ discard block |
||
| 326 | 326 | */ |
| 327 | 327 | function DrawCheckChar($DrawPos, $yPos, $ySize, $xres) { |
| 328 | 328 | $cset = $this->GetCheckCharValue(); |
| 329 | - $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[0], $xres) , $ySize); |
|
| 329 | + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[0], $xres), $ySize); |
|
| 330 | 330 | $DrawPos += $this->GetBarSize($cset[0], $xres); |
| 331 | 331 | $DrawPos += $this->GetBarSize($cset[1], $xres); |
| 332 | - $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[2], $xres) , $ySize); |
|
| 332 | + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[2], $xres), $ySize); |
|
| 333 | 333 | $DrawPos += $this->GetBarSize($cset[2], $xres); |
| 334 | 334 | $DrawPos += $this->GetBarSize($cset[3], $xres); |
| 335 | - $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[4], $xres) , $ySize); |
|
| 335 | + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[4], $xres), $ySize); |
|
| 336 | 336 | $DrawPos += $this->GetBarSize($cset[4], $xres); |
| 337 | 337 | $DrawPos += $this->GetBarSize($cset[5], $xres); |
| 338 | 338 | return $DrawPos; |
@@ -345,11 +345,11 @@ discard block |
||
| 345 | 345 | */ |
| 346 | 346 | function DrawObject($xres) { |
| 347 | 347 | $len = strlen($this->mValue); |
| 348 | - if (($size = $this->GetSize($xres))==0) { |
|
| 348 | + if (($size = $this->GetSize($xres)) == 0) { |
|
| 349 | 349 | return false; |
| 350 | 350 | } |
| 351 | 351 | |
| 352 | - if ($this->mStyle & BCS_ALIGN_CENTER) $sPos = (integer)(($this->mWidth - $size ) / 2); |
|
| 352 | + if ($this->mStyle & BCS_ALIGN_CENTER) $sPos = (integer)(($this->mWidth - $size) / 2); |
|
| 353 | 353 | else if ($this->mStyle & BCS_ALIGN_RIGHT) $sPos = $this->mWidth - $size; |
| 354 | 354 | else $sPos = 0; |
| 355 | 355 | |
@@ -360,35 +360,35 @@ discard block |
||
| 360 | 360 | /* Draw text */ |
| 361 | 361 | if ($this->mStyle & BCS_DRAW_TEXT) { |
| 362 | 362 | if ($this->mStyle & BCS_STRETCH_TEXT) { |
| 363 | - for ($i=0;$i<$len;$i++) { |
|
| 364 | - $this->DrawChar($this->mFont, $sPos+(2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres)+($size/$len)*$i, |
|
| 363 | + for ($i = 0; $i < $len; $i++) { |
|
| 364 | + $this->DrawChar($this->mFont, $sPos + (2 * BCD_C128_BAR_2 * $xres + 3 * BCD_C128_BAR_1 * $xres + BCD_C128_BAR_4 * $xres) + ($size / $len) * $i, |
|
| 365 | 365 | $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET, $this->mValue[$i]); |
| 366 | 366 | } |
| 367 | 367 | } else {/* Center */ |
| 368 | 368 | $text_width = $this->GetFontWidth($this->mFont) * strlen($this->mValue); |
| 369 | - $this->DrawText($this->mFont, $sPos+(($size-$text_width)/2)+(2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres), |
|
| 369 | + $this->DrawText($this->mFont, $sPos + (($size - $text_width) / 2) + (2 * BCD_C128_BAR_2 * $xres + 3 * BCD_C128_BAR_1 * $xres + BCD_C128_BAR_4 * $xres), |
|
| 370 | 370 | $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET, $this->mValue); |
| 371 | 371 | } |
| 372 | 372 | } |
| 373 | 373 | |
| 374 | 374 | $cPos = 0; |
| 375 | - $DrawPos = $this->DrawStart($sPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres); |
|
| 375 | + $DrawPos = $this->DrawStart($sPos, BCD_DEFAULT_MAR_Y1, $ysize, $xres); |
|
| 376 | 376 | do { |
| 377 | 377 | $c = $this->GetCharIndex($this->mValue[$cPos]); |
| 378 | 378 | $cset = $this->mCharSet[$c]; |
| 379 | - $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[0], $xres) , $ysize); |
|
| 379 | + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[0], $xres), $ysize); |
|
| 380 | 380 | $DrawPos += $this->GetBarSize($cset[0], $xres); |
| 381 | 381 | $DrawPos += $this->GetBarSize($cset[1], $xres); |
| 382 | - $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[2], $xres) , $ysize); |
|
| 382 | + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[2], $xres), $ysize); |
|
| 383 | 383 | $DrawPos += $this->GetBarSize($cset[2], $xres); |
| 384 | 384 | $DrawPos += $this->GetBarSize($cset[3], $xres); |
| 385 | - $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[4], $xres) , $ysize); |
|
| 385 | + $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[4], $xres), $ysize); |
|
| 386 | 386 | $DrawPos += $this->GetBarSize($cset[4], $xres); |
| 387 | 387 | $DrawPos += $this->GetBarSize($cset[5], $xres); |
| 388 | 388 | $cPos++; |
| 389 | - } while ($cPos<$len); |
|
| 390 | - $DrawPos = $this->DrawCheckChar($DrawPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres); |
|
| 391 | - $DrawPos = $this->DrawStop($DrawPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres); |
|
| 389 | + } while ($cPos < $len); |
|
| 390 | + $DrawPos = $this->DrawCheckChar($DrawPos, BCD_DEFAULT_MAR_Y1, $ysize, $xres); |
|
| 391 | + $DrawPos = $this->DrawStop($DrawPos, BCD_DEFAULT_MAR_Y1, $ysize, $xres); |
|
| 392 | 392 | return true; |
| 393 | 393 | } |
| 394 | 394 | } |
@@ -349,13 +349,20 @@ |
||
| 349 | 349 | return false; |
| 350 | 350 | } |
| 351 | 351 | |
| 352 | - if ($this->mStyle & BCS_ALIGN_CENTER) $sPos = (integer)(($this->mWidth - $size ) / 2); |
|
| 353 | - else if ($this->mStyle & BCS_ALIGN_RIGHT) $sPos = $this->mWidth - $size; |
|
| 354 | - else $sPos = 0; |
|
| 352 | + if ($this->mStyle & BCS_ALIGN_CENTER) { |
|
| 353 | + $sPos = (integer)(($this->mWidth - $size ) / 2); |
|
| 354 | + } else if ($this->mStyle & BCS_ALIGN_RIGHT) { |
|
| 355 | + $sPos = $this->mWidth - $size; |
|
| 356 | + } else { |
|
| 357 | + $sPos = 0; |
|
| 358 | + } |
|
| 355 | 359 | |
| 356 | 360 | /* Total height of bar code -Bars only- */ |
| 357 | - if ($this->mStyle & BCS_DRAW_TEXT) $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2 - $this->GetFontHeight($this->mFont); |
|
| 358 | - else $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2; |
|
| 361 | + if ($this->mStyle & BCS_DRAW_TEXT) { |
|
| 362 | + $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2 - $this->GetFontHeight($this->mFont); |
|
| 363 | + } else { |
|
| 364 | + $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2; |
|
| 365 | + } |
|
| 359 | 366 | |
| 360 | 367 | /* Draw text */ |
| 361 | 368 | if ($this->mStyle & BCS_DRAW_TEXT) { |