@@ -1,15 +1,15 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
2 | -$fpdf_charwidths['helvetica']=array( |
|
3 | - chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278, |
|
4 | - chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>278,'"'=>355,'#'=>556,'$'=>556,'%'=>889,'&'=>667,'\''=>191,'('=>333,')'=>333,'*'=>389,'+'=>584, |
|
5 | - ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>278,';'=>278,'<'=>584,'='=>584,'>'=>584,'?'=>556,'@'=>1015,'A'=>667, |
|
6 | - 'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>500,'K'=>667,'L'=>556,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944, |
|
7 | - 'X'=>667,'Y'=>667,'Z'=>611,'['=>278,'\\'=>278,']'=>278,'^'=>469,'_'=>556,'`'=>333,'a'=>556,'b'=>556,'c'=>500,'d'=>556,'e'=>556,'f'=>278,'g'=>556,'h'=>556,'i'=>222,'j'=>222,'k'=>500,'l'=>222,'m'=>833, |
|
8 | - 'n'=>556,'o'=>556,'p'=>556,'q'=>556,'r'=>333,'s'=>500,'t'=>278,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>500,'{'=>334,'|'=>260,'}'=>334,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>222,chr(131)=>556, |
|
9 | - chr(132)=>333,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>222,chr(146)=>222,chr(147)=>333,chr(148)=>333,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, |
|
10 | - chr(154)=>500,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>260,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333, |
|
11 | - chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>556,chr(182)=>537,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667, |
|
12 | - chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, |
|
13 | - chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>500,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>556,chr(241)=>556, |
|
14 | - chr(242)=>556,chr(243)=>556,chr(244)=>556,chr(245)=>556,chr(246)=>556,chr(247)=>584,chr(248)=>611,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500); |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | +$fpdf_charwidths['helvetica'] = array( |
|
3 | + chr(0)=>278, chr(1)=>278, chr(2)=>278, chr(3)=>278, chr(4)=>278, chr(5)=>278, chr(6)=>278, chr(7)=>278, chr(8)=>278, chr(9)=>278, chr(10)=>278, chr(11)=>278, chr(12)=>278, chr(13)=>278, chr(14)=>278, chr(15)=>278, chr(16)=>278, chr(17)=>278, chr(18)=>278, chr(19)=>278, chr(20)=>278, chr(21)=>278, |
|
4 | + chr(22)=>278, chr(23)=>278, chr(24)=>278, chr(25)=>278, chr(26)=>278, chr(27)=>278, chr(28)=>278, chr(29)=>278, chr(30)=>278, chr(31)=>278, ' '=>278, '!'=>278, '"'=>355, '#'=>556, '$'=>556, '%'=>889, '&'=>667, '\''=>191, '('=>333, ')'=>333, '*'=>389, '+'=>584, |
|
5 | + ','=>278, '-'=>333, '.'=>278, '/'=>278, '0'=>556, '1'=>556, '2'=>556, '3'=>556, '4'=>556, '5'=>556, '6'=>556, '7'=>556, '8'=>556, '9'=>556, ':'=>278, ';'=>278, '<'=>584, '='=>584, '>'=>584, '?'=>556, '@'=>1015, 'A'=>667, |
|
6 | + 'B'=>667, 'C'=>722, 'D'=>722, 'E'=>667, 'F'=>611, 'G'=>778, 'H'=>722, 'I'=>278, 'J'=>500, 'K'=>667, 'L'=>556, 'M'=>833, 'N'=>722, 'O'=>778, 'P'=>667, 'Q'=>778, 'R'=>722, 'S'=>667, 'T'=>611, 'U'=>722, 'V'=>667, 'W'=>944, |
|
7 | + 'X'=>667, 'Y'=>667, 'Z'=>611, '['=>278, '\\'=>278, ']'=>278, '^'=>469, '_'=>556, '`'=>333, 'a'=>556, 'b'=>556, 'c'=>500, 'd'=>556, 'e'=>556, 'f'=>278, 'g'=>556, 'h'=>556, 'i'=>222, 'j'=>222, 'k'=>500, 'l'=>222, 'm'=>833, |
|
8 | + 'n'=>556, 'o'=>556, 'p'=>556, 'q'=>556, 'r'=>333, 's'=>500, 't'=>278, 'u'=>556, 'v'=>500, 'w'=>722, 'x'=>500, 'y'=>500, 'z'=>500, '{'=>334, '|'=>260, '}'=>334, '~'=>584, chr(127)=>350, chr(128)=>556, chr(129)=>350, chr(130)=>222, chr(131)=>556, |
|
9 | + chr(132)=>333, chr(133)=>1000, chr(134)=>556, chr(135)=>556, chr(136)=>333, chr(137)=>1000, chr(138)=>667, chr(139)=>333, chr(140)=>1000, chr(141)=>350, chr(142)=>611, chr(143)=>350, chr(144)=>350, chr(145)=>222, chr(146)=>222, chr(147)=>333, chr(148)=>333, chr(149)=>350, chr(150)=>556, chr(151)=>1000, chr(152)=>333, chr(153)=>1000, |
|
10 | + chr(154)=>500, chr(155)=>333, chr(156)=>944, chr(157)=>350, chr(158)=>500, chr(159)=>667, chr(160)=>278, chr(161)=>333, chr(162)=>556, chr(163)=>556, chr(164)=>556, chr(165)=>556, chr(166)=>260, chr(167)=>556, chr(168)=>333, chr(169)=>737, chr(170)=>370, chr(171)=>556, chr(172)=>584, chr(173)=>333, chr(174)=>737, chr(175)=>333, |
|
11 | + chr(176)=>400, chr(177)=>584, chr(178)=>333, chr(179)=>333, chr(180)=>333, chr(181)=>556, chr(182)=>537, chr(183)=>278, chr(184)=>333, chr(185)=>333, chr(186)=>365, chr(187)=>556, chr(188)=>834, chr(189)=>834, chr(190)=>834, chr(191)=>611, chr(192)=>667, chr(193)=>667, chr(194)=>667, chr(195)=>667, chr(196)=>667, chr(197)=>667, |
|
12 | + chr(198)=>1000, chr(199)=>722, chr(200)=>667, chr(201)=>667, chr(202)=>667, chr(203)=>667, chr(204)=>278, chr(205)=>278, chr(206)=>278, chr(207)=>278, chr(208)=>722, chr(209)=>722, chr(210)=>778, chr(211)=>778, chr(212)=>778, chr(213)=>778, chr(214)=>778, chr(215)=>584, chr(216)=>778, chr(217)=>722, chr(218)=>722, chr(219)=>722, |
|
13 | + chr(220)=>722, chr(221)=>667, chr(222)=>667, chr(223)=>611, chr(224)=>556, chr(225)=>556, chr(226)=>556, chr(227)=>556, chr(228)=>556, chr(229)=>556, chr(230)=>889, chr(231)=>500, chr(232)=>556, chr(233)=>556, chr(234)=>556, chr(235)=>556, chr(236)=>278, chr(237)=>278, chr(238)=>278, chr(239)=>278, chr(240)=>556, chr(241)=>556, |
|
14 | + chr(242)=>556, chr(243)=>556, chr(244)=>556, chr(245)=>556, chr(246)=>556, chr(247)=>584, chr(248)=>611, chr(249)=>556, chr(250)=>556, chr(251)=>556, chr(252)=>556, chr(253)=>500, chr(254)=>556, chr(255)=>500); |
|
15 | 15 | ?> |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | $fpdf_charwidths['helvetica']=array( |
3 | 5 | chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278, |
4 | 6 | chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>278,'"'=>355,'#'=>556,'$'=>556,'%'=>889,'&'=>667,'\''=>191,'('=>333,')'=>333,'*'=>389,'+'=>584, |
@@ -1,15 +1,15 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
2 | -$fpdf_charwidths['timesI']=array( |
|
3 | - chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, |
|
4 | - chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>420,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>214,'('=>333,')'=>333,'*'=>500,'+'=>675, |
|
5 | - ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>675,'='=>675,'>'=>675,'?'=>500,'@'=>920,'A'=>611, |
|
6 | - 'B'=>611,'C'=>667,'D'=>722,'E'=>611,'F'=>611,'G'=>722,'H'=>722,'I'=>333,'J'=>444,'K'=>667,'L'=>556,'M'=>833,'N'=>667,'O'=>722,'P'=>611,'Q'=>722,'R'=>611,'S'=>500,'T'=>556,'U'=>722,'V'=>611,'W'=>833, |
|
7 | - 'X'=>611,'Y'=>556,'Z'=>556,'['=>389,'\\'=>278,']'=>389,'^'=>422,'_'=>500,'`'=>333,'a'=>500,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>278,'g'=>500,'h'=>500,'i'=>278,'j'=>278,'k'=>444,'l'=>278,'m'=>722, |
|
8 | - 'n'=>500,'o'=>500,'p'=>500,'q'=>500,'r'=>389,'s'=>389,'t'=>278,'u'=>500,'v'=>444,'w'=>667,'x'=>444,'y'=>444,'z'=>389,'{'=>400,'|'=>275,'}'=>400,'~'=>541,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500, |
|
9 | - chr(132)=>556,chr(133)=>889,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>500,chr(139)=>333,chr(140)=>944,chr(141)=>350,chr(142)=>556,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>556,chr(148)=>556,chr(149)=>350,chr(150)=>500,chr(151)=>889,chr(152)=>333,chr(153)=>980, |
|
10 | - chr(154)=>389,chr(155)=>333,chr(156)=>667,chr(157)=>350,chr(158)=>389,chr(159)=>556,chr(160)=>250,chr(161)=>389,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>275,chr(167)=>500,chr(168)=>333,chr(169)=>760,chr(170)=>276,chr(171)=>500,chr(172)=>675,chr(173)=>333,chr(174)=>760,chr(175)=>333, |
|
11 | - chr(176)=>400,chr(177)=>675,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>500,chr(182)=>523,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>310,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>611,chr(193)=>611,chr(194)=>611,chr(195)=>611,chr(196)=>611,chr(197)=>611, |
|
12 | - chr(198)=>889,chr(199)=>667,chr(200)=>611,chr(201)=>611,chr(202)=>611,chr(203)=>611,chr(204)=>333,chr(205)=>333,chr(206)=>333,chr(207)=>333,chr(208)=>722,chr(209)=>667,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>675,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722, |
|
13 | - chr(220)=>722,chr(221)=>556,chr(222)=>611,chr(223)=>500,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>667,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>500, |
|
14 | - chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>675,chr(248)=>500,chr(249)=>500,chr(250)=>500,chr(251)=>500,chr(252)=>500,chr(253)=>444,chr(254)=>500,chr(255)=>444); |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | +$fpdf_charwidths['timesI'] = array( |
|
3 | + chr(0)=>250, chr(1)=>250, chr(2)=>250, chr(3)=>250, chr(4)=>250, chr(5)=>250, chr(6)=>250, chr(7)=>250, chr(8)=>250, chr(9)=>250, chr(10)=>250, chr(11)=>250, chr(12)=>250, chr(13)=>250, chr(14)=>250, chr(15)=>250, chr(16)=>250, chr(17)=>250, chr(18)=>250, chr(19)=>250, chr(20)=>250, chr(21)=>250, |
|
4 | + chr(22)=>250, chr(23)=>250, chr(24)=>250, chr(25)=>250, chr(26)=>250, chr(27)=>250, chr(28)=>250, chr(29)=>250, chr(30)=>250, chr(31)=>250, ' '=>250, '!'=>333, '"'=>420, '#'=>500, '$'=>500, '%'=>833, '&'=>778, '\''=>214, '('=>333, ')'=>333, '*'=>500, '+'=>675, |
|
5 | + ','=>250, '-'=>333, '.'=>250, '/'=>278, '0'=>500, '1'=>500, '2'=>500, '3'=>500, '4'=>500, '5'=>500, '6'=>500, '7'=>500, '8'=>500, '9'=>500, ':'=>333, ';'=>333, '<'=>675, '='=>675, '>'=>675, '?'=>500, '@'=>920, 'A'=>611, |
|
6 | + 'B'=>611, 'C'=>667, 'D'=>722, 'E'=>611, 'F'=>611, 'G'=>722, 'H'=>722, 'I'=>333, 'J'=>444, 'K'=>667, 'L'=>556, 'M'=>833, 'N'=>667, 'O'=>722, 'P'=>611, 'Q'=>722, 'R'=>611, 'S'=>500, 'T'=>556, 'U'=>722, 'V'=>611, 'W'=>833, |
|
7 | + 'X'=>611, 'Y'=>556, 'Z'=>556, '['=>389, '\\'=>278, ']'=>389, '^'=>422, '_'=>500, '`'=>333, 'a'=>500, 'b'=>500, 'c'=>444, 'd'=>500, 'e'=>444, 'f'=>278, 'g'=>500, 'h'=>500, 'i'=>278, 'j'=>278, 'k'=>444, 'l'=>278, 'm'=>722, |
|
8 | + 'n'=>500, 'o'=>500, 'p'=>500, 'q'=>500, 'r'=>389, 's'=>389, 't'=>278, 'u'=>500, 'v'=>444, 'w'=>667, 'x'=>444, 'y'=>444, 'z'=>389, '{'=>400, '|'=>275, '}'=>400, '~'=>541, chr(127)=>350, chr(128)=>500, chr(129)=>350, chr(130)=>333, chr(131)=>500, |
|
9 | + chr(132)=>556, chr(133)=>889, chr(134)=>500, chr(135)=>500, chr(136)=>333, chr(137)=>1000, chr(138)=>500, chr(139)=>333, chr(140)=>944, chr(141)=>350, chr(142)=>556, chr(143)=>350, chr(144)=>350, chr(145)=>333, chr(146)=>333, chr(147)=>556, chr(148)=>556, chr(149)=>350, chr(150)=>500, chr(151)=>889, chr(152)=>333, chr(153)=>980, |
|
10 | + chr(154)=>389, chr(155)=>333, chr(156)=>667, chr(157)=>350, chr(158)=>389, chr(159)=>556, chr(160)=>250, chr(161)=>389, chr(162)=>500, chr(163)=>500, chr(164)=>500, chr(165)=>500, chr(166)=>275, chr(167)=>500, chr(168)=>333, chr(169)=>760, chr(170)=>276, chr(171)=>500, chr(172)=>675, chr(173)=>333, chr(174)=>760, chr(175)=>333, |
|
11 | + chr(176)=>400, chr(177)=>675, chr(178)=>300, chr(179)=>300, chr(180)=>333, chr(181)=>500, chr(182)=>523, chr(183)=>250, chr(184)=>333, chr(185)=>300, chr(186)=>310, chr(187)=>500, chr(188)=>750, chr(189)=>750, chr(190)=>750, chr(191)=>500, chr(192)=>611, chr(193)=>611, chr(194)=>611, chr(195)=>611, chr(196)=>611, chr(197)=>611, |
|
12 | + chr(198)=>889, chr(199)=>667, chr(200)=>611, chr(201)=>611, chr(202)=>611, chr(203)=>611, chr(204)=>333, chr(205)=>333, chr(206)=>333, chr(207)=>333, chr(208)=>722, chr(209)=>667, chr(210)=>722, chr(211)=>722, chr(212)=>722, chr(213)=>722, chr(214)=>722, chr(215)=>675, chr(216)=>722, chr(217)=>722, chr(218)=>722, chr(219)=>722, |
|
13 | + chr(220)=>722, chr(221)=>556, chr(222)=>611, chr(223)=>500, chr(224)=>500, chr(225)=>500, chr(226)=>500, chr(227)=>500, chr(228)=>500, chr(229)=>500, chr(230)=>667, chr(231)=>444, chr(232)=>444, chr(233)=>444, chr(234)=>444, chr(235)=>444, chr(236)=>278, chr(237)=>278, chr(238)=>278, chr(239)=>278, chr(240)=>500, chr(241)=>500, |
|
14 | + chr(242)=>500, chr(243)=>500, chr(244)=>500, chr(245)=>500, chr(246)=>500, chr(247)=>675, chr(248)=>500, chr(249)=>500, chr(250)=>500, chr(251)=>500, chr(252)=>500, chr(253)=>444, chr(254)=>500, chr(255)=>444); |
|
15 | 15 | ?> |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | $fpdf_charwidths['timesI']=array( |
3 | 5 | chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, |
4 | 6 | chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>420,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>214,'('=>333,')'=>333,'*'=>500,'+'=>675, |
@@ -1,7 +1,7 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
2 | -for($i=0;$i<=255;$i++) |
|
3 | - $fpdf_charwidths['courier'][chr($i)]=600; |
|
4 | -$fpdf_charwidths['courierB']=$fpdf_charwidths['courier']; |
|
5 | -$fpdf_charwidths['courierI']=$fpdf_charwidths['courier']; |
|
6 | -$fpdf_charwidths['courierBI']=$fpdf_charwidths['courier']; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | +for ($i = 0; $i <= 255; $i++) |
|
3 | + $fpdf_charwidths['courier'][chr($i)] = 600; |
|
4 | +$fpdf_charwidths['courierB'] = $fpdf_charwidths['courier']; |
|
5 | +$fpdf_charwidths['courierI'] = $fpdf_charwidths['courier']; |
|
6 | +$fpdf_charwidths['courierBI'] = $fpdf_charwidths['courier']; |
|
7 | 7 | ?> |
@@ -1,6 +1,9 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
2 | -for($i=0;$i<=255;$i++) |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
4 | +for($i=0;$i<=255;$i++) { |
|
3 | 5 | $fpdf_charwidths['courier'][chr($i)]=600; |
6 | +} |
|
4 | 7 | $fpdf_charwidths['courierB']=$fpdf_charwidths['courier']; |
5 | 8 | $fpdf_charwidths['courierI']=$fpdf_charwidths['courier']; |
6 | 9 | $fpdf_charwidths['courierBI']=$fpdf_charwidths['courier']; |
@@ -1,15 +1,15 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
2 | -$fpdf_charwidths['timesBI']=array( |
|
3 | - chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, |
|
4 | - chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>389,'"'=>555,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>278,'('=>333,')'=>333,'*'=>500,'+'=>570, |
|
5 | - ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>570,'='=>570,'>'=>570,'?'=>500,'@'=>832,'A'=>667, |
|
6 | - 'B'=>667,'C'=>667,'D'=>722,'E'=>667,'F'=>667,'G'=>722,'H'=>778,'I'=>389,'J'=>500,'K'=>667,'L'=>611,'M'=>889,'N'=>722,'O'=>722,'P'=>611,'Q'=>722,'R'=>667,'S'=>556,'T'=>611,'U'=>722,'V'=>667,'W'=>889, |
|
7 | - 'X'=>667,'Y'=>611,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>570,'_'=>500,'`'=>333,'a'=>500,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>333,'g'=>500,'h'=>556,'i'=>278,'j'=>278,'k'=>500,'l'=>278,'m'=>778, |
|
8 | - 'n'=>556,'o'=>500,'p'=>500,'q'=>500,'r'=>389,'s'=>389,'t'=>278,'u'=>556,'v'=>444,'w'=>667,'x'=>500,'y'=>444,'z'=>389,'{'=>348,'|'=>220,'}'=>348,'~'=>570,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500, |
|
9 | - chr(132)=>500,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>944,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, |
|
10 | - chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>389,chr(159)=>611,chr(160)=>250,chr(161)=>389,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>220,chr(167)=>500,chr(168)=>333,chr(169)=>747,chr(170)=>266,chr(171)=>500,chr(172)=>606,chr(173)=>333,chr(174)=>747,chr(175)=>333, |
|
11 | - chr(176)=>400,chr(177)=>570,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>576,chr(182)=>500,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>300,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667, |
|
12 | - chr(198)=>944,chr(199)=>667,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>389,chr(205)=>389,chr(206)=>389,chr(207)=>389,chr(208)=>722,chr(209)=>722,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>570,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722, |
|
13 | - chr(220)=>722,chr(221)=>611,chr(222)=>611,chr(223)=>500,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>722,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>556, |
|
14 | - chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>570,chr(248)=>500,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>444,chr(254)=>500,chr(255)=>444); |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | +$fpdf_charwidths['timesBI'] = array( |
|
3 | + chr(0)=>250, chr(1)=>250, chr(2)=>250, chr(3)=>250, chr(4)=>250, chr(5)=>250, chr(6)=>250, chr(7)=>250, chr(8)=>250, chr(9)=>250, chr(10)=>250, chr(11)=>250, chr(12)=>250, chr(13)=>250, chr(14)=>250, chr(15)=>250, chr(16)=>250, chr(17)=>250, chr(18)=>250, chr(19)=>250, chr(20)=>250, chr(21)=>250, |
|
4 | + chr(22)=>250, chr(23)=>250, chr(24)=>250, chr(25)=>250, chr(26)=>250, chr(27)=>250, chr(28)=>250, chr(29)=>250, chr(30)=>250, chr(31)=>250, ' '=>250, '!'=>389, '"'=>555, '#'=>500, '$'=>500, '%'=>833, '&'=>778, '\''=>278, '('=>333, ')'=>333, '*'=>500, '+'=>570, |
|
5 | + ','=>250, '-'=>333, '.'=>250, '/'=>278, '0'=>500, '1'=>500, '2'=>500, '3'=>500, '4'=>500, '5'=>500, '6'=>500, '7'=>500, '8'=>500, '9'=>500, ':'=>333, ';'=>333, '<'=>570, '='=>570, '>'=>570, '?'=>500, '@'=>832, 'A'=>667, |
|
6 | + 'B'=>667, 'C'=>667, 'D'=>722, 'E'=>667, 'F'=>667, 'G'=>722, 'H'=>778, 'I'=>389, 'J'=>500, 'K'=>667, 'L'=>611, 'M'=>889, 'N'=>722, 'O'=>722, 'P'=>611, 'Q'=>722, 'R'=>667, 'S'=>556, 'T'=>611, 'U'=>722, 'V'=>667, 'W'=>889, |
|
7 | + 'X'=>667, 'Y'=>611, 'Z'=>611, '['=>333, '\\'=>278, ']'=>333, '^'=>570, '_'=>500, '`'=>333, 'a'=>500, 'b'=>500, 'c'=>444, 'd'=>500, 'e'=>444, 'f'=>333, 'g'=>500, 'h'=>556, 'i'=>278, 'j'=>278, 'k'=>500, 'l'=>278, 'm'=>778, |
|
8 | + 'n'=>556, 'o'=>500, 'p'=>500, 'q'=>500, 'r'=>389, 's'=>389, 't'=>278, 'u'=>556, 'v'=>444, 'w'=>667, 'x'=>500, 'y'=>444, 'z'=>389, '{'=>348, '|'=>220, '}'=>348, '~'=>570, chr(127)=>350, chr(128)=>500, chr(129)=>350, chr(130)=>333, chr(131)=>500, |
|
9 | + chr(132)=>500, chr(133)=>1000, chr(134)=>500, chr(135)=>500, chr(136)=>333, chr(137)=>1000, chr(138)=>556, chr(139)=>333, chr(140)=>944, chr(141)=>350, chr(142)=>611, chr(143)=>350, chr(144)=>350, chr(145)=>333, chr(146)=>333, chr(147)=>500, chr(148)=>500, chr(149)=>350, chr(150)=>500, chr(151)=>1000, chr(152)=>333, chr(153)=>1000, |
|
10 | + chr(154)=>389, chr(155)=>333, chr(156)=>722, chr(157)=>350, chr(158)=>389, chr(159)=>611, chr(160)=>250, chr(161)=>389, chr(162)=>500, chr(163)=>500, chr(164)=>500, chr(165)=>500, chr(166)=>220, chr(167)=>500, chr(168)=>333, chr(169)=>747, chr(170)=>266, chr(171)=>500, chr(172)=>606, chr(173)=>333, chr(174)=>747, chr(175)=>333, |
|
11 | + chr(176)=>400, chr(177)=>570, chr(178)=>300, chr(179)=>300, chr(180)=>333, chr(181)=>576, chr(182)=>500, chr(183)=>250, chr(184)=>333, chr(185)=>300, chr(186)=>300, chr(187)=>500, chr(188)=>750, chr(189)=>750, chr(190)=>750, chr(191)=>500, chr(192)=>667, chr(193)=>667, chr(194)=>667, chr(195)=>667, chr(196)=>667, chr(197)=>667, |
|
12 | + chr(198)=>944, chr(199)=>667, chr(200)=>667, chr(201)=>667, chr(202)=>667, chr(203)=>667, chr(204)=>389, chr(205)=>389, chr(206)=>389, chr(207)=>389, chr(208)=>722, chr(209)=>722, chr(210)=>722, chr(211)=>722, chr(212)=>722, chr(213)=>722, chr(214)=>722, chr(215)=>570, chr(216)=>722, chr(217)=>722, chr(218)=>722, chr(219)=>722, |
|
13 | + chr(220)=>722, chr(221)=>611, chr(222)=>611, chr(223)=>500, chr(224)=>500, chr(225)=>500, chr(226)=>500, chr(227)=>500, chr(228)=>500, chr(229)=>500, chr(230)=>722, chr(231)=>444, chr(232)=>444, chr(233)=>444, chr(234)=>444, chr(235)=>444, chr(236)=>278, chr(237)=>278, chr(238)=>278, chr(239)=>278, chr(240)=>500, chr(241)=>556, |
|
14 | + chr(242)=>500, chr(243)=>500, chr(244)=>500, chr(245)=>500, chr(246)=>500, chr(247)=>570, chr(248)=>500, chr(249)=>556, chr(250)=>556, chr(251)=>556, chr(252)=>556, chr(253)=>444, chr(254)=>500, chr(255)=>444); |
|
15 | 15 | ?> |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | $fpdf_charwidths['timesBI']=array( |
3 | 5 | chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, |
4 | 6 | chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>389,'"'=>555,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>278,'('=>333,')'=>333,'*'=>500,'+'=>570, |
@@ -1,15 +1,15 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
2 | -$fpdf_charwidths['symbol']=array( |
|
3 | - chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, |
|
4 | - chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>713,'#'=>500,'$'=>549,'%'=>833,'&'=>778,'\''=>439,'('=>333,')'=>333,'*'=>500,'+'=>549, |
|
5 | - ','=>250,'-'=>549,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>278,';'=>278,'<'=>549,'='=>549,'>'=>549,'?'=>444,'@'=>549,'A'=>722, |
|
6 | - 'B'=>667,'C'=>722,'D'=>612,'E'=>611,'F'=>763,'G'=>603,'H'=>722,'I'=>333,'J'=>631,'K'=>722,'L'=>686,'M'=>889,'N'=>722,'O'=>722,'P'=>768,'Q'=>741,'R'=>556,'S'=>592,'T'=>611,'U'=>690,'V'=>439,'W'=>768, |
|
7 | - 'X'=>645,'Y'=>795,'Z'=>611,'['=>333,'\\'=>863,']'=>333,'^'=>658,'_'=>500,'`'=>500,'a'=>631,'b'=>549,'c'=>549,'d'=>494,'e'=>439,'f'=>521,'g'=>411,'h'=>603,'i'=>329,'j'=>603,'k'=>549,'l'=>549,'m'=>576, |
|
8 | - 'n'=>521,'o'=>549,'p'=>549,'q'=>521,'r'=>549,'s'=>603,'t'=>439,'u'=>576,'v'=>713,'w'=>686,'x'=>493,'y'=>686,'z'=>494,'{'=>480,'|'=>200,'}'=>480,'~'=>549,chr(127)=>0,chr(128)=>0,chr(129)=>0,chr(130)=>0,chr(131)=>0, |
|
9 | - chr(132)=>0,chr(133)=>0,chr(134)=>0,chr(135)=>0,chr(136)=>0,chr(137)=>0,chr(138)=>0,chr(139)=>0,chr(140)=>0,chr(141)=>0,chr(142)=>0,chr(143)=>0,chr(144)=>0,chr(145)=>0,chr(146)=>0,chr(147)=>0,chr(148)=>0,chr(149)=>0,chr(150)=>0,chr(151)=>0,chr(152)=>0,chr(153)=>0, |
|
10 | - chr(154)=>0,chr(155)=>0,chr(156)=>0,chr(157)=>0,chr(158)=>0,chr(159)=>0,chr(160)=>750,chr(161)=>620,chr(162)=>247,chr(163)=>549,chr(164)=>167,chr(165)=>713,chr(166)=>500,chr(167)=>753,chr(168)=>753,chr(169)=>753,chr(170)=>753,chr(171)=>1042,chr(172)=>987,chr(173)=>603,chr(174)=>987,chr(175)=>603, |
|
11 | - chr(176)=>400,chr(177)=>549,chr(178)=>411,chr(179)=>549,chr(180)=>549,chr(181)=>713,chr(182)=>494,chr(183)=>460,chr(184)=>549,chr(185)=>549,chr(186)=>549,chr(187)=>549,chr(188)=>1000,chr(189)=>603,chr(190)=>1000,chr(191)=>658,chr(192)=>823,chr(193)=>686,chr(194)=>795,chr(195)=>987,chr(196)=>768,chr(197)=>768, |
|
12 | - chr(198)=>823,chr(199)=>768,chr(200)=>768,chr(201)=>713,chr(202)=>713,chr(203)=>713,chr(204)=>713,chr(205)=>713,chr(206)=>713,chr(207)=>713,chr(208)=>768,chr(209)=>713,chr(210)=>790,chr(211)=>790,chr(212)=>890,chr(213)=>823,chr(214)=>549,chr(215)=>250,chr(216)=>713,chr(217)=>603,chr(218)=>603,chr(219)=>1042, |
|
13 | - chr(220)=>987,chr(221)=>603,chr(222)=>987,chr(223)=>603,chr(224)=>494,chr(225)=>329,chr(226)=>790,chr(227)=>790,chr(228)=>786,chr(229)=>713,chr(230)=>384,chr(231)=>384,chr(232)=>384,chr(233)=>384,chr(234)=>384,chr(235)=>384,chr(236)=>494,chr(237)=>494,chr(238)=>494,chr(239)=>494,chr(240)=>0,chr(241)=>329, |
|
14 | - chr(242)=>274,chr(243)=>686,chr(244)=>686,chr(245)=>686,chr(246)=>384,chr(247)=>384,chr(248)=>384,chr(249)=>384,chr(250)=>384,chr(251)=>384,chr(252)=>494,chr(253)=>494,chr(254)=>494,chr(255)=>0); |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | +$fpdf_charwidths['symbol'] = array( |
|
3 | + chr(0)=>250, chr(1)=>250, chr(2)=>250, chr(3)=>250, chr(4)=>250, chr(5)=>250, chr(6)=>250, chr(7)=>250, chr(8)=>250, chr(9)=>250, chr(10)=>250, chr(11)=>250, chr(12)=>250, chr(13)=>250, chr(14)=>250, chr(15)=>250, chr(16)=>250, chr(17)=>250, chr(18)=>250, chr(19)=>250, chr(20)=>250, chr(21)=>250, |
|
4 | + chr(22)=>250, chr(23)=>250, chr(24)=>250, chr(25)=>250, chr(26)=>250, chr(27)=>250, chr(28)=>250, chr(29)=>250, chr(30)=>250, chr(31)=>250, ' '=>250, '!'=>333, '"'=>713, '#'=>500, '$'=>549, '%'=>833, '&'=>778, '\''=>439, '('=>333, ')'=>333, '*'=>500, '+'=>549, |
|
5 | + ','=>250, '-'=>549, '.'=>250, '/'=>278, '0'=>500, '1'=>500, '2'=>500, '3'=>500, '4'=>500, '5'=>500, '6'=>500, '7'=>500, '8'=>500, '9'=>500, ':'=>278, ';'=>278, '<'=>549, '='=>549, '>'=>549, '?'=>444, '@'=>549, 'A'=>722, |
|
6 | + 'B'=>667, 'C'=>722, 'D'=>612, 'E'=>611, 'F'=>763, 'G'=>603, 'H'=>722, 'I'=>333, 'J'=>631, 'K'=>722, 'L'=>686, 'M'=>889, 'N'=>722, 'O'=>722, 'P'=>768, 'Q'=>741, 'R'=>556, 'S'=>592, 'T'=>611, 'U'=>690, 'V'=>439, 'W'=>768, |
|
7 | + 'X'=>645, 'Y'=>795, 'Z'=>611, '['=>333, '\\'=>863, ']'=>333, '^'=>658, '_'=>500, '`'=>500, 'a'=>631, 'b'=>549, 'c'=>549, 'd'=>494, 'e'=>439, 'f'=>521, 'g'=>411, 'h'=>603, 'i'=>329, 'j'=>603, 'k'=>549, 'l'=>549, 'm'=>576, |
|
8 | + 'n'=>521, 'o'=>549, 'p'=>549, 'q'=>521, 'r'=>549, 's'=>603, 't'=>439, 'u'=>576, 'v'=>713, 'w'=>686, 'x'=>493, 'y'=>686, 'z'=>494, '{'=>480, '|'=>200, '}'=>480, '~'=>549, chr(127)=>0, chr(128)=>0, chr(129)=>0, chr(130)=>0, chr(131)=>0, |
|
9 | + chr(132)=>0, chr(133)=>0, chr(134)=>0, chr(135)=>0, chr(136)=>0, chr(137)=>0, chr(138)=>0, chr(139)=>0, chr(140)=>0, chr(141)=>0, chr(142)=>0, chr(143)=>0, chr(144)=>0, chr(145)=>0, chr(146)=>0, chr(147)=>0, chr(148)=>0, chr(149)=>0, chr(150)=>0, chr(151)=>0, chr(152)=>0, chr(153)=>0, |
|
10 | + chr(154)=>0, chr(155)=>0, chr(156)=>0, chr(157)=>0, chr(158)=>0, chr(159)=>0, chr(160)=>750, chr(161)=>620, chr(162)=>247, chr(163)=>549, chr(164)=>167, chr(165)=>713, chr(166)=>500, chr(167)=>753, chr(168)=>753, chr(169)=>753, chr(170)=>753, chr(171)=>1042, chr(172)=>987, chr(173)=>603, chr(174)=>987, chr(175)=>603, |
|
11 | + chr(176)=>400, chr(177)=>549, chr(178)=>411, chr(179)=>549, chr(180)=>549, chr(181)=>713, chr(182)=>494, chr(183)=>460, chr(184)=>549, chr(185)=>549, chr(186)=>549, chr(187)=>549, chr(188)=>1000, chr(189)=>603, chr(190)=>1000, chr(191)=>658, chr(192)=>823, chr(193)=>686, chr(194)=>795, chr(195)=>987, chr(196)=>768, chr(197)=>768, |
|
12 | + chr(198)=>823, chr(199)=>768, chr(200)=>768, chr(201)=>713, chr(202)=>713, chr(203)=>713, chr(204)=>713, chr(205)=>713, chr(206)=>713, chr(207)=>713, chr(208)=>768, chr(209)=>713, chr(210)=>790, chr(211)=>790, chr(212)=>890, chr(213)=>823, chr(214)=>549, chr(215)=>250, chr(216)=>713, chr(217)=>603, chr(218)=>603, chr(219)=>1042, |
|
13 | + chr(220)=>987, chr(221)=>603, chr(222)=>987, chr(223)=>603, chr(224)=>494, chr(225)=>329, chr(226)=>790, chr(227)=>790, chr(228)=>786, chr(229)=>713, chr(230)=>384, chr(231)=>384, chr(232)=>384, chr(233)=>384, chr(234)=>384, chr(235)=>384, chr(236)=>494, chr(237)=>494, chr(238)=>494, chr(239)=>494, chr(240)=>0, chr(241)=>329, |
|
14 | + chr(242)=>274, chr(243)=>686, chr(244)=>686, chr(245)=>686, chr(246)=>384, chr(247)=>384, chr(248)=>384, chr(249)=>384, chr(250)=>384, chr(251)=>384, chr(252)=>494, chr(253)=>494, chr(254)=>494, chr(255)=>0); |
|
15 | 15 | ?> |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | $fpdf_charwidths['symbol']=array( |
3 | 5 | chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, |
4 | 6 | chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>713,'#'=>500,'$'=>549,'%'=>833,'&'=>778,'\''=>439,'('=>333,')'=>333,'*'=>500,'+'=>549, |
@@ -1,15 +1,15 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
2 | -$fpdf_charwidths['helveticaI']=array( |
|
3 | - chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278, |
|
4 | - chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>278,'"'=>355,'#'=>556,'$'=>556,'%'=>889,'&'=>667,'\''=>191,'('=>333,')'=>333,'*'=>389,'+'=>584, |
|
5 | - ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>278,';'=>278,'<'=>584,'='=>584,'>'=>584,'?'=>556,'@'=>1015,'A'=>667, |
|
6 | - 'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>500,'K'=>667,'L'=>556,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944, |
|
7 | - 'X'=>667,'Y'=>667,'Z'=>611,'['=>278,'\\'=>278,']'=>278,'^'=>469,'_'=>556,'`'=>333,'a'=>556,'b'=>556,'c'=>500,'d'=>556,'e'=>556,'f'=>278,'g'=>556,'h'=>556,'i'=>222,'j'=>222,'k'=>500,'l'=>222,'m'=>833, |
|
8 | - 'n'=>556,'o'=>556,'p'=>556,'q'=>556,'r'=>333,'s'=>500,'t'=>278,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>500,'{'=>334,'|'=>260,'}'=>334,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>222,chr(131)=>556, |
|
9 | - chr(132)=>333,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>222,chr(146)=>222,chr(147)=>333,chr(148)=>333,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, |
|
10 | - chr(154)=>500,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>260,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333, |
|
11 | - chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>556,chr(182)=>537,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667, |
|
12 | - chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, |
|
13 | - chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>500,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>556,chr(241)=>556, |
|
14 | - chr(242)=>556,chr(243)=>556,chr(244)=>556,chr(245)=>556,chr(246)=>556,chr(247)=>584,chr(248)=>611,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500); |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | +$fpdf_charwidths['helveticaI'] = array( |
|
3 | + chr(0)=>278, chr(1)=>278, chr(2)=>278, chr(3)=>278, chr(4)=>278, chr(5)=>278, chr(6)=>278, chr(7)=>278, chr(8)=>278, chr(9)=>278, chr(10)=>278, chr(11)=>278, chr(12)=>278, chr(13)=>278, chr(14)=>278, chr(15)=>278, chr(16)=>278, chr(17)=>278, chr(18)=>278, chr(19)=>278, chr(20)=>278, chr(21)=>278, |
|
4 | + chr(22)=>278, chr(23)=>278, chr(24)=>278, chr(25)=>278, chr(26)=>278, chr(27)=>278, chr(28)=>278, chr(29)=>278, chr(30)=>278, chr(31)=>278, ' '=>278, '!'=>278, '"'=>355, '#'=>556, '$'=>556, '%'=>889, '&'=>667, '\''=>191, '('=>333, ')'=>333, '*'=>389, '+'=>584, |
|
5 | + ','=>278, '-'=>333, '.'=>278, '/'=>278, '0'=>556, '1'=>556, '2'=>556, '3'=>556, '4'=>556, '5'=>556, '6'=>556, '7'=>556, '8'=>556, '9'=>556, ':'=>278, ';'=>278, '<'=>584, '='=>584, '>'=>584, '?'=>556, '@'=>1015, 'A'=>667, |
|
6 | + 'B'=>667, 'C'=>722, 'D'=>722, 'E'=>667, 'F'=>611, 'G'=>778, 'H'=>722, 'I'=>278, 'J'=>500, 'K'=>667, 'L'=>556, 'M'=>833, 'N'=>722, 'O'=>778, 'P'=>667, 'Q'=>778, 'R'=>722, 'S'=>667, 'T'=>611, 'U'=>722, 'V'=>667, 'W'=>944, |
|
7 | + 'X'=>667, 'Y'=>667, 'Z'=>611, '['=>278, '\\'=>278, ']'=>278, '^'=>469, '_'=>556, '`'=>333, 'a'=>556, 'b'=>556, 'c'=>500, 'd'=>556, 'e'=>556, 'f'=>278, 'g'=>556, 'h'=>556, 'i'=>222, 'j'=>222, 'k'=>500, 'l'=>222, 'm'=>833, |
|
8 | + 'n'=>556, 'o'=>556, 'p'=>556, 'q'=>556, 'r'=>333, 's'=>500, 't'=>278, 'u'=>556, 'v'=>500, 'w'=>722, 'x'=>500, 'y'=>500, 'z'=>500, '{'=>334, '|'=>260, '}'=>334, '~'=>584, chr(127)=>350, chr(128)=>556, chr(129)=>350, chr(130)=>222, chr(131)=>556, |
|
9 | + chr(132)=>333, chr(133)=>1000, chr(134)=>556, chr(135)=>556, chr(136)=>333, chr(137)=>1000, chr(138)=>667, chr(139)=>333, chr(140)=>1000, chr(141)=>350, chr(142)=>611, chr(143)=>350, chr(144)=>350, chr(145)=>222, chr(146)=>222, chr(147)=>333, chr(148)=>333, chr(149)=>350, chr(150)=>556, chr(151)=>1000, chr(152)=>333, chr(153)=>1000, |
|
10 | + chr(154)=>500, chr(155)=>333, chr(156)=>944, chr(157)=>350, chr(158)=>500, chr(159)=>667, chr(160)=>278, chr(161)=>333, chr(162)=>556, chr(163)=>556, chr(164)=>556, chr(165)=>556, chr(166)=>260, chr(167)=>556, chr(168)=>333, chr(169)=>737, chr(170)=>370, chr(171)=>556, chr(172)=>584, chr(173)=>333, chr(174)=>737, chr(175)=>333, |
|
11 | + chr(176)=>400, chr(177)=>584, chr(178)=>333, chr(179)=>333, chr(180)=>333, chr(181)=>556, chr(182)=>537, chr(183)=>278, chr(184)=>333, chr(185)=>333, chr(186)=>365, chr(187)=>556, chr(188)=>834, chr(189)=>834, chr(190)=>834, chr(191)=>611, chr(192)=>667, chr(193)=>667, chr(194)=>667, chr(195)=>667, chr(196)=>667, chr(197)=>667, |
|
12 | + chr(198)=>1000, chr(199)=>722, chr(200)=>667, chr(201)=>667, chr(202)=>667, chr(203)=>667, chr(204)=>278, chr(205)=>278, chr(206)=>278, chr(207)=>278, chr(208)=>722, chr(209)=>722, chr(210)=>778, chr(211)=>778, chr(212)=>778, chr(213)=>778, chr(214)=>778, chr(215)=>584, chr(216)=>778, chr(217)=>722, chr(218)=>722, chr(219)=>722, |
|
13 | + chr(220)=>722, chr(221)=>667, chr(222)=>667, chr(223)=>611, chr(224)=>556, chr(225)=>556, chr(226)=>556, chr(227)=>556, chr(228)=>556, chr(229)=>556, chr(230)=>889, chr(231)=>500, chr(232)=>556, chr(233)=>556, chr(234)=>556, chr(235)=>556, chr(236)=>278, chr(237)=>278, chr(238)=>278, chr(239)=>278, chr(240)=>556, chr(241)=>556, |
|
14 | + chr(242)=>556, chr(243)=>556, chr(244)=>556, chr(245)=>556, chr(246)=>556, chr(247)=>584, chr(248)=>611, chr(249)=>556, chr(250)=>556, chr(251)=>556, chr(252)=>556, chr(253)=>500, chr(254)=>556, chr(255)=>500); |
|
15 | 15 | ?> |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | $fpdf_charwidths['helveticaI']=array( |
3 | 5 | chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278, |
4 | 6 | chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>278,'"'=>355,'#'=>556,'$'=>556,'%'=>889,'&'=>667,'\''=>191,'('=>333,')'=>333,'*'=>389,'+'=>584, |
@@ -1,15 +1,15 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
2 | -$fpdf_charwidths['helveticaB']=array( |
|
3 | - chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278, |
|
4 | - chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>333,'"'=>474,'#'=>556,'$'=>556,'%'=>889,'&'=>722,'\''=>238,'('=>333,')'=>333,'*'=>389,'+'=>584, |
|
5 | - ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>333,';'=>333,'<'=>584,'='=>584,'>'=>584,'?'=>611,'@'=>975,'A'=>722, |
|
6 | - 'B'=>722,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>556,'K'=>722,'L'=>611,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944, |
|
7 | - 'X'=>667,'Y'=>667,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>584,'_'=>556,'`'=>333,'a'=>556,'b'=>611,'c'=>556,'d'=>611,'e'=>556,'f'=>333,'g'=>611,'h'=>611,'i'=>278,'j'=>278,'k'=>556,'l'=>278,'m'=>889, |
|
8 | - 'n'=>611,'o'=>611,'p'=>611,'q'=>611,'r'=>389,'s'=>556,'t'=>333,'u'=>611,'v'=>556,'w'=>778,'x'=>556,'y'=>556,'z'=>500,'{'=>389,'|'=>280,'}'=>389,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>278,chr(131)=>556, |
|
9 | - chr(132)=>500,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>278,chr(146)=>278,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, |
|
10 | - chr(154)=>556,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>280,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333, |
|
11 | - chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>611,chr(182)=>556,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722, |
|
12 | - chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, |
|
13 | - chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>556,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>611,chr(241)=>611, |
|
14 | - chr(242)=>611,chr(243)=>611,chr(244)=>611,chr(245)=>611,chr(246)=>611,chr(247)=>584,chr(248)=>611,chr(249)=>611,chr(250)=>611,chr(251)=>611,chr(252)=>611,chr(253)=>556,chr(254)=>611,chr(255)=>556); |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | +$fpdf_charwidths['helveticaB'] = array( |
|
3 | + chr(0)=>278, chr(1)=>278, chr(2)=>278, chr(3)=>278, chr(4)=>278, chr(5)=>278, chr(6)=>278, chr(7)=>278, chr(8)=>278, chr(9)=>278, chr(10)=>278, chr(11)=>278, chr(12)=>278, chr(13)=>278, chr(14)=>278, chr(15)=>278, chr(16)=>278, chr(17)=>278, chr(18)=>278, chr(19)=>278, chr(20)=>278, chr(21)=>278, |
|
4 | + chr(22)=>278, chr(23)=>278, chr(24)=>278, chr(25)=>278, chr(26)=>278, chr(27)=>278, chr(28)=>278, chr(29)=>278, chr(30)=>278, chr(31)=>278, ' '=>278, '!'=>333, '"'=>474, '#'=>556, '$'=>556, '%'=>889, '&'=>722, '\''=>238, '('=>333, ')'=>333, '*'=>389, '+'=>584, |
|
5 | + ','=>278, '-'=>333, '.'=>278, '/'=>278, '0'=>556, '1'=>556, '2'=>556, '3'=>556, '4'=>556, '5'=>556, '6'=>556, '7'=>556, '8'=>556, '9'=>556, ':'=>333, ';'=>333, '<'=>584, '='=>584, '>'=>584, '?'=>611, '@'=>975, 'A'=>722, |
|
6 | + 'B'=>722, 'C'=>722, 'D'=>722, 'E'=>667, 'F'=>611, 'G'=>778, 'H'=>722, 'I'=>278, 'J'=>556, 'K'=>722, 'L'=>611, 'M'=>833, 'N'=>722, 'O'=>778, 'P'=>667, 'Q'=>778, 'R'=>722, 'S'=>667, 'T'=>611, 'U'=>722, 'V'=>667, 'W'=>944, |
|
7 | + 'X'=>667, 'Y'=>667, 'Z'=>611, '['=>333, '\\'=>278, ']'=>333, '^'=>584, '_'=>556, '`'=>333, 'a'=>556, 'b'=>611, 'c'=>556, 'd'=>611, 'e'=>556, 'f'=>333, 'g'=>611, 'h'=>611, 'i'=>278, 'j'=>278, 'k'=>556, 'l'=>278, 'm'=>889, |
|
8 | + 'n'=>611, 'o'=>611, 'p'=>611, 'q'=>611, 'r'=>389, 's'=>556, 't'=>333, 'u'=>611, 'v'=>556, 'w'=>778, 'x'=>556, 'y'=>556, 'z'=>500, '{'=>389, '|'=>280, '}'=>389, '~'=>584, chr(127)=>350, chr(128)=>556, chr(129)=>350, chr(130)=>278, chr(131)=>556, |
|
9 | + chr(132)=>500, chr(133)=>1000, chr(134)=>556, chr(135)=>556, chr(136)=>333, chr(137)=>1000, chr(138)=>667, chr(139)=>333, chr(140)=>1000, chr(141)=>350, chr(142)=>611, chr(143)=>350, chr(144)=>350, chr(145)=>278, chr(146)=>278, chr(147)=>500, chr(148)=>500, chr(149)=>350, chr(150)=>556, chr(151)=>1000, chr(152)=>333, chr(153)=>1000, |
|
10 | + chr(154)=>556, chr(155)=>333, chr(156)=>944, chr(157)=>350, chr(158)=>500, chr(159)=>667, chr(160)=>278, chr(161)=>333, chr(162)=>556, chr(163)=>556, chr(164)=>556, chr(165)=>556, chr(166)=>280, chr(167)=>556, chr(168)=>333, chr(169)=>737, chr(170)=>370, chr(171)=>556, chr(172)=>584, chr(173)=>333, chr(174)=>737, chr(175)=>333, |
|
11 | + chr(176)=>400, chr(177)=>584, chr(178)=>333, chr(179)=>333, chr(180)=>333, chr(181)=>611, chr(182)=>556, chr(183)=>278, chr(184)=>333, chr(185)=>333, chr(186)=>365, chr(187)=>556, chr(188)=>834, chr(189)=>834, chr(190)=>834, chr(191)=>611, chr(192)=>722, chr(193)=>722, chr(194)=>722, chr(195)=>722, chr(196)=>722, chr(197)=>722, |
|
12 | + chr(198)=>1000, chr(199)=>722, chr(200)=>667, chr(201)=>667, chr(202)=>667, chr(203)=>667, chr(204)=>278, chr(205)=>278, chr(206)=>278, chr(207)=>278, chr(208)=>722, chr(209)=>722, chr(210)=>778, chr(211)=>778, chr(212)=>778, chr(213)=>778, chr(214)=>778, chr(215)=>584, chr(216)=>778, chr(217)=>722, chr(218)=>722, chr(219)=>722, |
|
13 | + chr(220)=>722, chr(221)=>667, chr(222)=>667, chr(223)=>611, chr(224)=>556, chr(225)=>556, chr(226)=>556, chr(227)=>556, chr(228)=>556, chr(229)=>556, chr(230)=>889, chr(231)=>556, chr(232)=>556, chr(233)=>556, chr(234)=>556, chr(235)=>556, chr(236)=>278, chr(237)=>278, chr(238)=>278, chr(239)=>278, chr(240)=>611, chr(241)=>611, |
|
14 | + chr(242)=>611, chr(243)=>611, chr(244)=>611, chr(245)=>611, chr(246)=>611, chr(247)=>584, chr(248)=>611, chr(249)=>611, chr(250)=>611, chr(251)=>611, chr(252)=>611, chr(253)=>556, chr(254)=>611, chr(255)=>556); |
|
15 | 15 | ?> |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | $fpdf_charwidths['helveticaB']=array( |
3 | 5 | chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278, |
4 | 6 | chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>333,'"'=>474,'#'=>556,'$'=>556,'%'=>889,'&'=>722,'\''=>238,'('=>333,')'=>333,'*'=>389,'+'=>584, |
@@ -1,15 +1,15 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
2 | -$fpdf_charwidths['zapfdingbats']=array( |
|
3 | - chr(0)=>0,chr(1)=>0,chr(2)=>0,chr(3)=>0,chr(4)=>0,chr(5)=>0,chr(6)=>0,chr(7)=>0,chr(8)=>0,chr(9)=>0,chr(10)=>0,chr(11)=>0,chr(12)=>0,chr(13)=>0,chr(14)=>0,chr(15)=>0,chr(16)=>0,chr(17)=>0,chr(18)=>0,chr(19)=>0,chr(20)=>0,chr(21)=>0, |
|
4 | - chr(22)=>0,chr(23)=>0,chr(24)=>0,chr(25)=>0,chr(26)=>0,chr(27)=>0,chr(28)=>0,chr(29)=>0,chr(30)=>0,chr(31)=>0,' '=>278,'!'=>974,'"'=>961,'#'=>974,'$'=>980,'%'=>719,'&'=>789,'\''=>790,'('=>791,')'=>690,'*'=>960,'+'=>939, |
|
5 | - ','=>549,'-'=>855,'.'=>911,'/'=>933,'0'=>911,'1'=>945,'2'=>974,'3'=>755,'4'=>846,'5'=>762,'6'=>761,'7'=>571,'8'=>677,'9'=>763,':'=>760,';'=>759,'<'=>754,'='=>494,'>'=>552,'?'=>537,'@'=>577,'A'=>692, |
|
6 | - 'B'=>786,'C'=>788,'D'=>788,'E'=>790,'F'=>793,'G'=>794,'H'=>816,'I'=>823,'J'=>789,'K'=>841,'L'=>823,'M'=>833,'N'=>816,'O'=>831,'P'=>923,'Q'=>744,'R'=>723,'S'=>749,'T'=>790,'U'=>792,'V'=>695,'W'=>776, |
|
7 | - 'X'=>768,'Y'=>792,'Z'=>759,'['=>707,'\\'=>708,']'=>682,'^'=>701,'_'=>826,'`'=>815,'a'=>789,'b'=>789,'c'=>707,'d'=>687,'e'=>696,'f'=>689,'g'=>786,'h'=>787,'i'=>713,'j'=>791,'k'=>785,'l'=>791,'m'=>873, |
|
8 | - 'n'=>761,'o'=>762,'p'=>762,'q'=>759,'r'=>759,'s'=>892,'t'=>892,'u'=>788,'v'=>784,'w'=>438,'x'=>138,'y'=>277,'z'=>415,'{'=>392,'|'=>392,'}'=>668,'~'=>668,chr(127)=>0,chr(128)=>390,chr(129)=>390,chr(130)=>317,chr(131)=>317, |
|
9 | - chr(132)=>276,chr(133)=>276,chr(134)=>509,chr(135)=>509,chr(136)=>410,chr(137)=>410,chr(138)=>234,chr(139)=>234,chr(140)=>334,chr(141)=>334,chr(142)=>0,chr(143)=>0,chr(144)=>0,chr(145)=>0,chr(146)=>0,chr(147)=>0,chr(148)=>0,chr(149)=>0,chr(150)=>0,chr(151)=>0,chr(152)=>0,chr(153)=>0, |
|
10 | - chr(154)=>0,chr(155)=>0,chr(156)=>0,chr(157)=>0,chr(158)=>0,chr(159)=>0,chr(160)=>0,chr(161)=>732,chr(162)=>544,chr(163)=>544,chr(164)=>910,chr(165)=>667,chr(166)=>760,chr(167)=>760,chr(168)=>776,chr(169)=>595,chr(170)=>694,chr(171)=>626,chr(172)=>788,chr(173)=>788,chr(174)=>788,chr(175)=>788, |
|
11 | - chr(176)=>788,chr(177)=>788,chr(178)=>788,chr(179)=>788,chr(180)=>788,chr(181)=>788,chr(182)=>788,chr(183)=>788,chr(184)=>788,chr(185)=>788,chr(186)=>788,chr(187)=>788,chr(188)=>788,chr(189)=>788,chr(190)=>788,chr(191)=>788,chr(192)=>788,chr(193)=>788,chr(194)=>788,chr(195)=>788,chr(196)=>788,chr(197)=>788, |
|
12 | - chr(198)=>788,chr(199)=>788,chr(200)=>788,chr(201)=>788,chr(202)=>788,chr(203)=>788,chr(204)=>788,chr(205)=>788,chr(206)=>788,chr(207)=>788,chr(208)=>788,chr(209)=>788,chr(210)=>788,chr(211)=>788,chr(212)=>894,chr(213)=>838,chr(214)=>1016,chr(215)=>458,chr(216)=>748,chr(217)=>924,chr(218)=>748,chr(219)=>918, |
|
13 | - chr(220)=>927,chr(221)=>928,chr(222)=>928,chr(223)=>834,chr(224)=>873,chr(225)=>828,chr(226)=>924,chr(227)=>924,chr(228)=>917,chr(229)=>930,chr(230)=>931,chr(231)=>463,chr(232)=>883,chr(233)=>836,chr(234)=>836,chr(235)=>867,chr(236)=>867,chr(237)=>696,chr(238)=>696,chr(239)=>874,chr(240)=>0,chr(241)=>874, |
|
14 | - chr(242)=>760,chr(243)=>946,chr(244)=>771,chr(245)=>865,chr(246)=>771,chr(247)=>888,chr(248)=>967,chr(249)=>888,chr(250)=>831,chr(251)=>873,chr(252)=>927,chr(253)=>970,chr(254)=>918,chr(255)=>0); |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | +$fpdf_charwidths['zapfdingbats'] = array( |
|
3 | + chr(0)=>0, chr(1)=>0, chr(2)=>0, chr(3)=>0, chr(4)=>0, chr(5)=>0, chr(6)=>0, chr(7)=>0, chr(8)=>0, chr(9)=>0, chr(10)=>0, chr(11)=>0, chr(12)=>0, chr(13)=>0, chr(14)=>0, chr(15)=>0, chr(16)=>0, chr(17)=>0, chr(18)=>0, chr(19)=>0, chr(20)=>0, chr(21)=>0, |
|
4 | + chr(22)=>0, chr(23)=>0, chr(24)=>0, chr(25)=>0, chr(26)=>0, chr(27)=>0, chr(28)=>0, chr(29)=>0, chr(30)=>0, chr(31)=>0, ' '=>278, '!'=>974, '"'=>961, '#'=>974, '$'=>980, '%'=>719, '&'=>789, '\''=>790, '('=>791, ')'=>690, '*'=>960, '+'=>939, |
|
5 | + ','=>549, '-'=>855, '.'=>911, '/'=>933, '0'=>911, '1'=>945, '2'=>974, '3'=>755, '4'=>846, '5'=>762, '6'=>761, '7'=>571, '8'=>677, '9'=>763, ':'=>760, ';'=>759, '<'=>754, '='=>494, '>'=>552, '?'=>537, '@'=>577, 'A'=>692, |
|
6 | + 'B'=>786, 'C'=>788, 'D'=>788, 'E'=>790, 'F'=>793, 'G'=>794, 'H'=>816, 'I'=>823, 'J'=>789, 'K'=>841, 'L'=>823, 'M'=>833, 'N'=>816, 'O'=>831, 'P'=>923, 'Q'=>744, 'R'=>723, 'S'=>749, 'T'=>790, 'U'=>792, 'V'=>695, 'W'=>776, |
|
7 | + 'X'=>768, 'Y'=>792, 'Z'=>759, '['=>707, '\\'=>708, ']'=>682, '^'=>701, '_'=>826, '`'=>815, 'a'=>789, 'b'=>789, 'c'=>707, 'd'=>687, 'e'=>696, 'f'=>689, 'g'=>786, 'h'=>787, 'i'=>713, 'j'=>791, 'k'=>785, 'l'=>791, 'm'=>873, |
|
8 | + 'n'=>761, 'o'=>762, 'p'=>762, 'q'=>759, 'r'=>759, 's'=>892, 't'=>892, 'u'=>788, 'v'=>784, 'w'=>438, 'x'=>138, 'y'=>277, 'z'=>415, '{'=>392, '|'=>392, '}'=>668, '~'=>668, chr(127)=>0, chr(128)=>390, chr(129)=>390, chr(130)=>317, chr(131)=>317, |
|
9 | + chr(132)=>276, chr(133)=>276, chr(134)=>509, chr(135)=>509, chr(136)=>410, chr(137)=>410, chr(138)=>234, chr(139)=>234, chr(140)=>334, chr(141)=>334, chr(142)=>0, chr(143)=>0, chr(144)=>0, chr(145)=>0, chr(146)=>0, chr(147)=>0, chr(148)=>0, chr(149)=>0, chr(150)=>0, chr(151)=>0, chr(152)=>0, chr(153)=>0, |
|
10 | + chr(154)=>0, chr(155)=>0, chr(156)=>0, chr(157)=>0, chr(158)=>0, chr(159)=>0, chr(160)=>0, chr(161)=>732, chr(162)=>544, chr(163)=>544, chr(164)=>910, chr(165)=>667, chr(166)=>760, chr(167)=>760, chr(168)=>776, chr(169)=>595, chr(170)=>694, chr(171)=>626, chr(172)=>788, chr(173)=>788, chr(174)=>788, chr(175)=>788, |
|
11 | + chr(176)=>788, chr(177)=>788, chr(178)=>788, chr(179)=>788, chr(180)=>788, chr(181)=>788, chr(182)=>788, chr(183)=>788, chr(184)=>788, chr(185)=>788, chr(186)=>788, chr(187)=>788, chr(188)=>788, chr(189)=>788, chr(190)=>788, chr(191)=>788, chr(192)=>788, chr(193)=>788, chr(194)=>788, chr(195)=>788, chr(196)=>788, chr(197)=>788, |
|
12 | + chr(198)=>788, chr(199)=>788, chr(200)=>788, chr(201)=>788, chr(202)=>788, chr(203)=>788, chr(204)=>788, chr(205)=>788, chr(206)=>788, chr(207)=>788, chr(208)=>788, chr(209)=>788, chr(210)=>788, chr(211)=>788, chr(212)=>894, chr(213)=>838, chr(214)=>1016, chr(215)=>458, chr(216)=>748, chr(217)=>924, chr(218)=>748, chr(219)=>918, |
|
13 | + chr(220)=>927, chr(221)=>928, chr(222)=>928, chr(223)=>834, chr(224)=>873, chr(225)=>828, chr(226)=>924, chr(227)=>924, chr(228)=>917, chr(229)=>930, chr(230)=>931, chr(231)=>463, chr(232)=>883, chr(233)=>836, chr(234)=>836, chr(235)=>867, chr(236)=>867, chr(237)=>696, chr(238)=>696, chr(239)=>874, chr(240)=>0, chr(241)=>874, |
|
14 | + chr(242)=>760, chr(243)=>946, chr(244)=>771, chr(245)=>865, chr(246)=>771, chr(247)=>888, chr(248)=>967, chr(249)=>888, chr(250)=>831, chr(251)=>873, chr(252)=>927, chr(253)=>970, chr(254)=>918, chr(255)=>0); |
|
15 | 15 | ?> |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | $fpdf_charwidths['zapfdingbats']=array( |
3 | 5 | chr(0)=>0,chr(1)=>0,chr(2)=>0,chr(3)=>0,chr(4)=>0,chr(5)=>0,chr(6)=>0,chr(7)=>0,chr(8)=>0,chr(9)=>0,chr(10)=>0,chr(11)=>0,chr(12)=>0,chr(13)=>0,chr(14)=>0,chr(15)=>0,chr(16)=>0,chr(17)=>0,chr(18)=>0,chr(19)=>0,chr(20)=>0,chr(21)=>0, |
4 | 6 | chr(22)=>0,chr(23)=>0,chr(24)=>0,chr(25)=>0,chr(26)=>0,chr(27)=>0,chr(28)=>0,chr(29)=>0,chr(30)=>0,chr(31)=>0,' '=>278,'!'=>974,'"'=>961,'#'=>974,'$'=>980,'%'=>719,'&'=>789,'\''=>790,'('=>791,')'=>690,'*'=>960,'+'=>939, |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | /* Check if file is include. No direct access possible with file url */ |
4 | -if ( !defined( 'WPSHOP_VERSION' ) ) { |
|
5 | - die( __('Access is not allowed by this way', 'wpshop') ); |
|
4 | +if (!defined('WPSHOP_VERSION')) { |
|
5 | + die(__('Access is not allowed by this way', 'wpshop')); |
|
6 | 6 | } |
7 | 7 | |
8 | 8 | /******************************************************************************* |
@@ -13,360 +13,360 @@ discard block |
||
13 | 13 | * Auteur : Olivier PLATHEY * |
14 | 14 | *******************************************************************************/ |
15 | 15 | |
16 | -define('FPDF_VERSION','1.6'); |
|
16 | +define('FPDF_VERSION', '1.6'); |
|
17 | 17 | |
18 | 18 | class wpshop_FPDF |
19 | 19 | { |
20 | -var $page; //current page number |
|
21 | -var $n; //current object number |
|
22 | -var $offsets; //array of object offsets |
|
23 | -var $buffer; //buffer holding in-memory PDF |
|
24 | -var $pages; //array containing pages |
|
25 | -var $state; //current document state |
|
26 | -var $compress; //compression flag |
|
27 | -var $k; //scale factor (number of points in user unit) |
|
28 | -var $DefOrientation; //default orientation |
|
29 | -var $CurOrientation; //current orientation |
|
30 | -var $PageFormats; //available page formats |
|
31 | -var $DefPageFormat; //default page format |
|
32 | -var $CurPageFormat; //current page format |
|
33 | -var $PageSizes; //array storing non-default page sizes |
|
34 | -var $wPt,$hPt; //dimensions of current page in points |
|
35 | -var $w,$h; //dimensions of current page in user unit |
|
36 | -var $lMargin; //left margin |
|
37 | -var $tMargin; //top margin |
|
38 | -var $rMargin; //right margin |
|
39 | -var $bMargin; //page break margin |
|
40 | -var $cMargin; //cell margin |
|
41 | -var $x,$y; //current position in user unit |
|
42 | -var $lasth; //height of last printed cell |
|
43 | -var $LineWidth; //line width in user unit |
|
44 | -var $CoreFonts; //array of standard font names |
|
45 | -var $fonts; //array of used fonts |
|
46 | -var $FontFiles; //array of font files |
|
47 | -var $diffs; //array of encoding differences |
|
48 | -var $FontFamily; //current font family |
|
49 | -var $FontStyle; //current font style |
|
50 | -var $underline; //underlining flag |
|
51 | -var $CurrentFont; //current font info |
|
52 | -var $FontSizePt; //current font size in points |
|
53 | -var $FontSize; //current font size in user unit |
|
54 | -var $DrawColor; //commands for drawing color |
|
55 | -var $FillColor; //commands for filling color |
|
56 | -var $TextColor; //commands for text color |
|
57 | -var $ColorFlag; //indicates whether fill and text colors are different |
|
58 | -var $ws; //word spacing |
|
59 | -var $images; //array of used images |
|
60 | -var $PageLinks; //array of links in pages |
|
61 | -var $links; //array of internal links |
|
62 | -var $AutoPageBreak; //automatic page breaking |
|
63 | -var $PageBreakTrigger; //threshold used to trigger page breaks |
|
64 | -var $InHeader; //flag set when processing header |
|
65 | -var $InFooter; //flag set when processing footer |
|
66 | -var $ZoomMode; //zoom display mode |
|
67 | -var $LayoutMode; //layout display mode |
|
68 | -var $title; //title |
|
69 | -var $subject; //subject |
|
70 | -var $author; //author |
|
71 | -var $keywords; //keywords |
|
72 | -var $creator; //creator |
|
73 | -var $AliasNbPages; //alias for total number of pages |
|
74 | -var $PDFVersion; //PDF version number |
|
20 | +var $page; //current page number |
|
21 | +var $n; //current object number |
|
22 | +var $offsets; //array of object offsets |
|
23 | +var $buffer; //buffer holding in-memory PDF |
|
24 | +var $pages; //array containing pages |
|
25 | +var $state; //current document state |
|
26 | +var $compress; //compression flag |
|
27 | +var $k; //scale factor (number of points in user unit) |
|
28 | +var $DefOrientation; //default orientation |
|
29 | +var $CurOrientation; //current orientation |
|
30 | +var $PageFormats; //available page formats |
|
31 | +var $DefPageFormat; //default page format |
|
32 | +var $CurPageFormat; //current page format |
|
33 | +var $PageSizes; //array storing non-default page sizes |
|
34 | +var $wPt, $hPt; //dimensions of current page in points |
|
35 | +var $w, $h; //dimensions of current page in user unit |
|
36 | +var $lMargin; //left margin |
|
37 | +var $tMargin; //top margin |
|
38 | +var $rMargin; //right margin |
|
39 | +var $bMargin; //page break margin |
|
40 | +var $cMargin; //cell margin |
|
41 | +var $x, $y; //current position in user unit |
|
42 | +var $lasth; //height of last printed cell |
|
43 | +var $LineWidth; //line width in user unit |
|
44 | +var $CoreFonts; //array of standard font names |
|
45 | +var $fonts; //array of used fonts |
|
46 | +var $FontFiles; //array of font files |
|
47 | +var $diffs; //array of encoding differences |
|
48 | +var $FontFamily; //current font family |
|
49 | +var $FontStyle; //current font style |
|
50 | +var $underline; //underlining flag |
|
51 | +var $CurrentFont; //current font info |
|
52 | +var $FontSizePt; //current font size in points |
|
53 | +var $FontSize; //current font size in user unit |
|
54 | +var $DrawColor; //commands for drawing color |
|
55 | +var $FillColor; //commands for filling color |
|
56 | +var $TextColor; //commands for text color |
|
57 | +var $ColorFlag; //indicates whether fill and text colors are different |
|
58 | +var $ws; //word spacing |
|
59 | +var $images; //array of used images |
|
60 | +var $PageLinks; //array of links in pages |
|
61 | +var $links; //array of internal links |
|
62 | +var $AutoPageBreak; //automatic page breaking |
|
63 | +var $PageBreakTrigger; //threshold used to trigger page breaks |
|
64 | +var $InHeader; //flag set when processing header |
|
65 | +var $InFooter; //flag set when processing footer |
|
66 | +var $ZoomMode; //zoom display mode |
|
67 | +var $LayoutMode; //layout display mode |
|
68 | +var $title; //title |
|
69 | +var $subject; //subject |
|
70 | +var $author; //author |
|
71 | +var $keywords; //keywords |
|
72 | +var $creator; //creator |
|
73 | +var $AliasNbPages; //alias for total number of pages |
|
74 | +var $PDFVersion; //PDF version number |
|
75 | 75 | |
76 | 76 | /******************************************************************************* |
77 | 77 | * * |
78 | 78 | * Public methods * |
79 | 79 | * * |
80 | 80 | *******************************************************************************/ |
81 | -function wpshop_FPDF($orientation='P', $unit='mm', $format='A4') |
|
81 | +function wpshop_FPDF($orientation = 'P', $unit = 'mm', $format = 'A4') |
|
82 | 82 | { |
83 | 83 | //Some checks |
84 | 84 | $this->_dochecks(); |
85 | 85 | //Initialization of properties |
86 | - $this->page=0; |
|
87 | - $this->n=2; |
|
88 | - $this->buffer=''; |
|
89 | - $this->pages=array(); |
|
90 | - $this->PageSizes=array(); |
|
91 | - $this->state=0; |
|
92 | - $this->fonts=array(); |
|
93 | - $this->FontFiles=array(); |
|
94 | - $this->diffs=array(); |
|
95 | - $this->images=array(); |
|
96 | - $this->links=array(); |
|
97 | - $this->InHeader=false; |
|
98 | - $this->InFooter=false; |
|
99 | - $this->lasth=0; |
|
100 | - $this->FontFamily=''; |
|
101 | - $this->FontStyle=''; |
|
102 | - $this->FontSizePt=12; |
|
103 | - $this->underline=false; |
|
104 | - $this->DrawColor='0 G'; |
|
105 | - $this->FillColor='0 g'; |
|
106 | - $this->TextColor='0 g'; |
|
107 | - $this->ColorFlag=false; |
|
108 | - $this->ws=0; |
|
86 | + $this->page = 0; |
|
87 | + $this->n = 2; |
|
88 | + $this->buffer = ''; |
|
89 | + $this->pages = array(); |
|
90 | + $this->PageSizes = array(); |
|
91 | + $this->state = 0; |
|
92 | + $this->fonts = array(); |
|
93 | + $this->FontFiles = array(); |
|
94 | + $this->diffs = array(); |
|
95 | + $this->images = array(); |
|
96 | + $this->links = array(); |
|
97 | + $this->InHeader = false; |
|
98 | + $this->InFooter = false; |
|
99 | + $this->lasth = 0; |
|
100 | + $this->FontFamily = ''; |
|
101 | + $this->FontStyle = ''; |
|
102 | + $this->FontSizePt = 12; |
|
103 | + $this->underline = false; |
|
104 | + $this->DrawColor = '0 G'; |
|
105 | + $this->FillColor = '0 g'; |
|
106 | + $this->TextColor = '0 g'; |
|
107 | + $this->ColorFlag = false; |
|
108 | + $this->ws = 0; |
|
109 | 109 | //Standard fonts |
110 | - $this->CoreFonts=array('courier'=>'Courier', 'courierB'=>'Courier-Bold', 'courierI'=>'Courier-Oblique', 'courierBI'=>'Courier-BoldOblique', |
|
110 | + $this->CoreFonts = array('courier'=>'Courier', 'courierB'=>'Courier-Bold', 'courierI'=>'Courier-Oblique', 'courierBI'=>'Courier-BoldOblique', |
|
111 | 111 | 'helvetica'=>'Helvetica', 'helveticaB'=>'Helvetica-Bold', 'helveticaI'=>'Helvetica-Oblique', 'helveticaBI'=>'Helvetica-BoldOblique', |
112 | 112 | 'times'=>'Times-Roman', 'timesB'=>'Times-Bold', 'timesI'=>'Times-Italic', 'timesBI'=>'Times-BoldItalic', |
113 | 113 | 'symbol'=>'Symbol', 'zapfdingbats'=>'ZapfDingbats'); |
114 | 114 | //Scale factor |
115 | - if($unit=='pt') |
|
116 | - $this->k=1; |
|
117 | - elseif($unit=='mm') |
|
118 | - $this->k=72/25.4; |
|
119 | - elseif($unit=='cm') |
|
120 | - $this->k=72/2.54; |
|
121 | - elseif($unit=='in') |
|
122 | - $this->k=72; |
|
115 | + if ($unit == 'pt') |
|
116 | + $this->k = 1; |
|
117 | + elseif ($unit == 'mm') |
|
118 | + $this->k = 72 / 25.4; |
|
119 | + elseif ($unit == 'cm') |
|
120 | + $this->k = 72 / 2.54; |
|
121 | + elseif ($unit == 'in') |
|
122 | + $this->k = 72; |
|
123 | 123 | else |
124 | - $this->Error('Incorrect unit: '.$unit); |
|
124 | + $this->Error('Incorrect unit: ' . $unit); |
|
125 | 125 | //Page format |
126 | - $this->PageFormats=array('a3'=>array(841.89,1190.55), 'a4'=>array(595.28,841.89), 'a5'=>array(420.94,595.28), |
|
127 | - 'letter'=>array(612,792), 'legal'=>array(612,1008)); |
|
128 | - if(is_string($format)) |
|
129 | - $format=$this->_getpageformat($format); |
|
130 | - $this->DefPageFormat=$format; |
|
131 | - $this->CurPageFormat=$format; |
|
126 | + $this->PageFormats = array('a3'=>array(841.89, 1190.55), 'a4'=>array(595.28, 841.89), 'a5'=>array(420.94, 595.28), |
|
127 | + 'letter'=>array(612, 792), 'legal'=>array(612, 1008)); |
|
128 | + if (is_string($format)) |
|
129 | + $format = $this->_getpageformat($format); |
|
130 | + $this->DefPageFormat = $format; |
|
131 | + $this->CurPageFormat = $format; |
|
132 | 132 | //Page orientation |
133 | - $orientation=strtolower($orientation); |
|
134 | - if($orientation=='p' || $orientation=='portrait') |
|
133 | + $orientation = strtolower($orientation); |
|
134 | + if ($orientation == 'p' || $orientation == 'portrait') |
|
135 | 135 | { |
136 | - $this->DefOrientation='P'; |
|
137 | - $this->w=$this->DefPageFormat[0]; |
|
138 | - $this->h=$this->DefPageFormat[1]; |
|
136 | + $this->DefOrientation = 'P'; |
|
137 | + $this->w = $this->DefPageFormat[0]; |
|
138 | + $this->h = $this->DefPageFormat[1]; |
|
139 | 139 | } |
140 | - elseif($orientation=='l' || $orientation=='landscape') |
|
140 | + elseif ($orientation == 'l' || $orientation == 'landscape') |
|
141 | 141 | { |
142 | - $this->DefOrientation='L'; |
|
143 | - $this->w=$this->DefPageFormat[1]; |
|
144 | - $this->h=$this->DefPageFormat[0]; |
|
142 | + $this->DefOrientation = 'L'; |
|
143 | + $this->w = $this->DefPageFormat[1]; |
|
144 | + $this->h = $this->DefPageFormat[0]; |
|
145 | 145 | } |
146 | 146 | else |
147 | - $this->Error('Incorrect orientation: '.$orientation); |
|
148 | - $this->CurOrientation=$this->DefOrientation; |
|
149 | - $this->wPt=$this->w*$this->k; |
|
150 | - $this->hPt=$this->h*$this->k; |
|
147 | + $this->Error('Incorrect orientation: ' . $orientation); |
|
148 | + $this->CurOrientation = $this->DefOrientation; |
|
149 | + $this->wPt = $this->w * $this->k; |
|
150 | + $this->hPt = $this->h * $this->k; |
|
151 | 151 | //Page margins (1 cm) |
152 | - $margin=28.35/$this->k; |
|
153 | - $this->SetMargins($margin,$margin); |
|
152 | + $margin = 28.35 / $this->k; |
|
153 | + $this->SetMargins($margin, $margin); |
|
154 | 154 | //Interior cell margin (1 mm) |
155 | - $this->cMargin=$margin/10; |
|
155 | + $this->cMargin = $margin / 10; |
|
156 | 156 | //Line width (0.2 mm) |
157 | - $this->LineWidth=.567/$this->k; |
|
157 | + $this->LineWidth = .567 / $this->k; |
|
158 | 158 | //Automatic page break |
159 | - $this->SetAutoPageBreak(true,2*$margin); |
|
159 | + $this->SetAutoPageBreak(true, 2 * $margin); |
|
160 | 160 | //Full width display mode |
161 | 161 | $this->SetDisplayMode('fullwidth'); |
162 | 162 | //Enable compression |
163 | 163 | $this->SetCompression(true); |
164 | 164 | //Set default PDF version number |
165 | - $this->PDFVersion='1.3'; |
|
165 | + $this->PDFVersion = '1.3'; |
|
166 | 166 | } |
167 | 167 | |
168 | -function SetMargins($left, $top, $right=null) |
|
168 | +function SetMargins($left, $top, $right = null) |
|
169 | 169 | { |
170 | 170 | //Set left, top and right margins |
171 | - $this->lMargin=$left; |
|
172 | - $this->tMargin=$top; |
|
173 | - if($right===null) |
|
174 | - $right=$left; |
|
175 | - $this->rMargin=$right; |
|
171 | + $this->lMargin = $left; |
|
172 | + $this->tMargin = $top; |
|
173 | + if ($right === null) |
|
174 | + $right = $left; |
|
175 | + $this->rMargin = $right; |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | function SetLeftMargin($margin) |
179 | 179 | { |
180 | 180 | //Set left margin |
181 | - $this->lMargin=$margin; |
|
182 | - if($this->page>0 && $this->x<$margin) |
|
183 | - $this->x=$margin; |
|
181 | + $this->lMargin = $margin; |
|
182 | + if ($this->page > 0 && $this->x < $margin) |
|
183 | + $this->x = $margin; |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | function SetTopMargin($margin) |
187 | 187 | { |
188 | 188 | //Set top margin |
189 | - $this->tMargin=$margin; |
|
189 | + $this->tMargin = $margin; |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | function SetRightMargin($margin) |
193 | 193 | { |
194 | 194 | //Set right margin |
195 | - $this->rMargin=$margin; |
|
195 | + $this->rMargin = $margin; |
|
196 | 196 | } |
197 | 197 | |
198 | -function SetAutoPageBreak($auto, $margin=0) |
|
198 | +function SetAutoPageBreak($auto, $margin = 0) |
|
199 | 199 | { |
200 | 200 | //Set auto page break mode and triggering margin |
201 | - $this->AutoPageBreak=$auto; |
|
202 | - $this->bMargin=$margin; |
|
203 | - $this->PageBreakTrigger=$this->h-$margin; |
|
201 | + $this->AutoPageBreak = $auto; |
|
202 | + $this->bMargin = $margin; |
|
203 | + $this->PageBreakTrigger = $this->h - $margin; |
|
204 | 204 | } |
205 | 205 | |
206 | -function SetDisplayMode($zoom, $layout='continuous') |
|
206 | +function SetDisplayMode($zoom, $layout = 'continuous') |
|
207 | 207 | { |
208 | 208 | //Set display mode in viewer |
209 | - if($zoom=='fullpage' || $zoom=='fullwidth' || $zoom=='real' || $zoom=='default' || !is_string($zoom)) |
|
210 | - $this->ZoomMode=$zoom; |
|
209 | + if ($zoom == 'fullpage' || $zoom == 'fullwidth' || $zoom == 'real' || $zoom == 'default' || !is_string($zoom)) |
|
210 | + $this->ZoomMode = $zoom; |
|
211 | 211 | else |
212 | - $this->Error('Incorrect zoom display mode: '.$zoom); |
|
213 | - if($layout=='single' || $layout=='continuous' || $layout=='two' || $layout=='default') |
|
214 | - $this->LayoutMode=$layout; |
|
212 | + $this->Error('Incorrect zoom display mode: ' . $zoom); |
|
213 | + if ($layout == 'single' || $layout == 'continuous' || $layout == 'two' || $layout == 'default') |
|
214 | + $this->LayoutMode = $layout; |
|
215 | 215 | else |
216 | - $this->Error('Incorrect layout display mode: '.$layout); |
|
216 | + $this->Error('Incorrect layout display mode: ' . $layout); |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | function SetCompression($compress) |
220 | 220 | { |
221 | 221 | //Set page compression |
222 | - if(function_exists('gzcompress')) |
|
223 | - $this->compress=$compress; |
|
222 | + if (function_exists('gzcompress')) |
|
223 | + $this->compress = $compress; |
|
224 | 224 | else |
225 | - $this->compress=false; |
|
225 | + $this->compress = false; |
|
226 | 226 | } |
227 | 227 | |
228 | -function SetTitle($title, $isUTF8=false) |
|
228 | +function SetTitle($title, $isUTF8 = false) |
|
229 | 229 | { |
230 | 230 | //Title of document |
231 | - if($isUTF8) |
|
232 | - $title=$this->_UTF8toUTF16($title); |
|
233 | - $this->title=$title; |
|
231 | + if ($isUTF8) |
|
232 | + $title = $this->_UTF8toUTF16($title); |
|
233 | + $this->title = $title; |
|
234 | 234 | } |
235 | 235 | |
236 | -function SetSubject($subject, $isUTF8=false) |
|
236 | +function SetSubject($subject, $isUTF8 = false) |
|
237 | 237 | { |
238 | 238 | //Subject of document |
239 | - if($isUTF8) |
|
240 | - $subject=$this->_UTF8toUTF16($subject); |
|
241 | - $this->subject=$subject; |
|
239 | + if ($isUTF8) |
|
240 | + $subject = $this->_UTF8toUTF16($subject); |
|
241 | + $this->subject = $subject; |
|
242 | 242 | } |
243 | 243 | |
244 | -function SetAuthor($author, $isUTF8=false) |
|
244 | +function SetAuthor($author, $isUTF8 = false) |
|
245 | 245 | { |
246 | 246 | //Author of document |
247 | - if($isUTF8) |
|
248 | - $author=$this->_UTF8toUTF16($author); |
|
249 | - $this->author=$author; |
|
247 | + if ($isUTF8) |
|
248 | + $author = $this->_UTF8toUTF16($author); |
|
249 | + $this->author = $author; |
|
250 | 250 | } |
251 | 251 | |
252 | -function SetKeywords($keywords, $isUTF8=false) |
|
252 | +function SetKeywords($keywords, $isUTF8 = false) |
|
253 | 253 | { |
254 | 254 | //Keywords of document |
255 | - if($isUTF8) |
|
256 | - $keywords=$this->_UTF8toUTF16($keywords); |
|
257 | - $this->keywords=$keywords; |
|
255 | + if ($isUTF8) |
|
256 | + $keywords = $this->_UTF8toUTF16($keywords); |
|
257 | + $this->keywords = $keywords; |
|
258 | 258 | } |
259 | 259 | |
260 | -function SetCreator($creator, $isUTF8=false) |
|
260 | +function SetCreator($creator, $isUTF8 = false) |
|
261 | 261 | { |
262 | 262 | //Creator of document |
263 | - if($isUTF8) |
|
264 | - $creator=$this->_UTF8toUTF16($creator); |
|
265 | - $this->creator=$creator; |
|
263 | + if ($isUTF8) |
|
264 | + $creator = $this->_UTF8toUTF16($creator); |
|
265 | + $this->creator = $creator; |
|
266 | 266 | } |
267 | 267 | |
268 | -function AliasNbPages($alias='{nb}') |
|
268 | +function AliasNbPages($alias = '{nb}') |
|
269 | 269 | { |
270 | 270 | //Define an alias for total number of pages |
271 | - $this->AliasNbPages=$alias; |
|
271 | + $this->AliasNbPages = $alias; |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | function Error($msg) |
275 | 275 | { |
276 | 276 | //Fatal error |
277 | - die('<b>FPDF error:</b> '.$msg); |
|
277 | + die('<b>FPDF error:</b> ' . $msg); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | function Open() |
281 | 281 | { |
282 | 282 | //Begin document |
283 | - $this->state=1; |
|
283 | + $this->state = 1; |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | function Close() |
287 | 287 | { |
288 | 288 | //Terminate document |
289 | - if($this->state==3) |
|
289 | + if ($this->state == 3) |
|
290 | 290 | return; |
291 | - if($this->page==0) |
|
291 | + if ($this->page == 0) |
|
292 | 292 | $this->AddPage(); |
293 | 293 | //Page footer |
294 | - $this->InFooter=true; |
|
294 | + $this->InFooter = true; |
|
295 | 295 | $this->Footer(); |
296 | - $this->InFooter=false; |
|
296 | + $this->InFooter = false; |
|
297 | 297 | //Close page |
298 | 298 | $this->_endpage(); |
299 | 299 | //Close document |
300 | 300 | $this->_enddoc(); |
301 | 301 | } |
302 | 302 | |
303 | -function AddPage($orientation='', $format='') |
|
303 | +function AddPage($orientation = '', $format = '') |
|
304 | 304 | { |
305 | 305 | //Start a new page |
306 | - if($this->state==0) |
|
306 | + if ($this->state == 0) |
|
307 | 307 | $this->Open(); |
308 | - $family=$this->FontFamily; |
|
309 | - $style=$this->FontStyle.($this->underline ? 'U' : ''); |
|
310 | - $size=$this->FontSizePt; |
|
311 | - $lw=$this->LineWidth; |
|
312 | - $dc=$this->DrawColor; |
|
313 | - $fc=$this->FillColor; |
|
314 | - $tc=$this->TextColor; |
|
315 | - $cf=$this->ColorFlag; |
|
316 | - if($this->page>0) |
|
308 | + $family = $this->FontFamily; |
|
309 | + $style = $this->FontStyle . ($this->underline ? 'U' : ''); |
|
310 | + $size = $this->FontSizePt; |
|
311 | + $lw = $this->LineWidth; |
|
312 | + $dc = $this->DrawColor; |
|
313 | + $fc = $this->FillColor; |
|
314 | + $tc = $this->TextColor; |
|
315 | + $cf = $this->ColorFlag; |
|
316 | + if ($this->page > 0) |
|
317 | 317 | { |
318 | 318 | //Page footer |
319 | - $this->InFooter=true; |
|
319 | + $this->InFooter = true; |
|
320 | 320 | $this->Footer(); |
321 | - $this->InFooter=false; |
|
321 | + $this->InFooter = false; |
|
322 | 322 | //Close page |
323 | 323 | $this->_endpage(); |
324 | 324 | } |
325 | 325 | //Start new page |
326 | - $this->_beginpage($orientation,$format); |
|
326 | + $this->_beginpage($orientation, $format); |
|
327 | 327 | //Set line cap style to square |
328 | 328 | $this->_out('2 J'); |
329 | 329 | //Set line width |
330 | - $this->LineWidth=$lw; |
|
331 | - $this->_out(sprintf('%.2F w',$lw*$this->k)); |
|
330 | + $this->LineWidth = $lw; |
|
331 | + $this->_out(sprintf('%.2F w', $lw * $this->k)); |
|
332 | 332 | //Set font |
333 | - if($family) |
|
334 | - $this->SetFont($family,$style,$size); |
|
333 | + if ($family) |
|
334 | + $this->SetFont($family, $style, $size); |
|
335 | 335 | //Set colors |
336 | - $this->DrawColor=$dc; |
|
337 | - if($dc!='0 G') |
|
336 | + $this->DrawColor = $dc; |
|
337 | + if ($dc != '0 G') |
|
338 | 338 | $this->_out($dc); |
339 | - $this->FillColor=$fc; |
|
340 | - if($fc!='0 g') |
|
339 | + $this->FillColor = $fc; |
|
340 | + if ($fc != '0 g') |
|
341 | 341 | $this->_out($fc); |
342 | - $this->TextColor=$tc; |
|
343 | - $this->ColorFlag=$cf; |
|
342 | + $this->TextColor = $tc; |
|
343 | + $this->ColorFlag = $cf; |
|
344 | 344 | //Page header |
345 | - $this->InHeader=true; |
|
345 | + $this->InHeader = true; |
|
346 | 346 | $this->Header(); |
347 | - $this->InHeader=false; |
|
347 | + $this->InHeader = false; |
|
348 | 348 | //Restore line width |
349 | - if($this->LineWidth!=$lw) |
|
349 | + if ($this->LineWidth != $lw) |
|
350 | 350 | { |
351 | - $this->LineWidth=$lw; |
|
352 | - $this->_out(sprintf('%.2F w',$lw*$this->k)); |
|
351 | + $this->LineWidth = $lw; |
|
352 | + $this->_out(sprintf('%.2F w', $lw * $this->k)); |
|
353 | 353 | } |
354 | 354 | //Restore font |
355 | - if($family) |
|
356 | - $this->SetFont($family,$style,$size); |
|
355 | + if ($family) |
|
356 | + $this->SetFont($family, $style, $size); |
|
357 | 357 | //Restore colors |
358 | - if($this->DrawColor!=$dc) |
|
358 | + if ($this->DrawColor != $dc) |
|
359 | 359 | { |
360 | - $this->DrawColor=$dc; |
|
360 | + $this->DrawColor = $dc; |
|
361 | 361 | $this->_out($dc); |
362 | 362 | } |
363 | - if($this->FillColor!=$fc) |
|
363 | + if ($this->FillColor != $fc) |
|
364 | 364 | { |
365 | - $this->FillColor=$fc; |
|
365 | + $this->FillColor = $fc; |
|
366 | 366 | $this->_out($fc); |
367 | 367 | } |
368 | - $this->TextColor=$tc; |
|
369 | - $this->ColorFlag=$cf; |
|
368 | + $this->TextColor = $tc; |
|
369 | + $this->ColorFlag = $cf; |
|
370 | 370 | } |
371 | 371 | |
372 | 372 | function Header() |
@@ -385,230 +385,230 @@ discard block |
||
385 | 385 | return $this->page; |
386 | 386 | } |
387 | 387 | |
388 | -function SetDrawColor($r, $g=null, $b=null) |
|
388 | +function SetDrawColor($r, $g = null, $b = null) |
|
389 | 389 | { |
390 | 390 | //Set color for all stroking operations |
391 | - if(($r==0 && $g==0 && $b==0) || $g===null) |
|
392 | - $this->DrawColor=sprintf('%.3F G',$r/255); |
|
391 | + if (($r == 0 && $g == 0 && $b == 0) || $g === null) |
|
392 | + $this->DrawColor = sprintf('%.3F G', $r / 255); |
|
393 | 393 | else |
394 | - $this->DrawColor=sprintf('%.3F %.3F %.3F RG',$r/255,$g/255,$b/255); |
|
395 | - if($this->page>0) |
|
394 | + $this->DrawColor = sprintf('%.3F %.3F %.3F RG', $r / 255, $g / 255, $b / 255); |
|
395 | + if ($this->page > 0) |
|
396 | 396 | $this->_out($this->DrawColor); |
397 | 397 | } |
398 | 398 | |
399 | -function SetFillColor($r, $g=null, $b=null) |
|
399 | +function SetFillColor($r, $g = null, $b = null) |
|
400 | 400 | { |
401 | 401 | //Set color for all filling operations |
402 | - if(($r==0 && $g==0 && $b==0) || $g===null) |
|
403 | - $this->FillColor=sprintf('%.3F g',$r/255); |
|
402 | + if (($r == 0 && $g == 0 && $b == 0) || $g === null) |
|
403 | + $this->FillColor = sprintf('%.3F g', $r / 255); |
|
404 | 404 | else |
405 | - $this->FillColor=sprintf('%.3F %.3F %.3F rg',$r/255,$g/255,$b/255); |
|
406 | - $this->ColorFlag=($this->FillColor!=$this->TextColor); |
|
407 | - if($this->page>0) |
|
405 | + $this->FillColor = sprintf('%.3F %.3F %.3F rg', $r / 255, $g / 255, $b / 255); |
|
406 | + $this->ColorFlag = ($this->FillColor != $this->TextColor); |
|
407 | + if ($this->page > 0) |
|
408 | 408 | $this->_out($this->FillColor); |
409 | 409 | } |
410 | 410 | |
411 | -function SetTextColor($r, $g=null, $b=null) |
|
411 | +function SetTextColor($r, $g = null, $b = null) |
|
412 | 412 | { |
413 | 413 | //Set color for text |
414 | - if(($r==0 && $g==0 && $b==0) || $g===null) |
|
415 | - $this->TextColor=sprintf('%.3F g',$r/255); |
|
414 | + if (($r == 0 && $g == 0 && $b == 0) || $g === null) |
|
415 | + $this->TextColor = sprintf('%.3F g', $r / 255); |
|
416 | 416 | else |
417 | - $this->TextColor=sprintf('%.3F %.3F %.3F rg',$r/255,$g/255,$b/255); |
|
418 | - $this->ColorFlag=($this->FillColor!=$this->TextColor); |
|
417 | + $this->TextColor = sprintf('%.3F %.3F %.3F rg', $r / 255, $g / 255, $b / 255); |
|
418 | + $this->ColorFlag = ($this->FillColor != $this->TextColor); |
|
419 | 419 | } |
420 | 420 | |
421 | 421 | function GetStringWidth($s) |
422 | 422 | { |
423 | 423 | //Get width of a string in the current font |
424 | - $s=(string)$s; |
|
425 | - $cw=&$this->CurrentFont['cw']; |
|
426 | - $w=0; |
|
427 | - $l=strlen($s); |
|
428 | - for($i=0;$i<$l;$i++) |
|
429 | - $w+=$cw[$s[$i]]; |
|
430 | - return $w*$this->FontSize/1000; |
|
424 | + $s = (string)$s; |
|
425 | + $cw = &$this->CurrentFont['cw']; |
|
426 | + $w = 0; |
|
427 | + $l = strlen($s); |
|
428 | + for ($i = 0; $i < $l; $i++) |
|
429 | + $w += $cw[$s[$i]]; |
|
430 | + return $w * $this->FontSize / 1000; |
|
431 | 431 | } |
432 | 432 | |
433 | 433 | function SetLineWidth($width) |
434 | 434 | { |
435 | 435 | //Set line width |
436 | - $this->LineWidth=$width; |
|
437 | - if($this->page>0) |
|
438 | - $this->_out(sprintf('%.2F w',$width*$this->k)); |
|
436 | + $this->LineWidth = $width; |
|
437 | + if ($this->page > 0) |
|
438 | + $this->_out(sprintf('%.2F w', $width * $this->k)); |
|
439 | 439 | } |
440 | 440 | |
441 | 441 | function Line($x1, $y1, $x2, $y2) |
442 | 442 | { |
443 | 443 | //Draw a line |
444 | - $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)); |
|
444 | + $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)); |
|
445 | 445 | } |
446 | 446 | |
447 | -function Rect($x, $y, $w, $h, $style='') |
|
447 | +function Rect($x, $y, $w, $h, $style = '') |
|
448 | 448 | { |
449 | 449 | //Draw a rectangle |
450 | - if($style=='F') |
|
451 | - $op='f'; |
|
452 | - elseif($style=='FD' || $style=='DF') |
|
453 | - $op='B'; |
|
450 | + if ($style == 'F') |
|
451 | + $op = 'f'; |
|
452 | + elseif ($style == 'FD' || $style == 'DF') |
|
453 | + $op = 'B'; |
|
454 | 454 | else |
455 | - $op='S'; |
|
456 | - $this->_out(sprintf('%.2F %.2F %.2F %.2F re %s',$x*$this->k,($this->h-$y)*$this->k,$w*$this->k,-$h*$this->k,$op)); |
|
455 | + $op = 'S'; |
|
456 | + $this->_out(sprintf('%.2F %.2F %.2F %.2F re %s', $x * $this->k, ($this->h - $y) * $this->k, $w * $this->k, -$h * $this->k, $op)); |
|
457 | 457 | } |
458 | 458 | |
459 | -function AddFont($family, $style='', $file='') |
|
459 | +function AddFont($family, $style = '', $file = '') |
|
460 | 460 | { |
461 | 461 | //Add a TrueType or Type1 font |
462 | - $family=strtolower($family); |
|
463 | - if($file=='') |
|
464 | - $file=str_replace(' ','',$family).strtolower($style).'.php'; |
|
465 | - if($family=='arial') |
|
466 | - $family='helvetica'; |
|
467 | - $style=strtoupper($style); |
|
468 | - if($style=='IB') |
|
469 | - $style='BI'; |
|
470 | - $fontkey=$family.$style; |
|
471 | - if(isset($this->fonts[$fontkey])) |
|
462 | + $family = strtolower($family); |
|
463 | + if ($file == '') |
|
464 | + $file = str_replace(' ', '', $family) . strtolower($style) . '.php'; |
|
465 | + if ($family == 'arial') |
|
466 | + $family = 'helvetica'; |
|
467 | + $style = strtoupper($style); |
|
468 | + if ($style == 'IB') |
|
469 | + $style = 'BI'; |
|
470 | + $fontkey = $family . $style; |
|
471 | + if (isset($this->fonts[$fontkey])) |
|
472 | 472 | return; |
473 | - include($this->_getfontpath().$file); |
|
474 | - if(!isset($name)) |
|
473 | + include($this->_getfontpath() . $file); |
|
474 | + if (!isset($name)) |
|
475 | 475 | $this->Error('Could not include font definition file'); |
476 | - $i=count($this->fonts)+1; |
|
477 | - $this->fonts[$fontkey]=array('i'=>$i, 'type'=>$type, 'name'=>$name, 'desc'=>$desc, 'up'=>$up, 'ut'=>$ut, 'cw'=>$cw, 'enc'=>$enc, 'file'=>$file); |
|
478 | - if($diff) |
|
476 | + $i = count($this->fonts) + 1; |
|
477 | + $this->fonts[$fontkey] = array('i'=>$i, 'type'=>$type, 'name'=>$name, 'desc'=>$desc, 'up'=>$up, 'ut'=>$ut, 'cw'=>$cw, 'enc'=>$enc, 'file'=>$file); |
|
478 | + if ($diff) |
|
479 | 479 | { |
480 | 480 | //Search existing encodings |
481 | - $d=0; |
|
482 | - $nb=count($this->diffs); |
|
483 | - for($i=1;$i<=$nb;$i++) |
|
481 | + $d = 0; |
|
482 | + $nb = count($this->diffs); |
|
483 | + for ($i = 1; $i <= $nb; $i++) |
|
484 | 484 | { |
485 | - if($this->diffs[$i]==$diff) |
|
485 | + if ($this->diffs[$i] == $diff) |
|
486 | 486 | { |
487 | - $d=$i; |
|
487 | + $d = $i; |
|
488 | 488 | break; |
489 | 489 | } |
490 | 490 | } |
491 | - if($d==0) |
|
491 | + if ($d == 0) |
|
492 | 492 | { |
493 | - $d=$nb+1; |
|
494 | - $this->diffs[$d]=$diff; |
|
493 | + $d = $nb + 1; |
|
494 | + $this->diffs[$d] = $diff; |
|
495 | 495 | } |
496 | - $this->fonts[$fontkey]['diff']=$d; |
|
496 | + $this->fonts[$fontkey]['diff'] = $d; |
|
497 | 497 | } |
498 | - if($file) |
|
498 | + if ($file) |
|
499 | 499 | { |
500 | - if($type=='TrueType') |
|
501 | - $this->FontFiles[$file]=array('length1'=>$originalsize); |
|
500 | + if ($type == 'TrueType') |
|
501 | + $this->FontFiles[$file] = array('length1'=>$originalsize); |
|
502 | 502 | else |
503 | - $this->FontFiles[$file]=array('length1'=>$size1, 'length2'=>$size2); |
|
503 | + $this->FontFiles[$file] = array('length1'=>$size1, 'length2'=>$size2); |
|
504 | 504 | } |
505 | 505 | } |
506 | 506 | |
507 | -function SetFont($family, $style='', $size=0) |
|
507 | +function SetFont($family, $style = '', $size = 0) |
|
508 | 508 | { |
509 | 509 | //Select a font; size given in points |
510 | 510 | global $fpdf_charwidths; |
511 | 511 | |
512 | - $family=strtolower($family); |
|
513 | - if($family=='') |
|
514 | - $family=$this->FontFamily; |
|
515 | - if($family=='arial') |
|
516 | - $family='helvetica'; |
|
517 | - elseif($family=='symbol' || $family=='zapfdingbats') |
|
518 | - $style=''; |
|
519 | - $style=strtoupper($style); |
|
520 | - if(strpos($style,'U')!==false) |
|
512 | + $family = strtolower($family); |
|
513 | + if ($family == '') |
|
514 | + $family = $this->FontFamily; |
|
515 | + if ($family == 'arial') |
|
516 | + $family = 'helvetica'; |
|
517 | + elseif ($family == 'symbol' || $family == 'zapfdingbats') |
|
518 | + $style = ''; |
|
519 | + $style = strtoupper($style); |
|
520 | + if (strpos($style, 'U') !== false) |
|
521 | 521 | { |
522 | - $this->underline=true; |
|
523 | - $style=str_replace('U','',$style); |
|
522 | + $this->underline = true; |
|
523 | + $style = str_replace('U', '', $style); |
|
524 | 524 | } |
525 | 525 | else |
526 | - $this->underline=false; |
|
527 | - if($style=='IB') |
|
528 | - $style='BI'; |
|
529 | - if($size==0) |
|
530 | - $size=$this->FontSizePt; |
|
526 | + $this->underline = false; |
|
527 | + if ($style == 'IB') |
|
528 | + $style = 'BI'; |
|
529 | + if ($size == 0) |
|
530 | + $size = $this->FontSizePt; |
|
531 | 531 | //Test if font is already selected |
532 | - if($this->FontFamily==$family && $this->FontStyle==$style && $this->FontSizePt==$size) |
|
532 | + if ($this->FontFamily == $family && $this->FontStyle == $style && $this->FontSizePt == $size) |
|
533 | 533 | return; |
534 | 534 | //Test if used for the first time |
535 | - $fontkey=$family.$style; |
|
536 | - if(!isset($this->fonts[$fontkey])) |
|
535 | + $fontkey = $family . $style; |
|
536 | + if (!isset($this->fonts[$fontkey])) |
|
537 | 537 | { |
538 | 538 | //Check if one of the standard fonts |
539 | - if(isset($this->CoreFonts[$fontkey])) |
|
539 | + if (isset($this->CoreFonts[$fontkey])) |
|
540 | 540 | { |
541 | - if(!isset($fpdf_charwidths[$fontkey])) |
|
541 | + if (!isset($fpdf_charwidths[$fontkey])) |
|
542 | 542 | { |
543 | 543 | //Load metric file |
544 | - $file=$family; |
|
545 | - if($family=='times' || $family=='helvetica') |
|
546 | - $file.=strtolower($style); |
|
547 | - include($this->_getfontpath().$file.'.php'); |
|
548 | - if(!isset($fpdf_charwidths[$fontkey])) |
|
544 | + $file = $family; |
|
545 | + if ($family == 'times' || $family == 'helvetica') |
|
546 | + $file .= strtolower($style); |
|
547 | + include($this->_getfontpath() . $file . '.php'); |
|
548 | + if (!isset($fpdf_charwidths[$fontkey])) |
|
549 | 549 | $this->Error('Could not include font metric file'); |
550 | 550 | } |
551 | - $i=count($this->fonts)+1; |
|
552 | - $name=$this->CoreFonts[$fontkey]; |
|
553 | - $cw=$fpdf_charwidths[$fontkey]; |
|
554 | - $this->fonts[$fontkey]=array('i'=>$i, 'type'=>'core', 'name'=>$name, 'up'=>-100, 'ut'=>50, 'cw'=>$cw); |
|
551 | + $i = count($this->fonts) + 1; |
|
552 | + $name = $this->CoreFonts[$fontkey]; |
|
553 | + $cw = $fpdf_charwidths[$fontkey]; |
|
554 | + $this->fonts[$fontkey] = array('i'=>$i, 'type'=>'core', 'name'=>$name, 'up'=>-100, 'ut'=>50, 'cw'=>$cw); |
|
555 | 555 | } |
556 | 556 | else |
557 | - $this->Error('Undefined font: '.$family.' '.$style); |
|
557 | + $this->Error('Undefined font: ' . $family . ' ' . $style); |
|
558 | 558 | } |
559 | 559 | //Select it |
560 | - $this->FontFamily=$family; |
|
561 | - $this->FontStyle=$style; |
|
562 | - $this->FontSizePt=$size; |
|
563 | - $this->FontSize=$size/$this->k; |
|
564 | - $this->CurrentFont=&$this->fonts[$fontkey]; |
|
565 | - if($this->page>0) |
|
566 | - $this->_out(sprintf('BT /F%d %.2F Tf ET',$this->CurrentFont['i'],$this->FontSizePt)); |
|
560 | + $this->FontFamily = $family; |
|
561 | + $this->FontStyle = $style; |
|
562 | + $this->FontSizePt = $size; |
|
563 | + $this->FontSize = $size / $this->k; |
|
564 | + $this->CurrentFont = &$this->fonts[$fontkey]; |
|
565 | + if ($this->page > 0) |
|
566 | + $this->_out(sprintf('BT /F%d %.2F Tf ET', $this->CurrentFont['i'], $this->FontSizePt)); |
|
567 | 567 | } |
568 | 568 | |
569 | 569 | function SetFontSize($size) |
570 | 570 | { |
571 | 571 | //Set font size in points |
572 | - if($this->FontSizePt==$size) |
|
572 | + if ($this->FontSizePt == $size) |
|
573 | 573 | return; |
574 | - $this->FontSizePt=$size; |
|
575 | - $this->FontSize=$size/$this->k; |
|
576 | - if($this->page>0) |
|
577 | - $this->_out(sprintf('BT /F%d %.2F Tf ET',$this->CurrentFont['i'],$this->FontSizePt)); |
|
574 | + $this->FontSizePt = $size; |
|
575 | + $this->FontSize = $size / $this->k; |
|
576 | + if ($this->page > 0) |
|
577 | + $this->_out(sprintf('BT /F%d %.2F Tf ET', $this->CurrentFont['i'], $this->FontSizePt)); |
|
578 | 578 | } |
579 | 579 | |
580 | 580 | function AddLink() |
581 | 581 | { |
582 | 582 | //Create a new internal link |
583 | - $n=count($this->links)+1; |
|
584 | - $this->links[$n]=array(0, 0); |
|
583 | + $n = count($this->links) + 1; |
|
584 | + $this->links[$n] = array(0, 0); |
|
585 | 585 | return $n; |
586 | 586 | } |
587 | 587 | |
588 | -function SetLink($link, $y=0, $page=-1) |
|
588 | +function SetLink($link, $y = 0, $page = -1) |
|
589 | 589 | { |
590 | 590 | //Set destination of internal link |
591 | - if($y==-1) |
|
592 | - $y=$this->y; |
|
593 | - if($page==-1) |
|
594 | - $page=$this->page; |
|
595 | - $this->links[$link]=array($page, $y); |
|
591 | + if ($y == -1) |
|
592 | + $y = $this->y; |
|
593 | + if ($page == -1) |
|
594 | + $page = $this->page; |
|
595 | + $this->links[$link] = array($page, $y); |
|
596 | 596 | } |
597 | 597 | |
598 | 598 | function Link($x, $y, $w, $h, $link) |
599 | 599 | { |
600 | 600 | //Put a link on the page |
601 | - $this->PageLinks[$this->page][]=array($x*$this->k, $this->hPt-$y*$this->k, $w*$this->k, $h*$this->k, $link); |
|
601 | + $this->PageLinks[$this->page][] = array($x * $this->k, $this->hPt - $y * $this->k, $w * $this->k, $h * $this->k, $link); |
|
602 | 602 | } |
603 | 603 | |
604 | 604 | function Text($x, $y, $txt) |
605 | 605 | { |
606 | 606 | //Output a string |
607 | - $s=sprintf('BT %.2F %.2F Td (%s) Tj ET',$x*$this->k,($this->h-$y)*$this->k,$this->_escape($txt)); |
|
608 | - if($this->underline && $txt!='') |
|
609 | - $s.=' '.$this->_dounderline($x,$y,$txt); |
|
610 | - if($this->ColorFlag) |
|
611 | - $s='q '.$this->TextColor.' '.$s.' Q'; |
|
607 | + $s = sprintf('BT %.2F %.2F Td (%s) Tj ET', $x * $this->k, ($this->h - $y) * $this->k, $this->_escape($txt)); |
|
608 | + if ($this->underline && $txt != '') |
|
609 | + $s .= ' ' . $this->_dounderline($x, $y, $txt); |
|
610 | + if ($this->ColorFlag) |
|
611 | + $s = 'q ' . $this->TextColor . ' ' . $s . ' Q'; |
|
612 | 612 | $this->_out($s); |
613 | 613 | } |
614 | 614 | |
@@ -618,268 +618,268 @@ discard block |
||
618 | 618 | return $this->AutoPageBreak; |
619 | 619 | } |
620 | 620 | |
621 | -function Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='') |
|
621 | +function Cell($w, $h = 0, $txt = '', $border = 0, $ln = 0, $align = '', $fill = false, $link = '') |
|
622 | 622 | { |
623 | 623 | //Output a cell |
624 | - $k=$this->k; |
|
625 | - if($this->y+$h>$this->PageBreakTrigger && !$this->InHeader && !$this->InFooter && $this->AcceptPageBreak()) |
|
624 | + $k = $this->k; |
|
625 | + if ($this->y + $h > $this->PageBreakTrigger && !$this->InHeader && !$this->InFooter && $this->AcceptPageBreak()) |
|
626 | 626 | { |
627 | 627 | //Automatic page break |
628 | - $x=$this->x; |
|
629 | - $ws=$this->ws; |
|
630 | - if($ws>0) |
|
628 | + $x = $this->x; |
|
629 | + $ws = $this->ws; |
|
630 | + if ($ws > 0) |
|
631 | 631 | { |
632 | - $this->ws=0; |
|
632 | + $this->ws = 0; |
|
633 | 633 | $this->_out('0 Tw'); |
634 | 634 | } |
635 | - $this->AddPage($this->CurOrientation,$this->CurPageFormat); |
|
636 | - $this->x=$x; |
|
637 | - if($ws>0) |
|
635 | + $this->AddPage($this->CurOrientation, $this->CurPageFormat); |
|
636 | + $this->x = $x; |
|
637 | + if ($ws > 0) |
|
638 | 638 | { |
639 | - $this->ws=$ws; |
|
640 | - $this->_out(sprintf('%.3F Tw',$ws*$k)); |
|
639 | + $this->ws = $ws; |
|
640 | + $this->_out(sprintf('%.3F Tw', $ws * $k)); |
|
641 | 641 | } |
642 | 642 | } |
643 | - if($w==0) |
|
644 | - $w=$this->w-$this->rMargin-$this->x; |
|
645 | - $s=''; |
|
646 | - if($fill || $border==1) |
|
643 | + if ($w == 0) |
|
644 | + $w = $this->w - $this->rMargin - $this->x; |
|
645 | + $s = ''; |
|
646 | + if ($fill || $border == 1) |
|
647 | 647 | { |
648 | - if($fill) |
|
649 | - $op=($border==1) ? 'B' : 'f'; |
|
648 | + if ($fill) |
|
649 | + $op = ($border == 1) ? 'B' : 'f'; |
|
650 | 650 | else |
651 | - $op='S'; |
|
652 | - $s=sprintf('%.2F %.2F %.2F %.2F re %s ',$this->x*$k,($this->h-$this->y)*$k,$w*$k,-$h*$k,$op); |
|
651 | + $op = 'S'; |
|
652 | + $s = sprintf('%.2F %.2F %.2F %.2F re %s ', $this->x * $k, ($this->h - $this->y) * $k, $w * $k, -$h * $k, $op); |
|
653 | 653 | } |
654 | - if(is_string($border)) |
|
654 | + if (is_string($border)) |
|
655 | 655 | { |
656 | - $x=$this->x; |
|
657 | - $y=$this->y; |
|
658 | - if(strpos($border,'L')!==false) |
|
659 | - $s.=sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-$y)*$k,$x*$k,($this->h-($y+$h))*$k); |
|
660 | - if(strpos($border,'T')!==false) |
|
661 | - $s.=sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-$y)*$k); |
|
662 | - if(strpos($border,'R')!==false) |
|
663 | - $s.=sprintf('%.2F %.2F m %.2F %.2F l S ',($x+$w)*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-($y+$h))*$k); |
|
664 | - if(strpos($border,'B')!==false) |
|
665 | - $s.=sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-($y+$h))*$k,($x+$w)*$k,($this->h-($y+$h))*$k); |
|
656 | + $x = $this->x; |
|
657 | + $y = $this->y; |
|
658 | + if (strpos($border, 'L') !== false) |
|
659 | + $s .= sprintf('%.2F %.2F m %.2F %.2F l S ', $x * $k, ($this->h - $y) * $k, $x * $k, ($this->h - ($y + $h)) * $k); |
|
660 | + if (strpos($border, 'T') !== false) |
|
661 | + $s .= sprintf('%.2F %.2F m %.2F %.2F l S ', $x * $k, ($this->h - $y) * $k, ($x + $w) * $k, ($this->h - $y) * $k); |
|
662 | + if (strpos($border, 'R') !== false) |
|
663 | + $s .= sprintf('%.2F %.2F m %.2F %.2F l S ', ($x + $w) * $k, ($this->h - $y) * $k, ($x + $w) * $k, ($this->h - ($y + $h)) * $k); |
|
664 | + if (strpos($border, 'B') !== false) |
|
665 | + $s .= sprintf('%.2F %.2F m %.2F %.2F l S ', $x * $k, ($this->h - ($y + $h)) * $k, ($x + $w) * $k, ($this->h - ($y + $h)) * $k); |
|
666 | 666 | } |
667 | - if($txt!=='') |
|
667 | + if ($txt !== '') |
|
668 | 668 | { |
669 | - if($align=='R') |
|
670 | - $dx=$w-$this->cMargin-$this->GetStringWidth($txt); |
|
671 | - elseif($align=='C') |
|
672 | - $dx=($w-$this->GetStringWidth($txt))/2; |
|
669 | + if ($align == 'R') |
|
670 | + $dx = $w - $this->cMargin - $this->GetStringWidth($txt); |
|
671 | + elseif ($align == 'C') |
|
672 | + $dx = ($w - $this->GetStringWidth($txt)) / 2; |
|
673 | 673 | else |
674 | - $dx=$this->cMargin; |
|
675 | - if($this->ColorFlag) |
|
676 | - $s.='q '.$this->TextColor.' '; |
|
677 | - $txt2=str_replace(')','\\)',str_replace('(','\\(',str_replace('\\','\\\\',$txt))); |
|
678 | - $s.=sprintf('BT %.2F %.2F Td (%s) Tj ET',($this->x+$dx)*$k,($this->h-($this->y+.5*$h+.3*$this->FontSize))*$k,$txt2); |
|
679 | - if($this->underline) |
|
680 | - $s.=' '.$this->_dounderline($this->x+$dx,$this->y+.5*$h+.3*$this->FontSize,$txt); |
|
681 | - if($this->ColorFlag) |
|
682 | - $s.=' Q'; |
|
683 | - if($link) |
|
684 | - $this->Link($this->x+$dx,$this->y+.5*$h-.5*$this->FontSize,$this->GetStringWidth($txt),$this->FontSize,$link); |
|
674 | + $dx = $this->cMargin; |
|
675 | + if ($this->ColorFlag) |
|
676 | + $s .= 'q ' . $this->TextColor . ' '; |
|
677 | + $txt2 = str_replace(')', '\\)', str_replace('(', '\\(', str_replace('\\', '\\\\', $txt))); |
|
678 | + $s .= sprintf('BT %.2F %.2F Td (%s) Tj ET', ($this->x + $dx) * $k, ($this->h - ($this->y + .5 * $h + .3 * $this->FontSize)) * $k, $txt2); |
|
679 | + if ($this->underline) |
|
680 | + $s .= ' ' . $this->_dounderline($this->x + $dx, $this->y + .5 * $h + .3 * $this->FontSize, $txt); |
|
681 | + if ($this->ColorFlag) |
|
682 | + $s .= ' Q'; |
|
683 | + if ($link) |
|
684 | + $this->Link($this->x + $dx, $this->y + .5 * $h - .5 * $this->FontSize, $this->GetStringWidth($txt), $this->FontSize, $link); |
|
685 | 685 | } |
686 | - if($s) |
|
686 | + if ($s) |
|
687 | 687 | $this->_out($s); |
688 | - $this->lasth=$h; |
|
689 | - if($ln>0) |
|
688 | + $this->lasth = $h; |
|
689 | + if ($ln > 0) |
|
690 | 690 | { |
691 | 691 | //Go to next line |
692 | - $this->y+=$h; |
|
693 | - if($ln==1) |
|
694 | - $this->x=$this->lMargin; |
|
692 | + $this->y += $h; |
|
693 | + if ($ln == 1) |
|
694 | + $this->x = $this->lMargin; |
|
695 | 695 | } |
696 | 696 | else |
697 | - $this->x+=$w; |
|
697 | + $this->x += $w; |
|
698 | 698 | } |
699 | 699 | |
700 | -function MultiCell($w, $h, $txt, $border=0, $align='J', $fill=false) |
|
700 | +function MultiCell($w, $h, $txt, $border = 0, $align = 'J', $fill = false) |
|
701 | 701 | { |
702 | 702 | //Output text with automatic or explicit line breaks |
703 | - $cw=&$this->CurrentFont['cw']; |
|
704 | - if($w==0) |
|
705 | - $w=$this->w-$this->rMargin-$this->x; |
|
706 | - $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; |
|
707 | - $s=str_replace("\r",'',$txt); |
|
708 | - $nb=strlen($s); |
|
709 | - if($nb>0 && $s[$nb-1]=="\n") |
|
703 | + $cw = &$this->CurrentFont['cw']; |
|
704 | + if ($w == 0) |
|
705 | + $w = $this->w - $this->rMargin - $this->x; |
|
706 | + $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->FontSize; |
|
707 | + $s = str_replace("\r", '', $txt); |
|
708 | + $nb = strlen($s); |
|
709 | + if ($nb > 0 && $s[$nb - 1] == "\n") |
|
710 | 710 | $nb--; |
711 | - $b=0; |
|
712 | - if($border) |
|
711 | + $b = 0; |
|
712 | + if ($border) |
|
713 | 713 | { |
714 | - if($border==1) |
|
714 | + if ($border == 1) |
|
715 | 715 | { |
716 | - $border='LTRB'; |
|
717 | - $b='LRT'; |
|
718 | - $b2='LR'; |
|
716 | + $border = 'LTRB'; |
|
717 | + $b = 'LRT'; |
|
718 | + $b2 = 'LR'; |
|
719 | 719 | } |
720 | 720 | else |
721 | 721 | { |
722 | - $b2=''; |
|
723 | - if(strpos($border,'L')!==false) |
|
724 | - $b2.='L'; |
|
725 | - if(strpos($border,'R')!==false) |
|
726 | - $b2.='R'; |
|
727 | - $b=(strpos($border,'T')!==false) ? $b2.'T' : $b2; |
|
722 | + $b2 = ''; |
|
723 | + if (strpos($border, 'L') !== false) |
|
724 | + $b2 .= 'L'; |
|
725 | + if (strpos($border, 'R') !== false) |
|
726 | + $b2 .= 'R'; |
|
727 | + $b = (strpos($border, 'T') !== false) ? $b2 . 'T' : $b2; |
|
728 | 728 | } |
729 | 729 | } |
730 | - $sep=-1; |
|
731 | - $i=0; |
|
732 | - $j=0; |
|
733 | - $l=0; |
|
734 | - $ns=0; |
|
735 | - $nl=1; |
|
736 | - while($i<$nb) |
|
730 | + $sep = -1; |
|
731 | + $i = 0; |
|
732 | + $j = 0; |
|
733 | + $l = 0; |
|
734 | + $ns = 0; |
|
735 | + $nl = 1; |
|
736 | + while ($i < $nb) |
|
737 | 737 | { |
738 | 738 | //Get next character |
739 | - $c=$s[$i]; |
|
740 | - if($c=="\n") |
|
739 | + $c = $s[$i]; |
|
740 | + if ($c == "\n") |
|
741 | 741 | { |
742 | 742 | //Explicit line break |
743 | - if($this->ws>0) |
|
743 | + if ($this->ws > 0) |
|
744 | 744 | { |
745 | - $this->ws=0; |
|
745 | + $this->ws = 0; |
|
746 | 746 | $this->_out('0 Tw'); |
747 | 747 | } |
748 | - $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill); |
|
748 | + $this->Cell($w, $h, substr($s, $j, $i - $j), $b, 2, $align, $fill); |
|
749 | 749 | $i++; |
750 | - $sep=-1; |
|
751 | - $j=$i; |
|
752 | - $l=0; |
|
753 | - $ns=0; |
|
750 | + $sep = -1; |
|
751 | + $j = $i; |
|
752 | + $l = 0; |
|
753 | + $ns = 0; |
|
754 | 754 | $nl++; |
755 | - if($border && $nl==2) |
|
756 | - $b=$b2; |
|
755 | + if ($border && $nl == 2) |
|
756 | + $b = $b2; |
|
757 | 757 | continue; |
758 | 758 | } |
759 | - if($c==' ') |
|
759 | + if ($c == ' ') |
|
760 | 760 | { |
761 | - $sep=$i; |
|
762 | - $ls=$l; |
|
761 | + $sep = $i; |
|
762 | + $ls = $l; |
|
763 | 763 | $ns++; |
764 | 764 | } |
765 | - $l+=$cw[$c]; |
|
766 | - if($l>$wmax) |
|
765 | + $l += $cw[$c]; |
|
766 | + if ($l > $wmax) |
|
767 | 767 | { |
768 | 768 | //Automatic line break |
769 | - if($sep==-1) |
|
769 | + if ($sep == -1) |
|
770 | 770 | { |
771 | - if($i==$j) |
|
771 | + if ($i == $j) |
|
772 | 772 | $i++; |
773 | - if($this->ws>0) |
|
773 | + if ($this->ws > 0) |
|
774 | 774 | { |
775 | - $this->ws=0; |
|
775 | + $this->ws = 0; |
|
776 | 776 | $this->_out('0 Tw'); |
777 | 777 | } |
778 | - $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill); |
|
778 | + $this->Cell($w, $h, substr($s, $j, $i - $j), $b, 2, $align, $fill); |
|
779 | 779 | } |
780 | 780 | else |
781 | 781 | { |
782 | - if($align=='J') |
|
782 | + if ($align == 'J') |
|
783 | 783 | { |
784 | - $this->ws=($ns>1) ? ($wmax-$ls)/1000*$this->FontSize/($ns-1) : 0; |
|
785 | - $this->_out(sprintf('%.3F Tw',$this->ws*$this->k)); |
|
784 | + $this->ws = ($ns > 1) ? ($wmax - $ls) / 1000 * $this->FontSize / ($ns - 1) : 0; |
|
785 | + $this->_out(sprintf('%.3F Tw', $this->ws * $this->k)); |
|
786 | 786 | } |
787 | - $this->Cell($w,$h,substr($s,$j,$sep-$j),$b,2,$align,$fill); |
|
788 | - $i=$sep+1; |
|
787 | + $this->Cell($w, $h, substr($s, $j, $sep - $j), $b, 2, $align, $fill); |
|
788 | + $i = $sep + 1; |
|
789 | 789 | } |
790 | - $sep=-1; |
|
791 | - $j=$i; |
|
792 | - $l=0; |
|
793 | - $ns=0; |
|
790 | + $sep = -1; |
|
791 | + $j = $i; |
|
792 | + $l = 0; |
|
793 | + $ns = 0; |
|
794 | 794 | $nl++; |
795 | - if($border && $nl==2) |
|
796 | - $b=$b2; |
|
795 | + if ($border && $nl == 2) |
|
796 | + $b = $b2; |
|
797 | 797 | } |
798 | 798 | else |
799 | 799 | $i++; |
800 | 800 | } |
801 | 801 | //Last chunk |
802 | - if($this->ws>0) |
|
802 | + if ($this->ws > 0) |
|
803 | 803 | { |
804 | - $this->ws=0; |
|
804 | + $this->ws = 0; |
|
805 | 805 | $this->_out('0 Tw'); |
806 | 806 | } |
807 | - if($border && strpos($border,'B')!==false) |
|
808 | - $b.='B'; |
|
809 | - $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill); |
|
810 | - $this->x=$this->lMargin; |
|
807 | + if ($border && strpos($border, 'B') !== false) |
|
808 | + $b .= 'B'; |
|
809 | + $this->Cell($w, $h, substr($s, $j, $i - $j), $b, 2, $align, $fill); |
|
810 | + $this->x = $this->lMargin; |
|
811 | 811 | } |
812 | 812 | |
813 | -function Write($h, $txt, $link='') |
|
813 | +function Write($h, $txt, $link = '') |
|
814 | 814 | { |
815 | 815 | //Output text in flowing mode |
816 | - $cw=&$this->CurrentFont['cw']; |
|
817 | - $w=$this->w-$this->rMargin-$this->x; |
|
818 | - $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; |
|
819 | - $s=str_replace("\r",'',$txt); |
|
820 | - $nb=strlen($s); |
|
821 | - $sep=-1; |
|
822 | - $i=0; |
|
823 | - $j=0; |
|
824 | - $l=0; |
|
825 | - $nl=1; |
|
826 | - while($i<$nb) |
|
816 | + $cw = &$this->CurrentFont['cw']; |
|
817 | + $w = $this->w - $this->rMargin - $this->x; |
|
818 | + $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->FontSize; |
|
819 | + $s = str_replace("\r", '', $txt); |
|
820 | + $nb = strlen($s); |
|
821 | + $sep = -1; |
|
822 | + $i = 0; |
|
823 | + $j = 0; |
|
824 | + $l = 0; |
|
825 | + $nl = 1; |
|
826 | + while ($i < $nb) |
|
827 | 827 | { |
828 | 828 | //Get next character |
829 | - $c=$s[$i]; |
|
830 | - if($c=="\n") |
|
829 | + $c = $s[$i]; |
|
830 | + if ($c == "\n") |
|
831 | 831 | { |
832 | 832 | //Explicit line break |
833 | - $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',0,$link); |
|
833 | + $this->Cell($w, $h, substr($s, $j, $i - $j), 0, 2, '', 0, $link); |
|
834 | 834 | $i++; |
835 | - $sep=-1; |
|
836 | - $j=$i; |
|
837 | - $l=0; |
|
838 | - if($nl==1) |
|
835 | + $sep = -1; |
|
836 | + $j = $i; |
|
837 | + $l = 0; |
|
838 | + if ($nl == 1) |
|
839 | 839 | { |
840 | - $this->x=$this->lMargin; |
|
841 | - $w=$this->w-$this->rMargin-$this->x; |
|
842 | - $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; |
|
840 | + $this->x = $this->lMargin; |
|
841 | + $w = $this->w - $this->rMargin - $this->x; |
|
842 | + $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->FontSize; |
|
843 | 843 | } |
844 | 844 | $nl++; |
845 | 845 | continue; |
846 | 846 | } |
847 | - if($c==' ') |
|
848 | - $sep=$i; |
|
849 | - $l+=$cw[$c]; |
|
850 | - if($l>$wmax) |
|
847 | + if ($c == ' ') |
|
848 | + $sep = $i; |
|
849 | + $l += $cw[$c]; |
|
850 | + if ($l > $wmax) |
|
851 | 851 | { |
852 | 852 | //Automatic line break |
853 | - if($sep==-1) |
|
853 | + if ($sep == -1) |
|
854 | 854 | { |
855 | - if($this->x>$this->lMargin) |
|
855 | + if ($this->x > $this->lMargin) |
|
856 | 856 | { |
857 | 857 | //Move to next line |
858 | - $this->x=$this->lMargin; |
|
859 | - $this->y+=$h; |
|
860 | - $w=$this->w-$this->rMargin-$this->x; |
|
861 | - $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; |
|
858 | + $this->x = $this->lMargin; |
|
859 | + $this->y += $h; |
|
860 | + $w = $this->w - $this->rMargin - $this->x; |
|
861 | + $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->FontSize; |
|
862 | 862 | $i++; |
863 | 863 | $nl++; |
864 | 864 | continue; |
865 | 865 | } |
866 | - if($i==$j) |
|
866 | + if ($i == $j) |
|
867 | 867 | $i++; |
868 | - $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',0,$link); |
|
868 | + $this->Cell($w, $h, substr($s, $j, $i - $j), 0, 2, '', 0, $link); |
|
869 | 869 | } |
870 | 870 | else |
871 | 871 | { |
872 | - $this->Cell($w,$h,substr($s,$j,$sep-$j),0,2,'',0,$link); |
|
873 | - $i=$sep+1; |
|
872 | + $this->Cell($w, $h, substr($s, $j, $sep - $j), 0, 2, '', 0, $link); |
|
873 | + $i = $sep + 1; |
|
874 | 874 | } |
875 | - $sep=-1; |
|
876 | - $j=$i; |
|
877 | - $l=0; |
|
878 | - if($nl==1) |
|
875 | + $sep = -1; |
|
876 | + $j = $i; |
|
877 | + $l = 0; |
|
878 | + if ($nl == 1) |
|
879 | 879 | { |
880 | - $this->x=$this->lMargin; |
|
881 | - $w=$this->w-$this->rMargin-$this->x; |
|
882 | - $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; |
|
880 | + $this->x = $this->lMargin; |
|
881 | + $w = $this->w - $this->rMargin - $this->x; |
|
882 | + $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->FontSize; |
|
883 | 883 | } |
884 | 884 | $nl++; |
885 | 885 | } |
@@ -887,74 +887,74 @@ discard block |
||
887 | 887 | $i++; |
888 | 888 | } |
889 | 889 | //Last chunk |
890 | - if($i!=$j) |
|
891 | - $this->Cell($l/1000*$this->FontSize,$h,substr($s,$j),0,0,'',0,$link); |
|
890 | + if ($i != $j) |
|
891 | + $this->Cell($l / 1000 * $this->FontSize, $h, substr($s, $j), 0, 0, '', 0, $link); |
|
892 | 892 | } |
893 | 893 | |
894 | -function Ln($h=null) |
|
894 | +function Ln($h = null) |
|
895 | 895 | { |
896 | 896 | //Line feed; default value is last cell height |
897 | - $this->x=$this->lMargin; |
|
898 | - if($h===null) |
|
899 | - $this->y+=$this->lasth; |
|
897 | + $this->x = $this->lMargin; |
|
898 | + if ($h === null) |
|
899 | + $this->y += $this->lasth; |
|
900 | 900 | else |
901 | - $this->y+=$h; |
|
901 | + $this->y += $h; |
|
902 | 902 | } |
903 | 903 | |
904 | -function Image($file, $x=null, $y=null, $w=0, $h=0, $type='', $link='') |
|
904 | +function Image($file, $x = null, $y = null, $w = 0, $h = 0, $type = '', $link = '') |
|
905 | 905 | { |
906 | 906 | //Put an image on the page |
907 | - if(!isset($this->images[$file])) |
|
907 | + if (!isset($this->images[$file])) |
|
908 | 908 | { |
909 | 909 | //First use of this image, get info |
910 | - if($type=='') |
|
910 | + if ($type == '') |
|
911 | 911 | { |
912 | - $pos=strrpos($file,'.'); |
|
913 | - if(!$pos) |
|
914 | - $this->Error('Image file has no extension and no type was specified: '.$file); |
|
915 | - $type=substr($file,$pos+1); |
|
912 | + $pos = strrpos($file, '.'); |
|
913 | + if (!$pos) |
|
914 | + $this->Error('Image file has no extension and no type was specified: ' . $file); |
|
915 | + $type = substr($file, $pos + 1); |
|
916 | 916 | } |
917 | - $type=strtolower($type); |
|
918 | - if($type=='jpeg') |
|
919 | - $type='jpg'; |
|
920 | - $mtd='_parse'.$type; |
|
921 | - if(!method_exists($this,$mtd)) |
|
922 | - $this->Error('Unsupported image type: '.$type); |
|
923 | - $info=$this->$mtd($file); |
|
924 | - $info['i']=count($this->images)+1; |
|
925 | - $this->images[$file]=$info; |
|
917 | + $type = strtolower($type); |
|
918 | + if ($type == 'jpeg') |
|
919 | + $type = 'jpg'; |
|
920 | + $mtd = '_parse' . $type; |
|
921 | + if (!method_exists($this, $mtd)) |
|
922 | + $this->Error('Unsupported image type: ' . $type); |
|
923 | + $info = $this->$mtd($file); |
|
924 | + $info['i'] = count($this->images) + 1; |
|
925 | + $this->images[$file] = $info; |
|
926 | 926 | } |
927 | 927 | else |
928 | - $info=$this->images[$file]; |
|
928 | + $info = $this->images[$file]; |
|
929 | 929 | //Automatic width and height calculation if needed |
930 | - if($w==0 && $h==0) |
|
930 | + if ($w == 0 && $h == 0) |
|
931 | 931 | { |
932 | 932 | //Put image at 72 dpi |
933 | - $w=$info['w']/$this->k; |
|
934 | - $h=$info['h']/$this->k; |
|
933 | + $w = $info['w'] / $this->k; |
|
934 | + $h = $info['h'] / $this->k; |
|
935 | 935 | } |
936 | - elseif($w==0) |
|
937 | - $w=$h*$info['w']/$info['h']; |
|
938 | - elseif($h==0) |
|
939 | - $h=$w*$info['h']/$info['w']; |
|
936 | + elseif ($w == 0) |
|
937 | + $w = $h * $info['w'] / $info['h']; |
|
938 | + elseif ($h == 0) |
|
939 | + $h = $w * $info['h'] / $info['w']; |
|
940 | 940 | //Flowing mode |
941 | - if($y===null) |
|
941 | + if ($y === null) |
|
942 | 942 | { |
943 | - if($this->y+$h>$this->PageBreakTrigger && !$this->InHeader && !$this->InFooter && $this->AcceptPageBreak()) |
|
943 | + if ($this->y + $h > $this->PageBreakTrigger && !$this->InHeader && !$this->InFooter && $this->AcceptPageBreak()) |
|
944 | 944 | { |
945 | 945 | //Automatic page break |
946 | - $x2=$this->x; |
|
947 | - $this->AddPage($this->CurOrientation,$this->CurPageFormat); |
|
948 | - $this->x=$x2; |
|
946 | + $x2 = $this->x; |
|
947 | + $this->AddPage($this->CurOrientation, $this->CurPageFormat); |
|
948 | + $this->x = $x2; |
|
949 | 949 | } |
950 | - $y=$this->y; |
|
951 | - $this->y+=$h; |
|
950 | + $y = $this->y; |
|
951 | + $this->y += $h; |
|
952 | 952 | } |
953 | - if($x===null) |
|
954 | - $x=$this->x; |
|
955 | - $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'])); |
|
956 | - if($link) |
|
957 | - $this->Link($x,$y,$w,$h,$link); |
|
953 | + if ($x === null) |
|
954 | + $x = $this->x; |
|
955 | + $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'])); |
|
956 | + if ($link) |
|
957 | + $this->Link($x, $y, $w, $h, $link); |
|
958 | 958 | } |
959 | 959 | |
960 | 960 | function GetX() |
@@ -966,10 +966,10 @@ discard block |
||
966 | 966 | function SetX($x) |
967 | 967 | { |
968 | 968 | //Set x position |
969 | - if($x>=0) |
|
970 | - $this->x=$x; |
|
969 | + if ($x >= 0) |
|
970 | + $this->x = $x; |
|
971 | 971 | else |
972 | - $this->x=$this->w+$x; |
|
972 | + $this->x = $this->w + $x; |
|
973 | 973 | } |
974 | 974 | |
975 | 975 | function GetY() |
@@ -981,11 +981,11 @@ discard block |
||
981 | 981 | function SetY($y) |
982 | 982 | { |
983 | 983 | //Set y position and reset x |
984 | - $this->x=$this->lMargin; |
|
985 | - if($y>=0) |
|
986 | - $this->y=$y; |
|
984 | + $this->x = $this->lMargin; |
|
985 | + if ($y >= 0) |
|
986 | + $this->y = $y; |
|
987 | 987 | else |
988 | - $this->y=$this->h+$y; |
|
988 | + $this->y = $this->h + $y; |
|
989 | 989 | } |
990 | 990 | |
991 | 991 | function SetXY($x, $y) |
@@ -995,69 +995,69 @@ discard block |
||
995 | 995 | $this->SetX($x); |
996 | 996 | } |
997 | 997 | |
998 | -function Output($name='', $dest='') |
|
998 | +function Output($name = '', $dest = '') |
|
999 | 999 | { |
1000 | 1000 | //Output PDF to some destination |
1001 | - if($this->state<3) |
|
1001 | + if ($this->state < 3) |
|
1002 | 1002 | $this->Close(); |
1003 | - $dest=strtoupper($dest); |
|
1004 | - if($dest=='') |
|
1003 | + $dest = strtoupper($dest); |
|
1004 | + if ($dest == '') |
|
1005 | 1005 | { |
1006 | - if($name=='') |
|
1006 | + if ($name == '') |
|
1007 | 1007 | { |
1008 | - $name='doc.pdf'; |
|
1009 | - $dest='I'; |
|
1008 | + $name = 'doc.pdf'; |
|
1009 | + $dest = 'I'; |
|
1010 | 1010 | } |
1011 | 1011 | else |
1012 | - $dest='F'; |
|
1012 | + $dest = 'F'; |
|
1013 | 1013 | } |
1014 | - switch($dest) |
|
1014 | + switch ($dest) |
|
1015 | 1015 | { |
1016 | 1016 | case 'I': |
1017 | 1017 | //Send to standard output |
1018 | - if(ob_get_length()) |
|
1018 | + if (ob_get_length()) |
|
1019 | 1019 | $this->Error('Some data has already been output, can\'t send PDF file'); |
1020 | - if(php_sapi_name()!='cli') |
|
1020 | + if (php_sapi_name() != 'cli') |
|
1021 | 1021 | { |
1022 | 1022 | //We send to a browser |
1023 | 1023 | header('Content-Type: application/pdf'); |
1024 | - if(headers_sent()) |
|
1024 | + if (headers_sent()) |
|
1025 | 1025 | $this->Error('Some data has already been output, can\'t send PDF file'); |
1026 | - header('Content-Length: '.strlen($this->buffer)); |
|
1027 | - header('Content-Disposition: inline; filename="'.$name.'"'); |
|
1026 | + header('Content-Length: ' . strlen($this->buffer)); |
|
1027 | + header('Content-Disposition: inline; filename="' . $name . '"'); |
|
1028 | 1028 | header('Cache-Control: private, max-age=0, must-revalidate'); |
1029 | 1029 | header('Pragma: public'); |
1030 | - ini_set('zlib.output_compression','0'); |
|
1030 | + ini_set('zlib.output_compression', '0'); |
|
1031 | 1031 | } |
1032 | 1032 | echo $this->buffer; |
1033 | 1033 | break; |
1034 | 1034 | case 'D': |
1035 | 1035 | //Download file |
1036 | - if(ob_get_length()) |
|
1036 | + if (ob_get_length()) |
|
1037 | 1037 | $this->Error('Some data has already been output, can\'t send PDF file'); |
1038 | 1038 | header('Content-Type: application/x-download'); |
1039 | - if(headers_sent()) |
|
1039 | + if (headers_sent()) |
|
1040 | 1040 | $this->Error('Some data has already been output, can\'t send PDF file'); |
1041 | - header('Content-Length: '.strlen($this->buffer)); |
|
1042 | - header('Content-Disposition: attachment; filename="'.$name.'"'); |
|
1041 | + header('Content-Length: ' . strlen($this->buffer)); |
|
1042 | + header('Content-Disposition: attachment; filename="' . $name . '"'); |
|
1043 | 1043 | header('Cache-Control: private, max-age=0, must-revalidate'); |
1044 | 1044 | header('Pragma: public'); |
1045 | - ini_set('zlib.output_compression','0'); |
|
1045 | + ini_set('zlib.output_compression', '0'); |
|
1046 | 1046 | echo $this->buffer; |
1047 | 1047 | break; |
1048 | 1048 | case 'F': |
1049 | 1049 | //Save to local file |
1050 | - $f=fopen($name,'wb'); |
|
1051 | - if(!$f) |
|
1052 | - $this->Error('Unable to create output file: '.$name); |
|
1053 | - fwrite($f,$this->buffer,strlen($this->buffer)); |
|
1050 | + $f = fopen($name, 'wb'); |
|
1051 | + if (!$f) |
|
1052 | + $this->Error('Unable to create output file: ' . $name); |
|
1053 | + fwrite($f, $this->buffer, strlen($this->buffer)); |
|
1054 | 1054 | fclose($f); |
1055 | 1055 | break; |
1056 | 1056 | case 'S': |
1057 | 1057 | //Return as a string |
1058 | 1058 | return $this->buffer; |
1059 | 1059 | default: |
1060 | - $this->Error('Incorrect output destination: '.$dest); |
|
1060 | + $this->Error('Incorrect output destination: ' . $dest); |
|
1061 | 1061 | } |
1062 | 1062 | return ''; |
1063 | 1063 | } |
@@ -1070,124 +1070,124 @@ discard block |
||
1070 | 1070 | function _dochecks() |
1071 | 1071 | { |
1072 | 1072 | //Check availability of %F |
1073 | - if(sprintf('%.1F',1.0)!='1.0') |
|
1073 | + if (sprintf('%.1F', 1.0) != '1.0') |
|
1074 | 1074 | $this->Error('This version of PHP is not supported'); |
1075 | 1075 | //Check mbstring overloading |
1076 | - if(ini_get('mbstring.func_overload') & 2) |
|
1076 | + if (ini_get('mbstring.func_overload') & 2) |
|
1077 | 1077 | $this->Error('mbstring overloading must be disabled'); |
1078 | 1078 | //Disable runtime magic quotes |
1079 | - if(get_magic_quotes_runtime()) |
|
1079 | + if (get_magic_quotes_runtime()) |
|
1080 | 1080 | @set_magic_quotes_runtime(0); |
1081 | 1081 | } |
1082 | 1082 | |
1083 | 1083 | function _getpageformat($format) |
1084 | 1084 | { |
1085 | - $format=strtolower($format); |
|
1086 | - if(!isset($this->PageFormats[$format])) |
|
1087 | - $this->Error('Unknown page format: '.$format); |
|
1088 | - $a=$this->PageFormats[$format]; |
|
1089 | - return array($a[0]/$this->k, $a[1]/$this->k); |
|
1085 | + $format = strtolower($format); |
|
1086 | + if (!isset($this->PageFormats[$format])) |
|
1087 | + $this->Error('Unknown page format: ' . $format); |
|
1088 | + $a = $this->PageFormats[$format]; |
|
1089 | + return array($a[0] / $this->k, $a[1] / $this->k); |
|
1090 | 1090 | } |
1091 | 1091 | |
1092 | 1092 | function _getfontpath() |
1093 | 1093 | { |
1094 | - if(!defined('FPDF_FONTPATH') && is_dir(dirname(__FILE__).'/font')) |
|
1095 | - define('FPDF_FONTPATH',dirname(__FILE__).'/font/'); |
|
1094 | + if (!defined('FPDF_FONTPATH') && is_dir(dirname(__FILE__) . '/font')) |
|
1095 | + define('FPDF_FONTPATH', dirname(__FILE__) . '/font/'); |
|
1096 | 1096 | return defined('FPDF_FONTPATH') ? FPDF_FONTPATH : ''; |
1097 | 1097 | } |
1098 | 1098 | |
1099 | 1099 | function _beginpage($orientation, $format) |
1100 | 1100 | { |
1101 | 1101 | $this->page++; |
1102 | - $this->pages[$this->page]=''; |
|
1103 | - $this->state=2; |
|
1104 | - $this->x=$this->lMargin; |
|
1105 | - $this->y=$this->tMargin; |
|
1106 | - $this->FontFamily=''; |
|
1102 | + $this->pages[$this->page] = ''; |
|
1103 | + $this->state = 2; |
|
1104 | + $this->x = $this->lMargin; |
|
1105 | + $this->y = $this->tMargin; |
|
1106 | + $this->FontFamily = ''; |
|
1107 | 1107 | //Check page size |
1108 | - if($orientation=='') |
|
1109 | - $orientation=$this->DefOrientation; |
|
1108 | + if ($orientation == '') |
|
1109 | + $orientation = $this->DefOrientation; |
|
1110 | 1110 | else |
1111 | - $orientation=strtoupper($orientation[0]); |
|
1112 | - if($format=='') |
|
1113 | - $format=$this->DefPageFormat; |
|
1111 | + $orientation = strtoupper($orientation[0]); |
|
1112 | + if ($format == '') |
|
1113 | + $format = $this->DefPageFormat; |
|
1114 | 1114 | else |
1115 | 1115 | { |
1116 | - if(is_string($format)) |
|
1117 | - $format=$this->_getpageformat($format); |
|
1116 | + if (is_string($format)) |
|
1117 | + $format = $this->_getpageformat($format); |
|
1118 | 1118 | } |
1119 | - if($orientation!=$this->CurOrientation || $format[0]!=$this->CurPageFormat[0] || $format[1]!=$this->CurPageFormat[1]) |
|
1119 | + if ($orientation != $this->CurOrientation || $format[0] != $this->CurPageFormat[0] || $format[1] != $this->CurPageFormat[1]) |
|
1120 | 1120 | { |
1121 | 1121 | //New size |
1122 | - if($orientation=='P') |
|
1122 | + if ($orientation == 'P') |
|
1123 | 1123 | { |
1124 | - $this->w=$format[0]; |
|
1125 | - $this->h=$format[1]; |
|
1124 | + $this->w = $format[0]; |
|
1125 | + $this->h = $format[1]; |
|
1126 | 1126 | } |
1127 | 1127 | else |
1128 | 1128 | { |
1129 | - $this->w=$format[1]; |
|
1130 | - $this->h=$format[0]; |
|
1129 | + $this->w = $format[1]; |
|
1130 | + $this->h = $format[0]; |
|
1131 | 1131 | } |
1132 | - $this->wPt=$this->w*$this->k; |
|
1133 | - $this->hPt=$this->h*$this->k; |
|
1134 | - $this->PageBreakTrigger=$this->h-$this->bMargin; |
|
1135 | - $this->CurOrientation=$orientation; |
|
1136 | - $this->CurPageFormat=$format; |
|
1132 | + $this->wPt = $this->w * $this->k; |
|
1133 | + $this->hPt = $this->h * $this->k; |
|
1134 | + $this->PageBreakTrigger = $this->h - $this->bMargin; |
|
1135 | + $this->CurOrientation = $orientation; |
|
1136 | + $this->CurPageFormat = $format; |
|
1137 | 1137 | } |
1138 | - if($orientation!=$this->DefOrientation || $format[0]!=$this->DefPageFormat[0] || $format[1]!=$this->DefPageFormat[1]) |
|
1139 | - $this->PageSizes[$this->page]=array($this->wPt, $this->hPt); |
|
1138 | + if ($orientation != $this->DefOrientation || $format[0] != $this->DefPageFormat[0] || $format[1] != $this->DefPageFormat[1]) |
|
1139 | + $this->PageSizes[$this->page] = array($this->wPt, $this->hPt); |
|
1140 | 1140 | } |
1141 | 1141 | |
1142 | 1142 | function _endpage() |
1143 | 1143 | { |
1144 | - $this->state=1; |
|
1144 | + $this->state = 1; |
|
1145 | 1145 | } |
1146 | 1146 | |
1147 | 1147 | function _escape($s) |
1148 | 1148 | { |
1149 | 1149 | //Escape special characters in strings |
1150 | - $s=str_replace('\\','\\\\',$s); |
|
1151 | - $s=str_replace('(','\\(',$s); |
|
1152 | - $s=str_replace(')','\\)',$s); |
|
1153 | - $s=str_replace("\r",'\\r',$s); |
|
1150 | + $s = str_replace('\\', '\\\\', $s); |
|
1151 | + $s = str_replace('(', '\\(', $s); |
|
1152 | + $s = str_replace(')', '\\)', $s); |
|
1153 | + $s = str_replace("\r", '\\r', $s); |
|
1154 | 1154 | return $s; |
1155 | 1155 | } |
1156 | 1156 | |
1157 | 1157 | function _textstring($s) |
1158 | 1158 | { |
1159 | 1159 | //Format a text string |
1160 | - return '('.$this->_escape($s).')'; |
|
1160 | + return '(' . $this->_escape($s) . ')'; |
|
1161 | 1161 | } |
1162 | 1162 | |
1163 | 1163 | function _UTF8toUTF16($s) |
1164 | 1164 | { |
1165 | 1165 | //Convert UTF-8 to UTF-16BE with BOM |
1166 | - $res="\xFE\xFF"; |
|
1167 | - $nb=strlen($s); |
|
1168 | - $i=0; |
|
1169 | - while($i<$nb) |
|
1166 | + $res = "\xFE\xFF"; |
|
1167 | + $nb = strlen($s); |
|
1168 | + $i = 0; |
|
1169 | + while ($i < $nb) |
|
1170 | 1170 | { |
1171 | - $c1=ord($s[$i++]); |
|
1172 | - if($c1>=224) |
|
1171 | + $c1 = ord($s[$i++]); |
|
1172 | + if ($c1 >= 224) |
|
1173 | 1173 | { |
1174 | 1174 | //3-byte character |
1175 | - $c2=ord($s[$i++]); |
|
1176 | - $c3=ord($s[$i++]); |
|
1177 | - $res.=chr((($c1 & 0x0F)<<4) + (($c2 & 0x3C)>>2)); |
|
1178 | - $res.=chr((($c2 & 0x03)<<6) + ($c3 & 0x3F)); |
|
1175 | + $c2 = ord($s[$i++]); |
|
1176 | + $c3 = ord($s[$i++]); |
|
1177 | + $res .= chr((($c1 & 0x0F) << 4) + (($c2 & 0x3C) >> 2)); |
|
1178 | + $res .= chr((($c2 & 0x03) << 6) + ($c3 & 0x3F)); |
|
1179 | 1179 | } |
1180 | - elseif($c1>=192) |
|
1180 | + elseif ($c1 >= 192) |
|
1181 | 1181 | { |
1182 | 1182 | //2-byte character |
1183 | - $c2=ord($s[$i++]); |
|
1184 | - $res.=chr(($c1 & 0x1C)>>2); |
|
1185 | - $res.=chr((($c1 & 0x03)<<6) + ($c2 & 0x3F)); |
|
1183 | + $c2 = ord($s[$i++]); |
|
1184 | + $res .= chr(($c1 & 0x1C) >> 2); |
|
1185 | + $res .= chr((($c1 & 0x03) << 6) + ($c2 & 0x3F)); |
|
1186 | 1186 | } |
1187 | 1187 | else |
1188 | 1188 | { |
1189 | 1189 | //Single-byte character |
1190 | - $res.="\0".chr($c1); |
|
1190 | + $res .= "\0" . chr($c1); |
|
1191 | 1191 | } |
1192 | 1192 | } |
1193 | 1193 | return $res; |
@@ -1196,32 +1196,32 @@ discard block |
||
1196 | 1196 | function _dounderline($x, $y, $txt) |
1197 | 1197 | { |
1198 | 1198 | //Underline text |
1199 | - $up=$this->CurrentFont['up']; |
|
1200 | - $ut=$this->CurrentFont['ut']; |
|
1201 | - $w=$this->GetStringWidth($txt)+$this->ws*substr_count($txt,' '); |
|
1202 | - 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); |
|
1199 | + $up = $this->CurrentFont['up']; |
|
1200 | + $ut = $this->CurrentFont['ut']; |
|
1201 | + $w = $this->GetStringWidth($txt) + $this->ws * substr_count($txt, ' '); |
|
1202 | + 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); |
|
1203 | 1203 | } |
1204 | 1204 | |
1205 | 1205 | function _parsejpg($file) |
1206 | 1206 | { |
1207 | 1207 | //Extract info from a JPEG file |
1208 | - $a=GetImageSize($file); |
|
1209 | - if(!$a) |
|
1210 | - $this->Error('Missing or incorrect image file: '.$file); |
|
1211 | - if($a[2]!=2) |
|
1212 | - $this->Error('Not a JPEG file: '.$file); |
|
1213 | - if(!isset($a['channels']) || $a['channels']==3) |
|
1214 | - $colspace='DeviceRGB'; |
|
1215 | - elseif($a['channels']==4) |
|
1216 | - $colspace='DeviceCMYK'; |
|
1208 | + $a = GetImageSize($file); |
|
1209 | + if (!$a) |
|
1210 | + $this->Error('Missing or incorrect image file: ' . $file); |
|
1211 | + if ($a[2] != 2) |
|
1212 | + $this->Error('Not a JPEG file: ' . $file); |
|
1213 | + if (!isset($a['channels']) || $a['channels'] == 3) |
|
1214 | + $colspace = 'DeviceRGB'; |
|
1215 | + elseif ($a['channels'] == 4) |
|
1216 | + $colspace = 'DeviceCMYK'; |
|
1217 | 1217 | else |
1218 | - $colspace='DeviceGray'; |
|
1219 | - $bpc=isset($a['bits']) ? $a['bits'] : 8; |
|
1218 | + $colspace = 'DeviceGray'; |
|
1219 | + $bpc = isset($a['bits']) ? $a['bits'] : 8; |
|
1220 | 1220 | //Read whole file |
1221 | - $f=fopen($file,'rb'); |
|
1222 | - $data=''; |
|
1223 | - while(!feof($f)) |
|
1224 | - $data.=fread($f,8192); |
|
1221 | + $f = fopen($file, 'rb'); |
|
1222 | + $data = ''; |
|
1223 | + while (!feof($f)) |
|
1224 | + $data .= fread($f, 8192); |
|
1225 | 1225 | fclose($f); |
1226 | 1226 | return array('w'=>$a[0], 'h'=>$a[1], 'cs'=>$colspace, 'bpc'=>$bpc, 'f'=>'DCTDecode', 'data'=>$data); |
1227 | 1227 | } |
@@ -1229,82 +1229,82 @@ discard block |
||
1229 | 1229 | function _parsepng($file) |
1230 | 1230 | { |
1231 | 1231 | //Extract info from a PNG file |
1232 | - $f=fopen($file,'rb'); |
|
1233 | - if(!$f) |
|
1234 | - $this->Error('Can\'t open image file: '.$file); |
|
1232 | + $f = fopen($file, 'rb'); |
|
1233 | + if (!$f) |
|
1234 | + $this->Error('Can\'t open image file: ' . $file); |
|
1235 | 1235 | //Check signature |
1236 | - if($this->_readstream($f,8)!=chr(137).'PNG'.chr(13).chr(10).chr(26).chr(10)) |
|
1237 | - $this->Error('Not a PNG file: '.$file); |
|
1236 | + if ($this->_readstream($f, 8) != chr(137) . 'PNG' . chr(13) . chr(10) . chr(26) . chr(10)) |
|
1237 | + $this->Error('Not a PNG file: ' . $file); |
|
1238 | 1238 | //Read header chunk |
1239 | - $this->_readstream($f,4); |
|
1240 | - if($this->_readstream($f,4)!='IHDR') |
|
1241 | - $this->Error('Incorrect PNG file: '.$file); |
|
1242 | - $w=$this->_readint($f); |
|
1243 | - $h=$this->_readint($f); |
|
1244 | - $bpc=ord($this->_readstream($f,1)); |
|
1245 | - if($bpc>8) |
|
1246 | - $this->Error('16-bit depth not supported: '.$file); |
|
1247 | - $ct=ord($this->_readstream($f,1)); |
|
1248 | - if($ct==0) |
|
1249 | - $colspace='DeviceGray'; |
|
1250 | - elseif($ct==2) |
|
1251 | - $colspace='DeviceRGB'; |
|
1252 | - elseif($ct==3) |
|
1253 | - $colspace='Indexed'; |
|
1239 | + $this->_readstream($f, 4); |
|
1240 | + if ($this->_readstream($f, 4) != 'IHDR') |
|
1241 | + $this->Error('Incorrect PNG file: ' . $file); |
|
1242 | + $w = $this->_readint($f); |
|
1243 | + $h = $this->_readint($f); |
|
1244 | + $bpc = ord($this->_readstream($f, 1)); |
|
1245 | + if ($bpc > 8) |
|
1246 | + $this->Error('16-bit depth not supported: ' . $file); |
|
1247 | + $ct = ord($this->_readstream($f, 1)); |
|
1248 | + if ($ct == 0) |
|
1249 | + $colspace = 'DeviceGray'; |
|
1250 | + elseif ($ct == 2) |
|
1251 | + $colspace = 'DeviceRGB'; |
|
1252 | + elseif ($ct == 3) |
|
1253 | + $colspace = 'Indexed'; |
|
1254 | 1254 | else |
1255 | - $this->Error('Alpha channel not supported: '.$file); |
|
1256 | - if(ord($this->_readstream($f,1))!=0) |
|
1257 | - $this->Error('Unknown compression method: '.$file); |
|
1258 | - if(ord($this->_readstream($f,1))!=0) |
|
1259 | - $this->Error('Unknown filter method: '.$file); |
|
1260 | - if(ord($this->_readstream($f,1))!=0) |
|
1261 | - $this->Error('Interlacing not supported: '.$file); |
|
1262 | - $this->_readstream($f,4); |
|
1263 | - $parms='/DecodeParms <</Predictor 15 /Colors '.($ct==2 ? 3 : 1).' /BitsPerComponent '.$bpc.' /Columns '.$w.'>>'; |
|
1255 | + $this->Error('Alpha channel not supported: ' . $file); |
|
1256 | + if (ord($this->_readstream($f, 1)) != 0) |
|
1257 | + $this->Error('Unknown compression method: ' . $file); |
|
1258 | + if (ord($this->_readstream($f, 1)) != 0) |
|
1259 | + $this->Error('Unknown filter method: ' . $file); |
|
1260 | + if (ord($this->_readstream($f, 1)) != 0) |
|
1261 | + $this->Error('Interlacing not supported: ' . $file); |
|
1262 | + $this->_readstream($f, 4); |
|
1263 | + $parms = '/DecodeParms <</Predictor 15 /Colors ' . ($ct == 2 ? 3 : 1) . ' /BitsPerComponent ' . $bpc . ' /Columns ' . $w . '>>'; |
|
1264 | 1264 | //Scan chunks looking for palette, transparency and image data |
1265 | - $pal=''; |
|
1266 | - $trns=''; |
|
1267 | - $data=''; |
|
1265 | + $pal = ''; |
|
1266 | + $trns = ''; |
|
1267 | + $data = ''; |
|
1268 | 1268 | do |
1269 | 1269 | { |
1270 | - $n=$this->_readint($f); |
|
1271 | - $type=$this->_readstream($f,4); |
|
1272 | - if($type=='PLTE') |
|
1270 | + $n = $this->_readint($f); |
|
1271 | + $type = $this->_readstream($f, 4); |
|
1272 | + if ($type == 'PLTE') |
|
1273 | 1273 | { |
1274 | 1274 | //Read palette |
1275 | - $pal=$this->_readstream($f,$n); |
|
1276 | - $this->_readstream($f,4); |
|
1275 | + $pal = $this->_readstream($f, $n); |
|
1276 | + $this->_readstream($f, 4); |
|
1277 | 1277 | } |
1278 | - elseif($type=='tRNS') |
|
1278 | + elseif ($type == 'tRNS') |
|
1279 | 1279 | { |
1280 | 1280 | //Read transparency info |
1281 | - $t=$this->_readstream($f,$n); |
|
1282 | - if($ct==0) |
|
1283 | - $trns=array(ord(substr($t,1,1))); |
|
1284 | - elseif($ct==2) |
|
1285 | - $trns=array(ord(substr($t,1,1)), ord(substr($t,3,1)), ord(substr($t,5,1))); |
|
1281 | + $t = $this->_readstream($f, $n); |
|
1282 | + if ($ct == 0) |
|
1283 | + $trns = array(ord(substr($t, 1, 1))); |
|
1284 | + elseif ($ct == 2) |
|
1285 | + $trns = array(ord(substr($t, 1, 1)), ord(substr($t, 3, 1)), ord(substr($t, 5, 1))); |
|
1286 | 1286 | else |
1287 | 1287 | { |
1288 | - $pos=strpos($t,chr(0)); |
|
1289 | - if($pos!==false) |
|
1290 | - $trns=array($pos); |
|
1288 | + $pos = strpos($t, chr(0)); |
|
1289 | + if ($pos !== false) |
|
1290 | + $trns = array($pos); |
|
1291 | 1291 | } |
1292 | - $this->_readstream($f,4); |
|
1292 | + $this->_readstream($f, 4); |
|
1293 | 1293 | } |
1294 | - elseif($type=='IDAT') |
|
1294 | + elseif ($type == 'IDAT') |
|
1295 | 1295 | { |
1296 | 1296 | //Read image data block |
1297 | - $data.=$this->_readstream($f,$n); |
|
1298 | - $this->_readstream($f,4); |
|
1297 | + $data .= $this->_readstream($f, $n); |
|
1298 | + $this->_readstream($f, 4); |
|
1299 | 1299 | } |
1300 | - elseif($type=='IEND') |
|
1300 | + elseif ($type == 'IEND') |
|
1301 | 1301 | break; |
1302 | 1302 | else |
1303 | - $this->_readstream($f,$n+4); |
|
1303 | + $this->_readstream($f, $n + 4); |
|
1304 | 1304 | } |
1305 | - while($n); |
|
1306 | - if($colspace=='Indexed' && empty($pal)) |
|
1307 | - $this->Error('Missing palette in '.$file); |
|
1305 | + while ($n); |
|
1306 | + if ($colspace == 'Indexed' && empty($pal)) |
|
1307 | + $this->Error('Missing palette in ' . $file); |
|
1308 | 1308 | fclose($f); |
1309 | 1309 | return array('w'=>$w, 'h'=>$h, 'cs'=>$colspace, 'bpc'=>$bpc, 'f'=>'FlateDecode', 'parms'=>$parms, 'pal'=>$pal, 'trns'=>$trns, 'data'=>$data); |
1310 | 1310 | } |
@@ -1312,16 +1312,16 @@ discard block |
||
1312 | 1312 | function _readstream($f, $n) |
1313 | 1313 | { |
1314 | 1314 | //Read n bytes from stream |
1315 | - $res=''; |
|
1316 | - while($n>0 && !feof($f)) |
|
1315 | + $res = ''; |
|
1316 | + while ($n > 0 && !feof($f)) |
|
1317 | 1317 | { |
1318 | - $s=fread($f,$n); |
|
1319 | - if($s===false) |
|
1318 | + $s = fread($f, $n); |
|
1319 | + if ($s === false) |
|
1320 | 1320 | $this->Error('Error while reading stream'); |
1321 | - $n-=strlen($s); |
|
1322 | - $res.=$s; |
|
1321 | + $n -= strlen($s); |
|
1322 | + $res .= $s; |
|
1323 | 1323 | } |
1324 | - if($n>0) |
|
1324 | + if ($n > 0) |
|
1325 | 1325 | $this->Error('Unexpected end of stream'); |
1326 | 1326 | return $res; |
1327 | 1327 | } |
@@ -1329,28 +1329,28 @@ discard block |
||
1329 | 1329 | function _readint($f) |
1330 | 1330 | { |
1331 | 1331 | //Read a 4-byte integer from stream |
1332 | - $a=unpack('Ni',$this->_readstream($f,4)); |
|
1332 | + $a = unpack('Ni', $this->_readstream($f, 4)); |
|
1333 | 1333 | return $a['i']; |
1334 | 1334 | } |
1335 | 1335 | |
1336 | 1336 | function _parsegif($file) |
1337 | 1337 | { |
1338 | 1338 | //Extract info from a GIF file (via PNG conversion) |
1339 | - if(!function_exists('imagepng')) |
|
1339 | + if (!function_exists('imagepng')) |
|
1340 | 1340 | $this->Error('GD extension is required for GIF support'); |
1341 | - if(!function_exists('imagecreatefromgif')) |
|
1341 | + if (!function_exists('imagecreatefromgif')) |
|
1342 | 1342 | $this->Error('GD has no GIF read support'); |
1343 | - $im=imagecreatefromgif($file); |
|
1344 | - if(!$im) |
|
1345 | - $this->Error('Missing or incorrect image file: '.$file); |
|
1346 | - imageinterlace($im,0); |
|
1347 | - $tmp=tempnam('.','gif'); |
|
1348 | - if(!$tmp) |
|
1343 | + $im = imagecreatefromgif($file); |
|
1344 | + if (!$im) |
|
1345 | + $this->Error('Missing or incorrect image file: ' . $file); |
|
1346 | + imageinterlace($im, 0); |
|
1347 | + $tmp = tempnam('.', 'gif'); |
|
1348 | + if (!$tmp) |
|
1349 | 1349 | $this->Error('Unable to create a temporary file'); |
1350 | - if(!imagepng($im,$tmp)) |
|
1350 | + if (!imagepng($im, $tmp)) |
|
1351 | 1351 | $this->Error('Error while saving to temporary file'); |
1352 | 1352 | imagedestroy($im); |
1353 | - $info=$this->_parsepng($tmp); |
|
1353 | + $info = $this->_parsepng($tmp); |
|
1354 | 1354 | unlink($tmp); |
1355 | 1355 | return $info; |
1356 | 1356 | } |
@@ -1359,8 +1359,8 @@ discard block |
||
1359 | 1359 | { |
1360 | 1360 | //Begin a new object |
1361 | 1361 | $this->n++; |
1362 | - $this->offsets[$this->n]=strlen($this->buffer); |
|
1363 | - $this->_out($this->n.' 0 obj'); |
|
1362 | + $this->offsets[$this->n] = strlen($this->buffer); |
|
1363 | + $this->_out($this->n . ' 0 obj'); |
|
1364 | 1364 | } |
1365 | 1365 | |
1366 | 1366 | function _putstream($s) |
@@ -1373,162 +1373,162 @@ discard block |
||
1373 | 1373 | function _out($s) |
1374 | 1374 | { |
1375 | 1375 | //Add a line to the document |
1376 | - if($this->state==2) |
|
1377 | - $this->pages[$this->page].=$s."\n"; |
|
1376 | + if ($this->state == 2) |
|
1377 | + $this->pages[$this->page] .= $s . "\n"; |
|
1378 | 1378 | else |
1379 | - $this->buffer.=$s."\n"; |
|
1379 | + $this->buffer .= $s . "\n"; |
|
1380 | 1380 | } |
1381 | 1381 | |
1382 | 1382 | function _putpages() |
1383 | 1383 | { |
1384 | - $nb=$this->page; |
|
1385 | - if(!empty($this->AliasNbPages)) |
|
1384 | + $nb = $this->page; |
|
1385 | + if (!empty($this->AliasNbPages)) |
|
1386 | 1386 | { |
1387 | 1387 | //Replace number of pages |
1388 | - for($n=1;$n<=$nb;$n++) |
|
1389 | - $this->pages[$n]=str_replace($this->AliasNbPages,$nb,$this->pages[$n]); |
|
1388 | + for ($n = 1; $n <= $nb; $n++) |
|
1389 | + $this->pages[$n] = str_replace($this->AliasNbPages, $nb, $this->pages[$n]); |
|
1390 | 1390 | } |
1391 | - if($this->DefOrientation=='P') |
|
1391 | + if ($this->DefOrientation == 'P') |
|
1392 | 1392 | { |
1393 | - $wPt=$this->DefPageFormat[0]*$this->k; |
|
1394 | - $hPt=$this->DefPageFormat[1]*$this->k; |
|
1393 | + $wPt = $this->DefPageFormat[0] * $this->k; |
|
1394 | + $hPt = $this->DefPageFormat[1] * $this->k; |
|
1395 | 1395 | } |
1396 | 1396 | else |
1397 | 1397 | { |
1398 | - $wPt=$this->DefPageFormat[1]*$this->k; |
|
1399 | - $hPt=$this->DefPageFormat[0]*$this->k; |
|
1398 | + $wPt = $this->DefPageFormat[1] * $this->k; |
|
1399 | + $hPt = $this->DefPageFormat[0] * $this->k; |
|
1400 | 1400 | } |
1401 | - $filter=($this->compress) ? '/Filter /FlateDecode ' : ''; |
|
1402 | - for($n=1;$n<=$nb;$n++) |
|
1401 | + $filter = ($this->compress) ? '/Filter /FlateDecode ' : ''; |
|
1402 | + for ($n = 1; $n <= $nb; $n++) |
|
1403 | 1403 | { |
1404 | 1404 | //Page |
1405 | 1405 | $this->_newobj(); |
1406 | 1406 | $this->_out('<</Type /Page'); |
1407 | 1407 | $this->_out('/Parent 1 0 R'); |
1408 | - if(isset($this->PageSizes[$n])) |
|
1409 | - $this->_out(sprintf('/MediaBox [0 0 %.2F %.2F]',$this->PageSizes[$n][0],$this->PageSizes[$n][1])); |
|
1408 | + if (isset($this->PageSizes[$n])) |
|
1409 | + $this->_out(sprintf('/MediaBox [0 0 %.2F %.2F]', $this->PageSizes[$n][0], $this->PageSizes[$n][1])); |
|
1410 | 1410 | $this->_out('/Resources 2 0 R'); |
1411 | - if(isset($this->PageLinks[$n])) |
|
1411 | + if (isset($this->PageLinks[$n])) |
|
1412 | 1412 | { |
1413 | 1413 | //Links |
1414 | - $annots='/Annots ['; |
|
1415 | - foreach($this->PageLinks[$n] as $pl) |
|
1414 | + $annots = '/Annots ['; |
|
1415 | + foreach ($this->PageLinks[$n] as $pl) |
|
1416 | 1416 | { |
1417 | - $rect=sprintf('%.2F %.2F %.2F %.2F',$pl[0],$pl[1],$pl[0]+$pl[2],$pl[1]-$pl[3]); |
|
1418 | - $annots.='<</Type /Annot /Subtype /Link /Rect ['.$rect.'] /Border [0 0 0] '; |
|
1419 | - if(is_string($pl[4])) |
|
1420 | - $annots.='/A <</S /URI /URI '.$this->_textstring($pl[4]).'>>>>'; |
|
1417 | + $rect = sprintf('%.2F %.2F %.2F %.2F', $pl[0], $pl[1], $pl[0] + $pl[2], $pl[1] - $pl[3]); |
|
1418 | + $annots .= '<</Type /Annot /Subtype /Link /Rect [' . $rect . '] /Border [0 0 0] '; |
|
1419 | + if (is_string($pl[4])) |
|
1420 | + $annots .= '/A <</S /URI /URI ' . $this->_textstring($pl[4]) . '>>>>'; |
|
1421 | 1421 | else |
1422 | 1422 | { |
1423 | - $l=$this->links[$pl[4]]; |
|
1424 | - $h=isset($this->PageSizes[$l[0]]) ? $this->PageSizes[$l[0]][1] : $hPt; |
|
1425 | - $annots.=sprintf('/Dest [%d 0 R /XYZ 0 %.2F null]>>',1+2*$l[0],$h-$l[1]*$this->k); |
|
1423 | + $l = $this->links[$pl[4]]; |
|
1424 | + $h = isset($this->PageSizes[$l[0]]) ? $this->PageSizes[$l[0]][1] : $hPt; |
|
1425 | + $annots .= sprintf('/Dest [%d 0 R /XYZ 0 %.2F null]>>', 1 + 2 * $l[0], $h - $l[1] * $this->k); |
|
1426 | 1426 | } |
1427 | 1427 | } |
1428 | - $this->_out($annots.']'); |
|
1428 | + $this->_out($annots . ']'); |
|
1429 | 1429 | } |
1430 | - $this->_out('/Contents '.($this->n+1).' 0 R>>'); |
|
1430 | + $this->_out('/Contents ' . ($this->n + 1) . ' 0 R>>'); |
|
1431 | 1431 | $this->_out('endobj'); |
1432 | 1432 | //Page content |
1433 | - $p=($this->compress) ? gzcompress($this->pages[$n]) : $this->pages[$n]; |
|
1433 | + $p = ($this->compress) ? gzcompress($this->pages[$n]) : $this->pages[$n]; |
|
1434 | 1434 | $this->_newobj(); |
1435 | - $this->_out('<<'.$filter.'/Length '.strlen($p).'>>'); |
|
1435 | + $this->_out('<<' . $filter . '/Length ' . strlen($p) . '>>'); |
|
1436 | 1436 | $this->_putstream($p); |
1437 | 1437 | $this->_out('endobj'); |
1438 | 1438 | } |
1439 | 1439 | //Pages root |
1440 | - $this->offsets[1]=strlen($this->buffer); |
|
1440 | + $this->offsets[1] = strlen($this->buffer); |
|
1441 | 1441 | $this->_out('1 0 obj'); |
1442 | 1442 | $this->_out('<</Type /Pages'); |
1443 | - $kids='/Kids ['; |
|
1444 | - for($i=0;$i<$nb;$i++) |
|
1445 | - $kids.=(3+2*$i).' 0 R '; |
|
1446 | - $this->_out($kids.']'); |
|
1447 | - $this->_out('/Count '.$nb); |
|
1448 | - $this->_out(sprintf('/MediaBox [0 0 %.2F %.2F]',$wPt,$hPt)); |
|
1443 | + $kids = '/Kids ['; |
|
1444 | + for ($i = 0; $i < $nb; $i++) |
|
1445 | + $kids .= (3 + 2 * $i) . ' 0 R '; |
|
1446 | + $this->_out($kids . ']'); |
|
1447 | + $this->_out('/Count ' . $nb); |
|
1448 | + $this->_out(sprintf('/MediaBox [0 0 %.2F %.2F]', $wPt, $hPt)); |
|
1449 | 1449 | $this->_out('>>'); |
1450 | 1450 | $this->_out('endobj'); |
1451 | 1451 | } |
1452 | 1452 | |
1453 | 1453 | function _putfonts() |
1454 | 1454 | { |
1455 | - $nf=$this->n; |
|
1456 | - foreach($this->diffs as $diff) |
|
1455 | + $nf = $this->n; |
|
1456 | + foreach ($this->diffs as $diff) |
|
1457 | 1457 | { |
1458 | 1458 | //Encodings |
1459 | 1459 | $this->_newobj(); |
1460 | - $this->_out('<</Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences ['.$diff.']>>'); |
|
1460 | + $this->_out('<</Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences [' . $diff . ']>>'); |
|
1461 | 1461 | $this->_out('endobj'); |
1462 | 1462 | } |
1463 | - foreach($this->FontFiles as $file=>$info) |
|
1463 | + foreach ($this->FontFiles as $file=>$info) |
|
1464 | 1464 | { |
1465 | 1465 | //Font file embedding |
1466 | 1466 | $this->_newobj(); |
1467 | - $this->FontFiles[$file]['n']=$this->n; |
|
1468 | - $font=''; |
|
1469 | - $f=fopen($this->_getfontpath().$file,'rb',1); |
|
1470 | - if(!$f) |
|
1467 | + $this->FontFiles[$file]['n'] = $this->n; |
|
1468 | + $font = ''; |
|
1469 | + $f = fopen($this->_getfontpath() . $file, 'rb', 1); |
|
1470 | + if (!$f) |
|
1471 | 1471 | $this->Error('Font file not found'); |
1472 | - while(!feof($f)) |
|
1473 | - $font.=fread($f,8192); |
|
1472 | + while (!feof($f)) |
|
1473 | + $font .= fread($f, 8192); |
|
1474 | 1474 | fclose($f); |
1475 | - $compressed=(substr($file,-2)=='.z'); |
|
1476 | - if(!$compressed && isset($info['length2'])) |
|
1475 | + $compressed = (substr($file, -2) == '.z'); |
|
1476 | + if (!$compressed && isset($info['length2'])) |
|
1477 | 1477 | { |
1478 | - $header=(ord($font[0])==128); |
|
1479 | - if($header) |
|
1478 | + $header = (ord($font[0]) == 128); |
|
1479 | + if ($header) |
|
1480 | 1480 | { |
1481 | 1481 | //Strip first binary header |
1482 | - $font=substr($font,6); |
|
1482 | + $font = substr($font, 6); |
|
1483 | 1483 | } |
1484 | - if($header && ord($font[$info['length1']])==128) |
|
1484 | + if ($header && ord($font[$info['length1']]) == 128) |
|
1485 | 1485 | { |
1486 | 1486 | //Strip second binary header |
1487 | - $font=substr($font,0,$info['length1']).substr($font,$info['length1']+6); |
|
1487 | + $font = substr($font, 0, $info['length1']) . substr($font, $info['length1'] + 6); |
|
1488 | 1488 | } |
1489 | 1489 | } |
1490 | - $this->_out('<</Length '.strlen($font)); |
|
1491 | - if($compressed) |
|
1490 | + $this->_out('<</Length ' . strlen($font)); |
|
1491 | + if ($compressed) |
|
1492 | 1492 | $this->_out('/Filter /FlateDecode'); |
1493 | - $this->_out('/Length1 '.$info['length1']); |
|
1494 | - if(isset($info['length2'])) |
|
1495 | - $this->_out('/Length2 '.$info['length2'].' /Length3 0'); |
|
1493 | + $this->_out('/Length1 ' . $info['length1']); |
|
1494 | + if (isset($info['length2'])) |
|
1495 | + $this->_out('/Length2 ' . $info['length2'] . ' /Length3 0'); |
|
1496 | 1496 | $this->_out('>>'); |
1497 | 1497 | $this->_putstream($font); |
1498 | 1498 | $this->_out('endobj'); |
1499 | 1499 | } |
1500 | - foreach($this->fonts as $k=>$font) |
|
1500 | + foreach ($this->fonts as $k=>$font) |
|
1501 | 1501 | { |
1502 | 1502 | //Font objects |
1503 | - $this->fonts[$k]['n']=$this->n+1; |
|
1504 | - $type=$font['type']; |
|
1505 | - $name=$font['name']; |
|
1506 | - if($type=='core') |
|
1503 | + $this->fonts[$k]['n'] = $this->n + 1; |
|
1504 | + $type = $font['type']; |
|
1505 | + $name = $font['name']; |
|
1506 | + if ($type == 'core') |
|
1507 | 1507 | { |
1508 | 1508 | //Standard font |
1509 | 1509 | $this->_newobj(); |
1510 | 1510 | $this->_out('<</Type /Font'); |
1511 | - $this->_out('/BaseFont /'.$name); |
|
1511 | + $this->_out('/BaseFont /' . $name); |
|
1512 | 1512 | $this->_out('/Subtype /Type1'); |
1513 | - if($name!='Symbol' && $name!='ZapfDingbats') |
|
1513 | + if ($name != 'Symbol' && $name != 'ZapfDingbats') |
|
1514 | 1514 | $this->_out('/Encoding /WinAnsiEncoding'); |
1515 | 1515 | $this->_out('>>'); |
1516 | 1516 | $this->_out('endobj'); |
1517 | 1517 | } |
1518 | - elseif($type=='Type1' || $type=='TrueType') |
|
1518 | + elseif ($type == 'Type1' || $type == 'TrueType') |
|
1519 | 1519 | { |
1520 | 1520 | //Additional Type1 or TrueType font |
1521 | 1521 | $this->_newobj(); |
1522 | 1522 | $this->_out('<</Type /Font'); |
1523 | - $this->_out('/BaseFont /'.$name); |
|
1524 | - $this->_out('/Subtype /'.$type); |
|
1523 | + $this->_out('/BaseFont /' . $name); |
|
1524 | + $this->_out('/Subtype /' . $type); |
|
1525 | 1525 | $this->_out('/FirstChar 32 /LastChar 255'); |
1526 | - $this->_out('/Widths '.($this->n+1).' 0 R'); |
|
1527 | - $this->_out('/FontDescriptor '.($this->n+2).' 0 R'); |
|
1528 | - if($font['enc']) |
|
1526 | + $this->_out('/Widths ' . ($this->n + 1) . ' 0 R'); |
|
1527 | + $this->_out('/FontDescriptor ' . ($this->n + 2) . ' 0 R'); |
|
1528 | + if ($font['enc']) |
|
1529 | 1529 | { |
1530 | - if(isset($font['diff'])) |
|
1531 | - $this->_out('/Encoding '.($nf+$font['diff']).' 0 R'); |
|
1530 | + if (isset($font['diff'])) |
|
1531 | + $this->_out('/Encoding ' . ($nf + $font['diff']) . ' 0 R'); |
|
1532 | 1532 | else |
1533 | 1533 | $this->_out('/Encoding /WinAnsiEncoding'); |
1534 | 1534 | } |
@@ -1536,29 +1536,29 @@ discard block |
||
1536 | 1536 | $this->_out('endobj'); |
1537 | 1537 | //Widths |
1538 | 1538 | $this->_newobj(); |
1539 | - $cw=&$font['cw']; |
|
1540 | - $s='['; |
|
1541 | - for($i=32;$i<=255;$i++) |
|
1542 | - $s.=$cw[chr($i)].' '; |
|
1543 | - $this->_out($s.']'); |
|
1539 | + $cw = &$font['cw']; |
|
1540 | + $s = '['; |
|
1541 | + for ($i = 32; $i <= 255; $i++) |
|
1542 | + $s .= $cw[chr($i)] . ' '; |
|
1543 | + $this->_out($s . ']'); |
|
1544 | 1544 | $this->_out('endobj'); |
1545 | 1545 | //Descriptor |
1546 | 1546 | $this->_newobj(); |
1547 | - $s='<</Type /FontDescriptor /FontName /'.$name; |
|
1548 | - foreach($font['desc'] as $k=>$v) |
|
1549 | - $s.=' /'.$k.' '.$v; |
|
1550 | - $file=$font['file']; |
|
1551 | - if($file) |
|
1552 | - $s.=' /FontFile'.($type=='Type1' ? '' : '2').' '.$this->FontFiles[$file]['n'].' 0 R'; |
|
1553 | - $this->_out($s.'>>'); |
|
1547 | + $s = '<</Type /FontDescriptor /FontName /' . $name; |
|
1548 | + foreach ($font['desc'] as $k=>$v) |
|
1549 | + $s .= ' /' . $k . ' ' . $v; |
|
1550 | + $file = $font['file']; |
|
1551 | + if ($file) |
|
1552 | + $s .= ' /FontFile' . ($type == 'Type1' ? '' : '2') . ' ' . $this->FontFiles[$file]['n'] . ' 0 R'; |
|
1553 | + $this->_out($s . '>>'); |
|
1554 | 1554 | $this->_out('endobj'); |
1555 | 1555 | } |
1556 | 1556 | else |
1557 | 1557 | { |
1558 | 1558 | //Allow for additional types |
1559 | - $mtd='_put'.strtolower($type); |
|
1560 | - if(!method_exists($this,$mtd)) |
|
1561 | - $this->Error('Unsupported font type: '.$type); |
|
1559 | + $mtd = '_put' . strtolower($type); |
|
1560 | + if (!method_exists($this, $mtd)) |
|
1561 | + $this->Error('Unsupported font type: ' . $type); |
|
1562 | 1562 | $this->$mtd($font); |
1563 | 1563 | } |
1564 | 1564 | } |
@@ -1566,46 +1566,46 @@ discard block |
||
1566 | 1566 | |
1567 | 1567 | function _putimages() |
1568 | 1568 | { |
1569 | - $filter=($this->compress) ? '/Filter /FlateDecode ' : ''; |
|
1569 | + $filter = ($this->compress) ? '/Filter /FlateDecode ' : ''; |
|
1570 | 1570 | reset($this->images); |
1571 | - while(list($file,$info)=each($this->images)) |
|
1571 | + while (list($file, $info) = each($this->images)) |
|
1572 | 1572 | { |
1573 | 1573 | $this->_newobj(); |
1574 | - $this->images[$file]['n']=$this->n; |
|
1574 | + $this->images[$file]['n'] = $this->n; |
|
1575 | 1575 | $this->_out('<</Type /XObject'); |
1576 | 1576 | $this->_out('/Subtype /Image'); |
1577 | - $this->_out('/Width '.$info['w']); |
|
1578 | - $this->_out('/Height '.$info['h']); |
|
1579 | - if($info['cs']=='Indexed') |
|
1580 | - $this->_out('/ColorSpace [/Indexed /DeviceRGB '.(strlen($info['pal'])/3-1).' '.($this->n+1).' 0 R]'); |
|
1577 | + $this->_out('/Width ' . $info['w']); |
|
1578 | + $this->_out('/Height ' . $info['h']); |
|
1579 | + if ($info['cs'] == 'Indexed') |
|
1580 | + $this->_out('/ColorSpace [/Indexed /DeviceRGB ' . (strlen($info['pal']) / 3 - 1) . ' ' . ($this->n + 1) . ' 0 R]'); |
|
1581 | 1581 | else |
1582 | 1582 | { |
1583 | - $this->_out('/ColorSpace /'.$info['cs']); |
|
1584 | - if($info['cs']=='DeviceCMYK') |
|
1583 | + $this->_out('/ColorSpace /' . $info['cs']); |
|
1584 | + if ($info['cs'] == 'DeviceCMYK') |
|
1585 | 1585 | $this->_out('/Decode [1 0 1 0 1 0 1 0]'); |
1586 | 1586 | } |
1587 | - $this->_out('/BitsPerComponent '.$info['bpc']); |
|
1588 | - if(isset($info['f'])) |
|
1589 | - $this->_out('/Filter /'.$info['f']); |
|
1590 | - if(isset($info['parms'])) |
|
1587 | + $this->_out('/BitsPerComponent ' . $info['bpc']); |
|
1588 | + if (isset($info['f'])) |
|
1589 | + $this->_out('/Filter /' . $info['f']); |
|
1590 | + if (isset($info['parms'])) |
|
1591 | 1591 | $this->_out($info['parms']); |
1592 | - if(isset($info['trns']) && is_array($info['trns'])) |
|
1592 | + if (isset($info['trns']) && is_array($info['trns'])) |
|
1593 | 1593 | { |
1594 | - $trns=''; |
|
1595 | - for($i=0;$i<count($info['trns']);$i++) |
|
1596 | - $trns.=$info['trns'][$i].' '.$info['trns'][$i].' '; |
|
1597 | - $this->_out('/Mask ['.$trns.']'); |
|
1594 | + $trns = ''; |
|
1595 | + for ($i = 0; $i < count($info['trns']); $i++) |
|
1596 | + $trns .= $info['trns'][$i] . ' ' . $info['trns'][$i] . ' '; |
|
1597 | + $this->_out('/Mask [' . $trns . ']'); |
|
1598 | 1598 | } |
1599 | - $this->_out('/Length '.strlen($info['data']).'>>'); |
|
1599 | + $this->_out('/Length ' . strlen($info['data']) . '>>'); |
|
1600 | 1600 | $this->_putstream($info['data']); |
1601 | 1601 | unset($this->images[$file]['data']); |
1602 | 1602 | $this->_out('endobj'); |
1603 | 1603 | //Palette |
1604 | - if($info['cs']=='Indexed') |
|
1604 | + if ($info['cs'] == 'Indexed') |
|
1605 | 1605 | { |
1606 | 1606 | $this->_newobj(); |
1607 | - $pal=($this->compress) ? gzcompress($info['pal']) : $info['pal']; |
|
1608 | - $this->_out('<<'.$filter.'/Length '.strlen($pal).'>>'); |
|
1607 | + $pal = ($this->compress) ? gzcompress($info['pal']) : $info['pal']; |
|
1608 | + $this->_out('<<' . $filter . '/Length ' . strlen($pal) . '>>'); |
|
1609 | 1609 | $this->_putstream($pal); |
1610 | 1610 | $this->_out('endobj'); |
1611 | 1611 | } |
@@ -1614,16 +1614,16 @@ discard block |
||
1614 | 1614 | |
1615 | 1615 | function _putxobjectdict() |
1616 | 1616 | { |
1617 | - foreach($this->images as $image) |
|
1618 | - $this->_out('/I'.$image['i'].' '.$image['n'].' 0 R'); |
|
1617 | + foreach ($this->images as $image) |
|
1618 | + $this->_out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R'); |
|
1619 | 1619 | } |
1620 | 1620 | |
1621 | 1621 | function _putresourcedict() |
1622 | 1622 | { |
1623 | 1623 | $this->_out('/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]'); |
1624 | 1624 | $this->_out('/Font <<'); |
1625 | - foreach($this->fonts as $font) |
|
1626 | - $this->_out('/F'.$font['i'].' '.$font['n'].' 0 R'); |
|
1625 | + foreach ($this->fonts as $font) |
|
1626 | + $this->_out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R'); |
|
1627 | 1627 | $this->_out('>>'); |
1628 | 1628 | $this->_out('/XObject <<'); |
1629 | 1629 | $this->_putxobjectdict(); |
@@ -1635,7 +1635,7 @@ discard block |
||
1635 | 1635 | $this->_putfonts(); |
1636 | 1636 | $this->_putimages(); |
1637 | 1637 | //Resource dictionary |
1638 | - $this->offsets[2]=strlen($this->buffer); |
|
1638 | + $this->offsets[2] = strlen($this->buffer); |
|
1639 | 1639 | $this->_out('2 0 obj'); |
1640 | 1640 | $this->_out('<<'); |
1641 | 1641 | $this->_putresourcedict(); |
@@ -1645,50 +1645,50 @@ discard block |
||
1645 | 1645 | |
1646 | 1646 | function _putinfo() |
1647 | 1647 | { |
1648 | - $this->_out('/Producer '.$this->_textstring('FPDF '.FPDF_VERSION)); |
|
1649 | - if(!empty($this->title)) |
|
1650 | - $this->_out('/Title '.$this->_textstring($this->title)); |
|
1651 | - if(!empty($this->subject)) |
|
1652 | - $this->_out('/Subject '.$this->_textstring($this->subject)); |
|
1653 | - if(!empty($this->author)) |
|
1654 | - $this->_out('/Author '.$this->_textstring($this->author)); |
|
1655 | - if(!empty($this->keywords)) |
|
1656 | - $this->_out('/Keywords '.$this->_textstring($this->keywords)); |
|
1657 | - if(!empty($this->creator)) |
|
1658 | - $this->_out('/Creator '.$this->_textstring($this->creator)); |
|
1659 | - $this->_out('/CreationDate '.$this->_textstring('D:'.@date('YmdHis'))); |
|
1648 | + $this->_out('/Producer ' . $this->_textstring('FPDF ' . FPDF_VERSION)); |
|
1649 | + if (!empty($this->title)) |
|
1650 | + $this->_out('/Title ' . $this->_textstring($this->title)); |
|
1651 | + if (!empty($this->subject)) |
|
1652 | + $this->_out('/Subject ' . $this->_textstring($this->subject)); |
|
1653 | + if (!empty($this->author)) |
|
1654 | + $this->_out('/Author ' . $this->_textstring($this->author)); |
|
1655 | + if (!empty($this->keywords)) |
|
1656 | + $this->_out('/Keywords ' . $this->_textstring($this->keywords)); |
|
1657 | + if (!empty($this->creator)) |
|
1658 | + $this->_out('/Creator ' . $this->_textstring($this->creator)); |
|
1659 | + $this->_out('/CreationDate ' . $this->_textstring('D:' . @date('YmdHis'))); |
|
1660 | 1660 | } |
1661 | 1661 | |
1662 | 1662 | function _putcatalog() |
1663 | 1663 | { |
1664 | 1664 | $this->_out('/Type /Catalog'); |
1665 | 1665 | $this->_out('/Pages 1 0 R'); |
1666 | - if($this->ZoomMode=='fullpage') |
|
1666 | + if ($this->ZoomMode == 'fullpage') |
|
1667 | 1667 | $this->_out('/OpenAction [3 0 R /Fit]'); |
1668 | - elseif($this->ZoomMode=='fullwidth') |
|
1668 | + elseif ($this->ZoomMode == 'fullwidth') |
|
1669 | 1669 | $this->_out('/OpenAction [3 0 R /FitH null]'); |
1670 | - elseif($this->ZoomMode=='real') |
|
1670 | + elseif ($this->ZoomMode == 'real') |
|
1671 | 1671 | $this->_out('/OpenAction [3 0 R /XYZ null null 1]'); |
1672 | - elseif(!is_string($this->ZoomMode)) |
|
1673 | - $this->_out('/OpenAction [3 0 R /XYZ null null '.($this->ZoomMode/100).']'); |
|
1674 | - if($this->LayoutMode=='single') |
|
1672 | + elseif (!is_string($this->ZoomMode)) |
|
1673 | + $this->_out('/OpenAction [3 0 R /XYZ null null ' . ($this->ZoomMode / 100) . ']'); |
|
1674 | + if ($this->LayoutMode == 'single') |
|
1675 | 1675 | $this->_out('/PageLayout /SinglePage'); |
1676 | - elseif($this->LayoutMode=='continuous') |
|
1676 | + elseif ($this->LayoutMode == 'continuous') |
|
1677 | 1677 | $this->_out('/PageLayout /OneColumn'); |
1678 | - elseif($this->LayoutMode=='two') |
|
1678 | + elseif ($this->LayoutMode == 'two') |
|
1679 | 1679 | $this->_out('/PageLayout /TwoColumnLeft'); |
1680 | 1680 | } |
1681 | 1681 | |
1682 | 1682 | function _putheader() |
1683 | 1683 | { |
1684 | - $this->_out('%PDF-'.$this->PDFVersion); |
|
1684 | + $this->_out('%PDF-' . $this->PDFVersion); |
|
1685 | 1685 | } |
1686 | 1686 | |
1687 | 1687 | function _puttrailer() |
1688 | 1688 | { |
1689 | - $this->_out('/Size '.($this->n+1)); |
|
1690 | - $this->_out('/Root '.$this->n.' 0 R'); |
|
1691 | - $this->_out('/Info '.($this->n-1).' 0 R'); |
|
1689 | + $this->_out('/Size ' . ($this->n + 1)); |
|
1690 | + $this->_out('/Root ' . $this->n . ' 0 R'); |
|
1691 | + $this->_out('/Info ' . ($this->n - 1) . ' 0 R'); |
|
1692 | 1692 | } |
1693 | 1693 | |
1694 | 1694 | function _enddoc() |
@@ -1709,12 +1709,12 @@ discard block |
||
1709 | 1709 | $this->_out('>>'); |
1710 | 1710 | $this->_out('endobj'); |
1711 | 1711 | //Cross-ref |
1712 | - $o=strlen($this->buffer); |
|
1712 | + $o = strlen($this->buffer); |
|
1713 | 1713 | $this->_out('xref'); |
1714 | - $this->_out('0 '.($this->n+1)); |
|
1714 | + $this->_out('0 ' . ($this->n + 1)); |
|
1715 | 1715 | $this->_out('0000000000 65535 f '); |
1716 | - for($i=1;$i<=$this->n;$i++) |
|
1717 | - $this->_out(sprintf('%010d 00000 n ',$this->offsets[$i])); |
|
1716 | + for ($i = 1; $i <= $this->n; $i++) |
|
1717 | + $this->_out(sprintf('%010d 00000 n ', $this->offsets[$i])); |
|
1718 | 1718 | //Trailer |
1719 | 1719 | $this->_out('trailer'); |
1720 | 1720 | $this->_out('<<'); |
@@ -1723,13 +1723,13 @@ discard block |
||
1723 | 1723 | $this->_out('startxref'); |
1724 | 1724 | $this->_out($o); |
1725 | 1725 | $this->_out('%%EOF'); |
1726 | - $this->state=3; |
|
1726 | + $this->state = 3; |
|
1727 | 1727 | } |
1728 | 1728 | //End of class |
1729 | 1729 | } |
1730 | 1730 | |
1731 | 1731 | //Handle special IE contype request |
1732 | -if(isset($_SERVER['HTTP_USER_AGENT']) && $_SERVER['HTTP_USER_AGENT']=='contype') |
|
1732 | +if (isset($_SERVER['HTTP_USER_AGENT']) && $_SERVER['HTTP_USER_AGENT'] == 'contype') |
|
1733 | 1733 | { |
1734 | 1734 | header('Content-Type: application/pdf'); |
1735 | 1735 | exit; |
@@ -112,21 +112,23 @@ discard block |
||
112 | 112 | 'times'=>'Times-Roman', 'timesB'=>'Times-Bold', 'timesI'=>'Times-Italic', 'timesBI'=>'Times-BoldItalic', |
113 | 113 | 'symbol'=>'Symbol', 'zapfdingbats'=>'ZapfDingbats'); |
114 | 114 | //Scale factor |
115 | - if($unit=='pt') |
|
116 | - $this->k=1; |
|
117 | - elseif($unit=='mm') |
|
118 | - $this->k=72/25.4; |
|
119 | - elseif($unit=='cm') |
|
120 | - $this->k=72/2.54; |
|
121 | - elseif($unit=='in') |
|
122 | - $this->k=72; |
|
123 | - else |
|
124 | - $this->Error('Incorrect unit: '.$unit); |
|
115 | + if($unit=='pt') { |
|
116 | + $this->k=1; |
|
117 | + } elseif($unit=='mm') { |
|
118 | + $this->k=72/25.4; |
|
119 | + } elseif($unit=='cm') { |
|
120 | + $this->k=72/2.54; |
|
121 | + } elseif($unit=='in') { |
|
122 | + $this->k=72; |
|
123 | + } else { |
|
124 | + $this->Error('Incorrect unit: '.$unit); |
|
125 | + } |
|
125 | 126 | //Page format |
126 | 127 | $this->PageFormats=array('a3'=>array(841.89,1190.55), 'a4'=>array(595.28,841.89), 'a5'=>array(420.94,595.28), |
127 | 128 | 'letter'=>array(612,792), 'legal'=>array(612,1008)); |
128 | - if(is_string($format)) |
|
129 | - $format=$this->_getpageformat($format); |
|
129 | + if(is_string($format)) { |
|
130 | + $format=$this->_getpageformat($format); |
|
131 | + } |
|
130 | 132 | $this->DefPageFormat=$format; |
131 | 133 | $this->CurPageFormat=$format; |
132 | 134 | //Page orientation |
@@ -136,15 +138,14 @@ discard block |
||
136 | 138 | $this->DefOrientation='P'; |
137 | 139 | $this->w=$this->DefPageFormat[0]; |
138 | 140 | $this->h=$this->DefPageFormat[1]; |
139 | - } |
|
140 | - elseif($orientation=='l' || $orientation=='landscape') |
|
141 | + } elseif($orientation=='l' || $orientation=='landscape') |
|
141 | 142 | { |
142 | 143 | $this->DefOrientation='L'; |
143 | 144 | $this->w=$this->DefPageFormat[1]; |
144 | 145 | $this->h=$this->DefPageFormat[0]; |
146 | + } else { |
|
147 | + $this->Error('Incorrect orientation: '.$orientation); |
|
145 | 148 | } |
146 | - else |
|
147 | - $this->Error('Incorrect orientation: '.$orientation); |
|
148 | 149 | $this->CurOrientation=$this->DefOrientation; |
149 | 150 | $this->wPt=$this->w*$this->k; |
150 | 151 | $this->hPt=$this->h*$this->k; |
@@ -170,8 +171,9 @@ discard block |
||
170 | 171 | //Set left, top and right margins |
171 | 172 | $this->lMargin=$left; |
172 | 173 | $this->tMargin=$top; |
173 | - if($right===null) |
|
174 | - $right=$left; |
|
174 | + if($right===null) { |
|
175 | + $right=$left; |
|
176 | + } |
|
175 | 177 | $this->rMargin=$right; |
176 | 178 | } |
177 | 179 | |
@@ -179,9 +181,10 @@ discard block |
||
179 | 181 | { |
180 | 182 | //Set left margin |
181 | 183 | $this->lMargin=$margin; |
182 | - if($this->page>0 && $this->x<$margin) |
|
183 | - $this->x=$margin; |
|
184 | -} |
|
184 | + if($this->page>0 && $this->x<$margin) { |
|
185 | + $this->x=$margin; |
|
186 | + } |
|
187 | + } |
|
185 | 188 | |
186 | 189 | function SetTopMargin($margin) |
187 | 190 | { |
@@ -206,62 +209,70 @@ discard block |
||
206 | 209 | function SetDisplayMode($zoom, $layout='continuous') |
207 | 210 | { |
208 | 211 | //Set display mode in viewer |
209 | - if($zoom=='fullpage' || $zoom=='fullwidth' || $zoom=='real' || $zoom=='default' || !is_string($zoom)) |
|
210 | - $this->ZoomMode=$zoom; |
|
211 | - else |
|
212 | - $this->Error('Incorrect zoom display mode: '.$zoom); |
|
213 | - if($layout=='single' || $layout=='continuous' || $layout=='two' || $layout=='default') |
|
214 | - $this->LayoutMode=$layout; |
|
215 | - else |
|
216 | - $this->Error('Incorrect layout display mode: '.$layout); |
|
217 | -} |
|
212 | + if($zoom=='fullpage' || $zoom=='fullwidth' || $zoom=='real' || $zoom=='default' || !is_string($zoom)) { |
|
213 | + $this->ZoomMode=$zoom; |
|
214 | + } else { |
|
215 | + $this->Error('Incorrect zoom display mode: '.$zoom); |
|
216 | + } |
|
217 | + if($layout=='single' || $layout=='continuous' || $layout=='two' || $layout=='default') { |
|
218 | + $this->LayoutMode=$layout; |
|
219 | + } else { |
|
220 | + $this->Error('Incorrect layout display mode: '.$layout); |
|
221 | + } |
|
222 | + } |
|
218 | 223 | |
219 | 224 | function SetCompression($compress) |
220 | 225 | { |
221 | 226 | //Set page compression |
222 | - if(function_exists('gzcompress')) |
|
223 | - $this->compress=$compress; |
|
224 | - else |
|
225 | - $this->compress=false; |
|
226 | -} |
|
227 | + if(function_exists('gzcompress')) { |
|
228 | + $this->compress=$compress; |
|
229 | + } else { |
|
230 | + $this->compress=false; |
|
231 | + } |
|
232 | + } |
|
227 | 233 | |
228 | 234 | function SetTitle($title, $isUTF8=false) |
229 | 235 | { |
230 | 236 | //Title of document |
231 | - if($isUTF8) |
|
232 | - $title=$this->_UTF8toUTF16($title); |
|
237 | + if($isUTF8) { |
|
238 | + $title=$this->_UTF8toUTF16($title); |
|
239 | + } |
|
233 | 240 | $this->title=$title; |
234 | 241 | } |
235 | 242 | |
236 | 243 | function SetSubject($subject, $isUTF8=false) |
237 | 244 | { |
238 | 245 | //Subject of document |
239 | - if($isUTF8) |
|
240 | - $subject=$this->_UTF8toUTF16($subject); |
|
246 | + if($isUTF8) { |
|
247 | + $subject=$this->_UTF8toUTF16($subject); |
|
248 | + } |
|
241 | 249 | $this->subject=$subject; |
242 | 250 | } |
243 | 251 | |
244 | 252 | function SetAuthor($author, $isUTF8=false) |
245 | 253 | { |
246 | 254 | //Author of document |
247 | - if($isUTF8) |
|
248 | - $author=$this->_UTF8toUTF16($author); |
|
255 | + if($isUTF8) { |
|
256 | + $author=$this->_UTF8toUTF16($author); |
|
257 | + } |
|
249 | 258 | $this->author=$author; |
250 | 259 | } |
251 | 260 | |
252 | 261 | function SetKeywords($keywords, $isUTF8=false) |
253 | 262 | { |
254 | 263 | //Keywords of document |
255 | - if($isUTF8) |
|
256 | - $keywords=$this->_UTF8toUTF16($keywords); |
|
264 | + if($isUTF8) { |
|
265 | + $keywords=$this->_UTF8toUTF16($keywords); |
|
266 | + } |
|
257 | 267 | $this->keywords=$keywords; |
258 | 268 | } |
259 | 269 | |
260 | 270 | function SetCreator($creator, $isUTF8=false) |
261 | 271 | { |
262 | 272 | //Creator of document |
263 | - if($isUTF8) |
|
264 | - $creator=$this->_UTF8toUTF16($creator); |
|
273 | + if($isUTF8) { |
|
274 | + $creator=$this->_UTF8toUTF16($creator); |
|
275 | + } |
|
265 | 276 | $this->creator=$creator; |
266 | 277 | } |
267 | 278 | |
@@ -286,10 +297,12 @@ discard block |
||
286 | 297 | function Close() |
287 | 298 | { |
288 | 299 | //Terminate document |
289 | - if($this->state==3) |
|
290 | - return; |
|
291 | - if($this->page==0) |
|
292 | - $this->AddPage(); |
|
300 | + if($this->state==3) { |
|
301 | + return; |
|
302 | + } |
|
303 | + if($this->page==0) { |
|
304 | + $this->AddPage(); |
|
305 | + } |
|
293 | 306 | //Page footer |
294 | 307 | $this->InFooter=true; |
295 | 308 | $this->Footer(); |
@@ -303,8 +316,9 @@ discard block |
||
303 | 316 | function AddPage($orientation='', $format='') |
304 | 317 | { |
305 | 318 | //Start a new page |
306 | - if($this->state==0) |
|
307 | - $this->Open(); |
|
319 | + if($this->state==0) { |
|
320 | + $this->Open(); |
|
321 | + } |
|
308 | 322 | $family=$this->FontFamily; |
309 | 323 | $style=$this->FontStyle.($this->underline ? 'U' : ''); |
310 | 324 | $size=$this->FontSizePt; |
@@ -330,15 +344,18 @@ discard block |
||
330 | 344 | $this->LineWidth=$lw; |
331 | 345 | $this->_out(sprintf('%.2F w',$lw*$this->k)); |
332 | 346 | //Set font |
333 | - if($family) |
|
334 | - $this->SetFont($family,$style,$size); |
|
347 | + if($family) { |
|
348 | + $this->SetFont($family,$style,$size); |
|
349 | + } |
|
335 | 350 | //Set colors |
336 | 351 | $this->DrawColor=$dc; |
337 | - if($dc!='0 G') |
|
338 | - $this->_out($dc); |
|
352 | + if($dc!='0 G') { |
|
353 | + $this->_out($dc); |
|
354 | + } |
|
339 | 355 | $this->FillColor=$fc; |
340 | - if($fc!='0 g') |
|
341 | - $this->_out($fc); |
|
356 | + if($fc!='0 g') { |
|
357 | + $this->_out($fc); |
|
358 | + } |
|
342 | 359 | $this->TextColor=$tc; |
343 | 360 | $this->ColorFlag=$cf; |
344 | 361 | //Page header |
@@ -352,8 +369,9 @@ discard block |
||
352 | 369 | $this->_out(sprintf('%.2F w',$lw*$this->k)); |
353 | 370 | } |
354 | 371 | //Restore font |
355 | - if($family) |
|
356 | - $this->SetFont($family,$style,$size); |
|
372 | + if($family) { |
|
373 | + $this->SetFont($family,$style,$size); |
|
374 | + } |
|
357 | 375 | //Restore colors |
358 | 376 | if($this->DrawColor!=$dc) |
359 | 377 | { |
@@ -388,33 +406,38 @@ discard block |
||
388 | 406 | function SetDrawColor($r, $g=null, $b=null) |
389 | 407 | { |
390 | 408 | //Set color for all stroking operations |
391 | - if(($r==0 && $g==0 && $b==0) || $g===null) |
|
392 | - $this->DrawColor=sprintf('%.3F G',$r/255); |
|
393 | - else |
|
394 | - $this->DrawColor=sprintf('%.3F %.3F %.3F RG',$r/255,$g/255,$b/255); |
|
395 | - if($this->page>0) |
|
396 | - $this->_out($this->DrawColor); |
|
397 | -} |
|
409 | + if(($r==0 && $g==0 && $b==0) || $g===null) { |
|
410 | + $this->DrawColor=sprintf('%.3F G',$r/255); |
|
411 | + } else { |
|
412 | + $this->DrawColor=sprintf('%.3F %.3F %.3F RG',$r/255,$g/255,$b/255); |
|
413 | + } |
|
414 | + if($this->page>0) { |
|
415 | + $this->_out($this->DrawColor); |
|
416 | + } |
|
417 | + } |
|
398 | 418 | |
399 | 419 | function SetFillColor($r, $g=null, $b=null) |
400 | 420 | { |
401 | 421 | //Set color for all filling operations |
402 | - if(($r==0 && $g==0 && $b==0) || $g===null) |
|
403 | - $this->FillColor=sprintf('%.3F g',$r/255); |
|
404 | - else |
|
405 | - $this->FillColor=sprintf('%.3F %.3F %.3F rg',$r/255,$g/255,$b/255); |
|
422 | + if(($r==0 && $g==0 && $b==0) || $g===null) { |
|
423 | + $this->FillColor=sprintf('%.3F g',$r/255); |
|
424 | + } else { |
|
425 | + $this->FillColor=sprintf('%.3F %.3F %.3F rg',$r/255,$g/255,$b/255); |
|
426 | + } |
|
406 | 427 | $this->ColorFlag=($this->FillColor!=$this->TextColor); |
407 | - if($this->page>0) |
|
408 | - $this->_out($this->FillColor); |
|
409 | -} |
|
428 | + if($this->page>0) { |
|
429 | + $this->_out($this->FillColor); |
|
430 | + } |
|
431 | + } |
|
410 | 432 | |
411 | 433 | function SetTextColor($r, $g=null, $b=null) |
412 | 434 | { |
413 | 435 | //Set color for text |
414 | - if(($r==0 && $g==0 && $b==0) || $g===null) |
|
415 | - $this->TextColor=sprintf('%.3F g',$r/255); |
|
416 | - else |
|
417 | - $this->TextColor=sprintf('%.3F %.3F %.3F rg',$r/255,$g/255,$b/255); |
|
436 | + if(($r==0 && $g==0 && $b==0) || $g===null) { |
|
437 | + $this->TextColor=sprintf('%.3F g',$r/255); |
|
438 | + } else { |
|
439 | + $this->TextColor=sprintf('%.3F %.3F %.3F rg',$r/255,$g/255,$b/255); |
|
440 | + } |
|
418 | 441 | $this->ColorFlag=($this->FillColor!=$this->TextColor); |
419 | 442 | } |
420 | 443 | |
@@ -425,8 +448,9 @@ discard block |
||
425 | 448 | $cw=&$this->CurrentFont['cw']; |
426 | 449 | $w=0; |
427 | 450 | $l=strlen($s); |
428 | - for($i=0;$i<$l;$i++) |
|
429 | - $w+=$cw[$s[$i]]; |
|
451 | + for($i=0;$i<$l;$i++) { |
|
452 | + $w+=$cw[$s[$i]]; |
|
453 | + } |
|
430 | 454 | return $w*$this->FontSize/1000; |
431 | 455 | } |
432 | 456 | |
@@ -434,9 +458,10 @@ discard block |
||
434 | 458 | { |
435 | 459 | //Set line width |
436 | 460 | $this->LineWidth=$width; |
437 | - if($this->page>0) |
|
438 | - $this->_out(sprintf('%.2F w',$width*$this->k)); |
|
439 | -} |
|
461 | + if($this->page>0) { |
|
462 | + $this->_out(sprintf('%.2F w',$width*$this->k)); |
|
463 | + } |
|
464 | + } |
|
440 | 465 | |
441 | 466 | function Line($x1, $y1, $x2, $y2) |
442 | 467 | { |
@@ -447,12 +472,13 @@ discard block |
||
447 | 472 | function Rect($x, $y, $w, $h, $style='') |
448 | 473 | { |
449 | 474 | //Draw a rectangle |
450 | - if($style=='F') |
|
451 | - $op='f'; |
|
452 | - elseif($style=='FD' || $style=='DF') |
|
453 | - $op='B'; |
|
454 | - else |
|
455 | - $op='S'; |
|
475 | + if($style=='F') { |
|
476 | + $op='f'; |
|
477 | + } elseif($style=='FD' || $style=='DF') { |
|
478 | + $op='B'; |
|
479 | + } else { |
|
480 | + $op='S'; |
|
481 | + } |
|
456 | 482 | $this->_out(sprintf('%.2F %.2F %.2F %.2F re %s',$x*$this->k,($this->h-$y)*$this->k,$w*$this->k,-$h*$this->k,$op)); |
457 | 483 | } |
458 | 484 | |
@@ -460,19 +486,24 @@ discard block |
||
460 | 486 | { |
461 | 487 | //Add a TrueType or Type1 font |
462 | 488 | $family=strtolower($family); |
463 | - if($file=='') |
|
464 | - $file=str_replace(' ','',$family).strtolower($style).'.php'; |
|
465 | - if($family=='arial') |
|
466 | - $family='helvetica'; |
|
489 | + if($file=='') { |
|
490 | + $file=str_replace(' ','',$family).strtolower($style).'.php'; |
|
491 | + } |
|
492 | + if($family=='arial') { |
|
493 | + $family='helvetica'; |
|
494 | + } |
|
467 | 495 | $style=strtoupper($style); |
468 | - if($style=='IB') |
|
469 | - $style='BI'; |
|
496 | + if($style=='IB') { |
|
497 | + $style='BI'; |
|
498 | + } |
|
470 | 499 | $fontkey=$family.$style; |
471 | - if(isset($this->fonts[$fontkey])) |
|
472 | - return; |
|
500 | + if(isset($this->fonts[$fontkey])) { |
|
501 | + return; |
|
502 | + } |
|
473 | 503 | include($this->_getfontpath().$file); |
474 | - if(!isset($name)) |
|
475 | - $this->Error('Could not include font definition file'); |
|
504 | + if(!isset($name)) { |
|
505 | + $this->Error('Could not include font definition file'); |
|
506 | + } |
|
476 | 507 | $i=count($this->fonts)+1; |
477 | 508 | $this->fonts[$fontkey]=array('i'=>$i, 'type'=>$type, 'name'=>$name, 'desc'=>$desc, 'up'=>$up, 'ut'=>$ut, 'cw'=>$cw, 'enc'=>$enc, 'file'=>$file); |
478 | 509 | if($diff) |
@@ -497,10 +528,11 @@ discard block |
||
497 | 528 | } |
498 | 529 | if($file) |
499 | 530 | { |
500 | - if($type=='TrueType') |
|
501 | - $this->FontFiles[$file]=array('length1'=>$originalsize); |
|
502 | - else |
|
503 | - $this->FontFiles[$file]=array('length1'=>$size1, 'length2'=>$size2); |
|
531 | + if($type=='TrueType') { |
|
532 | + $this->FontFiles[$file]=array('length1'=>$originalsize); |
|
533 | + } else { |
|
534 | + $this->FontFiles[$file]=array('length1'=>$size1, 'length2'=>$size2); |
|
535 | + } |
|
504 | 536 | } |
505 | 537 | } |
506 | 538 | |
@@ -510,27 +542,32 @@ discard block |
||
510 | 542 | global $fpdf_charwidths; |
511 | 543 | |
512 | 544 | $family=strtolower($family); |
513 | - if($family=='') |
|
514 | - $family=$this->FontFamily; |
|
515 | - if($family=='arial') |
|
516 | - $family='helvetica'; |
|
517 | - elseif($family=='symbol' || $family=='zapfdingbats') |
|
518 | - $style=''; |
|
545 | + if($family=='') { |
|
546 | + $family=$this->FontFamily; |
|
547 | + } |
|
548 | + if($family=='arial') { |
|
549 | + $family='helvetica'; |
|
550 | + } elseif($family=='symbol' || $family=='zapfdingbats') { |
|
551 | + $style=''; |
|
552 | + } |
|
519 | 553 | $style=strtoupper($style); |
520 | 554 | if(strpos($style,'U')!==false) |
521 | 555 | { |
522 | 556 | $this->underline=true; |
523 | 557 | $style=str_replace('U','',$style); |
558 | + } else { |
|
559 | + $this->underline=false; |
|
560 | + } |
|
561 | + if($style=='IB') { |
|
562 | + $style='BI'; |
|
563 | + } |
|
564 | + if($size==0) { |
|
565 | + $size=$this->FontSizePt; |
|
524 | 566 | } |
525 | - else |
|
526 | - $this->underline=false; |
|
527 | - if($style=='IB') |
|
528 | - $style='BI'; |
|
529 | - if($size==0) |
|
530 | - $size=$this->FontSizePt; |
|
531 | 567 | //Test if font is already selected |
532 | - if($this->FontFamily==$family && $this->FontStyle==$style && $this->FontSizePt==$size) |
|
533 | - return; |
|
568 | + if($this->FontFamily==$family && $this->FontStyle==$style && $this->FontSizePt==$size) { |
|
569 | + return; |
|
570 | + } |
|
534 | 571 | //Test if used for the first time |
535 | 572 | $fontkey=$family.$style; |
536 | 573 | if(!isset($this->fonts[$fontkey])) |
@@ -542,19 +579,21 @@ discard block |
||
542 | 579 | { |
543 | 580 | //Load metric file |
544 | 581 | $file=$family; |
545 | - if($family=='times' || $family=='helvetica') |
|
546 | - $file.=strtolower($style); |
|
582 | + if($family=='times' || $family=='helvetica') { |
|
583 | + $file.=strtolower($style); |
|
584 | + } |
|
547 | 585 | include($this->_getfontpath().$file.'.php'); |
548 | - if(!isset($fpdf_charwidths[$fontkey])) |
|
549 | - $this->Error('Could not include font metric file'); |
|
586 | + if(!isset($fpdf_charwidths[$fontkey])) { |
|
587 | + $this->Error('Could not include font metric file'); |
|
588 | + } |
|
550 | 589 | } |
551 | 590 | $i=count($this->fonts)+1; |
552 | 591 | $name=$this->CoreFonts[$fontkey]; |
553 | 592 | $cw=$fpdf_charwidths[$fontkey]; |
554 | 593 | $this->fonts[$fontkey]=array('i'=>$i, 'type'=>'core', 'name'=>$name, 'up'=>-100, 'ut'=>50, 'cw'=>$cw); |
594 | + } else { |
|
595 | + $this->Error('Undefined font: '.$family.' '.$style); |
|
555 | 596 | } |
556 | - else |
|
557 | - $this->Error('Undefined font: '.$family.' '.$style); |
|
558 | 597 | } |
559 | 598 | //Select it |
560 | 599 | $this->FontFamily=$family; |
@@ -562,20 +601,23 @@ discard block |
||
562 | 601 | $this->FontSizePt=$size; |
563 | 602 | $this->FontSize=$size/$this->k; |
564 | 603 | $this->CurrentFont=&$this->fonts[$fontkey]; |
565 | - if($this->page>0) |
|
566 | - $this->_out(sprintf('BT /F%d %.2F Tf ET',$this->CurrentFont['i'],$this->FontSizePt)); |
|
567 | -} |
|
604 | + if($this->page>0) { |
|
605 | + $this->_out(sprintf('BT /F%d %.2F Tf ET',$this->CurrentFont['i'],$this->FontSizePt)); |
|
606 | + } |
|
607 | + } |
|
568 | 608 | |
569 | 609 | function SetFontSize($size) |
570 | 610 | { |
571 | 611 | //Set font size in points |
572 | - if($this->FontSizePt==$size) |
|
573 | - return; |
|
612 | + if($this->FontSizePt==$size) { |
|
613 | + return; |
|
614 | + } |
|
574 | 615 | $this->FontSizePt=$size; |
575 | 616 | $this->FontSize=$size/$this->k; |
576 | - if($this->page>0) |
|
577 | - $this->_out(sprintf('BT /F%d %.2F Tf ET',$this->CurrentFont['i'],$this->FontSizePt)); |
|
578 | -} |
|
617 | + if($this->page>0) { |
|
618 | + $this->_out(sprintf('BT /F%d %.2F Tf ET',$this->CurrentFont['i'],$this->FontSizePt)); |
|
619 | + } |
|
620 | + } |
|
579 | 621 | |
580 | 622 | function AddLink() |
581 | 623 | { |
@@ -588,10 +630,12 @@ discard block |
||
588 | 630 | function SetLink($link, $y=0, $page=-1) |
589 | 631 | { |
590 | 632 | //Set destination of internal link |
591 | - if($y==-1) |
|
592 | - $y=$this->y; |
|
593 | - if($page==-1) |
|
594 | - $page=$this->page; |
|
633 | + if($y==-1) { |
|
634 | + $y=$this->y; |
|
635 | + } |
|
636 | + if($page==-1) { |
|
637 | + $page=$this->page; |
|
638 | + } |
|
595 | 639 | $this->links[$link]=array($page, $y); |
596 | 640 | } |
597 | 641 | |
@@ -605,10 +649,12 @@ discard block |
||
605 | 649 | { |
606 | 650 | //Output a string |
607 | 651 | $s=sprintf('BT %.2F %.2F Td (%s) Tj ET',$x*$this->k,($this->h-$y)*$this->k,$this->_escape($txt)); |
608 | - if($this->underline && $txt!='') |
|
609 | - $s.=' '.$this->_dounderline($x,$y,$txt); |
|
610 | - if($this->ColorFlag) |
|
611 | - $s='q '.$this->TextColor.' '.$s.' Q'; |
|
652 | + if($this->underline && $txt!='') { |
|
653 | + $s.=' '.$this->_dounderline($x,$y,$txt); |
|
654 | + } |
|
655 | + if($this->ColorFlag) { |
|
656 | + $s='q '.$this->TextColor.' '.$s.' Q'; |
|
657 | + } |
|
612 | 658 | $this->_out($s); |
613 | 659 | } |
614 | 660 | |
@@ -640,74 +686,89 @@ discard block |
||
640 | 686 | $this->_out(sprintf('%.3F Tw',$ws*$k)); |
641 | 687 | } |
642 | 688 | } |
643 | - if($w==0) |
|
644 | - $w=$this->w-$this->rMargin-$this->x; |
|
689 | + if($w==0) { |
|
690 | + $w=$this->w-$this->rMargin-$this->x; |
|
691 | + } |
|
645 | 692 | $s=''; |
646 | 693 | if($fill || $border==1) |
647 | 694 | { |
648 | - if($fill) |
|
649 | - $op=($border==1) ? 'B' : 'f'; |
|
650 | - else |
|
651 | - $op='S'; |
|
695 | + if($fill) { |
|
696 | + $op=($border==1) ? 'B' : 'f'; |
|
697 | + } else { |
|
698 | + $op='S'; |
|
699 | + } |
|
652 | 700 | $s=sprintf('%.2F %.2F %.2F %.2F re %s ',$this->x*$k,($this->h-$this->y)*$k,$w*$k,-$h*$k,$op); |
653 | 701 | } |
654 | 702 | if(is_string($border)) |
655 | 703 | { |
656 | 704 | $x=$this->x; |
657 | 705 | $y=$this->y; |
658 | - if(strpos($border,'L')!==false) |
|
659 | - $s.=sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-$y)*$k,$x*$k,($this->h-($y+$h))*$k); |
|
660 | - if(strpos($border,'T')!==false) |
|
661 | - $s.=sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-$y)*$k); |
|
662 | - if(strpos($border,'R')!==false) |
|
663 | - $s.=sprintf('%.2F %.2F m %.2F %.2F l S ',($x+$w)*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-($y+$h))*$k); |
|
664 | - if(strpos($border,'B')!==false) |
|
665 | - $s.=sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-($y+$h))*$k,($x+$w)*$k,($this->h-($y+$h))*$k); |
|
706 | + if(strpos($border,'L')!==false) { |
|
707 | + $s.=sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-$y)*$k,$x*$k,($this->h-($y+$h))*$k); |
|
708 | + } |
|
709 | + if(strpos($border,'T')!==false) { |
|
710 | + $s.=sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-$y)*$k); |
|
711 | + } |
|
712 | + if(strpos($border,'R')!==false) { |
|
713 | + $s.=sprintf('%.2F %.2F m %.2F %.2F l S ',($x+$w)*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-($y+$h))*$k); |
|
714 | + } |
|
715 | + if(strpos($border,'B')!==false) { |
|
716 | + $s.=sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-($y+$h))*$k,($x+$w)*$k,($this->h-($y+$h))*$k); |
|
717 | + } |
|
666 | 718 | } |
667 | 719 | if($txt!=='') |
668 | 720 | { |
669 | - if($align=='R') |
|
670 | - $dx=$w-$this->cMargin-$this->GetStringWidth($txt); |
|
671 | - elseif($align=='C') |
|
672 | - $dx=($w-$this->GetStringWidth($txt))/2; |
|
673 | - else |
|
674 | - $dx=$this->cMargin; |
|
675 | - if($this->ColorFlag) |
|
676 | - $s.='q '.$this->TextColor.' '; |
|
721 | + if($align=='R') { |
|
722 | + $dx=$w-$this->cMargin-$this->GetStringWidth($txt); |
|
723 | + } elseif($align=='C') { |
|
724 | + $dx=($w-$this->GetStringWidth($txt))/2; |
|
725 | + } else { |
|
726 | + $dx=$this->cMargin; |
|
727 | + } |
|
728 | + if($this->ColorFlag) { |
|
729 | + $s.='q '.$this->TextColor.' '; |
|
730 | + } |
|
677 | 731 | $txt2=str_replace(')','\\)',str_replace('(','\\(',str_replace('\\','\\\\',$txt))); |
678 | 732 | $s.=sprintf('BT %.2F %.2F Td (%s) Tj ET',($this->x+$dx)*$k,($this->h-($this->y+.5*$h+.3*$this->FontSize))*$k,$txt2); |
679 | - if($this->underline) |
|
680 | - $s.=' '.$this->_dounderline($this->x+$dx,$this->y+.5*$h+.3*$this->FontSize,$txt); |
|
681 | - if($this->ColorFlag) |
|
682 | - $s.=' Q'; |
|
683 | - if($link) |
|
684 | - $this->Link($this->x+$dx,$this->y+.5*$h-.5*$this->FontSize,$this->GetStringWidth($txt),$this->FontSize,$link); |
|
685 | - } |
|
686 | - if($s) |
|
687 | - $this->_out($s); |
|
733 | + if($this->underline) { |
|
734 | + $s.=' '.$this->_dounderline($this->x+$dx,$this->y+.5*$h+.3*$this->FontSize,$txt); |
|
735 | + } |
|
736 | + if($this->ColorFlag) { |
|
737 | + $s.=' Q'; |
|
738 | + } |
|
739 | + if($link) { |
|
740 | + $this->Link($this->x+$dx,$this->y+.5*$h-.5*$this->FontSize,$this->GetStringWidth($txt),$this->FontSize,$link); |
|
741 | + } |
|
742 | + } |
|
743 | + if($s) { |
|
744 | + $this->_out($s); |
|
745 | + } |
|
688 | 746 | $this->lasth=$h; |
689 | 747 | if($ln>0) |
690 | 748 | { |
691 | 749 | //Go to next line |
692 | 750 | $this->y+=$h; |
693 | - if($ln==1) |
|
694 | - $this->x=$this->lMargin; |
|
751 | + if($ln==1) { |
|
752 | + $this->x=$this->lMargin; |
|
753 | + } |
|
754 | + } else { |
|
755 | + $this->x+=$w; |
|
756 | + } |
|
695 | 757 | } |
696 | - else |
|
697 | - $this->x+=$w; |
|
698 | -} |
|
699 | 758 | |
700 | 759 | function MultiCell($w, $h, $txt, $border=0, $align='J', $fill=false) |
701 | 760 | { |
702 | 761 | //Output text with automatic or explicit line breaks |
703 | 762 | $cw=&$this->CurrentFont['cw']; |
704 | - if($w==0) |
|
705 | - $w=$this->w-$this->rMargin-$this->x; |
|
763 | + if($w==0) { |
|
764 | + $w=$this->w-$this->rMargin-$this->x; |
|
765 | + } |
|
706 | 766 | $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; |
707 | 767 | $s=str_replace("\r",'',$txt); |
708 | 768 | $nb=strlen($s); |
709 | - if($nb>0 && $s[$nb-1]=="\n") |
|
710 | - $nb--; |
|
769 | + if($nb>0 && $s[$nb-1]=="\n") { |
|
770 | + $nb--; |
|
771 | + } |
|
711 | 772 | $b=0; |
712 | 773 | if($border) |
713 | 774 | { |
@@ -716,14 +777,15 @@ discard block |
||
716 | 777 | $border='LTRB'; |
717 | 778 | $b='LRT'; |
718 | 779 | $b2='LR'; |
719 | - } |
|
720 | - else |
|
780 | + } else |
|
721 | 781 | { |
722 | 782 | $b2=''; |
723 | - if(strpos($border,'L')!==false) |
|
724 | - $b2.='L'; |
|
725 | - if(strpos($border,'R')!==false) |
|
726 | - $b2.='R'; |
|
783 | + if(strpos($border,'L')!==false) { |
|
784 | + $b2.='L'; |
|
785 | + } |
|
786 | + if(strpos($border,'R')!==false) { |
|
787 | + $b2.='R'; |
|
788 | + } |
|
727 | 789 | $b=(strpos($border,'T')!==false) ? $b2.'T' : $b2; |
728 | 790 | } |
729 | 791 | } |
@@ -752,8 +814,9 @@ discard block |
||
752 | 814 | $l=0; |
753 | 815 | $ns=0; |
754 | 816 | $nl++; |
755 | - if($border && $nl==2) |
|
756 | - $b=$b2; |
|
817 | + if($border && $nl==2) { |
|
818 | + $b=$b2; |
|
819 | + } |
|
757 | 820 | continue; |
758 | 821 | } |
759 | 822 | if($c==' ') |
@@ -768,16 +831,16 @@ discard block |
||
768 | 831 | //Automatic line break |
769 | 832 | if($sep==-1) |
770 | 833 | { |
771 | - if($i==$j) |
|
772 | - $i++; |
|
834 | + if($i==$j) { |
|
835 | + $i++; |
|
836 | + } |
|
773 | 837 | if($this->ws>0) |
774 | 838 | { |
775 | 839 | $this->ws=0; |
776 | 840 | $this->_out('0 Tw'); |
777 | 841 | } |
778 | 842 | $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill); |
779 | - } |
|
780 | - else |
|
843 | + } else |
|
781 | 844 | { |
782 | 845 | if($align=='J') |
783 | 846 | { |
@@ -792,11 +855,12 @@ discard block |
||
792 | 855 | $l=0; |
793 | 856 | $ns=0; |
794 | 857 | $nl++; |
795 | - if($border && $nl==2) |
|
796 | - $b=$b2; |
|
858 | + if($border && $nl==2) { |
|
859 | + $b=$b2; |
|
860 | + } |
|
861 | + } else { |
|
862 | + $i++; |
|
797 | 863 | } |
798 | - else |
|
799 | - $i++; |
|
800 | 864 | } |
801 | 865 | //Last chunk |
802 | 866 | if($this->ws>0) |
@@ -804,8 +868,9 @@ discard block |
||
804 | 868 | $this->ws=0; |
805 | 869 | $this->_out('0 Tw'); |
806 | 870 | } |
807 | - if($border && strpos($border,'B')!==false) |
|
808 | - $b.='B'; |
|
871 | + if($border && strpos($border,'B')!==false) { |
|
872 | + $b.='B'; |
|
873 | + } |
|
809 | 874 | $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill); |
810 | 875 | $this->x=$this->lMargin; |
811 | 876 | } |
@@ -844,8 +909,9 @@ discard block |
||
844 | 909 | $nl++; |
845 | 910 | continue; |
846 | 911 | } |
847 | - if($c==' ') |
|
848 | - $sep=$i; |
|
912 | + if($c==' ') { |
|
913 | + $sep=$i; |
|
914 | + } |
|
849 | 915 | $l+=$cw[$c]; |
850 | 916 | if($l>$wmax) |
851 | 917 | { |
@@ -863,11 +929,11 @@ discard block |
||
863 | 929 | $nl++; |
864 | 930 | continue; |
865 | 931 | } |
866 | - if($i==$j) |
|
867 | - $i++; |
|
932 | + if($i==$j) { |
|
933 | + $i++; |
|
934 | + } |
|
868 | 935 | $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',0,$link); |
869 | - } |
|
870 | - else |
|
936 | + } else |
|
871 | 937 | { |
872 | 938 | $this->Cell($w,$h,substr($s,$j,$sep-$j),0,2,'',0,$link); |
873 | 939 | $i=$sep+1; |
@@ -882,24 +948,26 @@ discard block |
||
882 | 948 | $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; |
883 | 949 | } |
884 | 950 | $nl++; |
951 | + } else { |
|
952 | + $i++; |
|
885 | 953 | } |
886 | - else |
|
887 | - $i++; |
|
888 | 954 | } |
889 | 955 | //Last chunk |
890 | - if($i!=$j) |
|
891 | - $this->Cell($l/1000*$this->FontSize,$h,substr($s,$j),0,0,'',0,$link); |
|
892 | -} |
|
956 | + if($i!=$j) { |
|
957 | + $this->Cell($l/1000*$this->FontSize,$h,substr($s,$j),0,0,'',0,$link); |
|
958 | + } |
|
959 | + } |
|
893 | 960 | |
894 | 961 | function Ln($h=null) |
895 | 962 | { |
896 | 963 | //Line feed; default value is last cell height |
897 | 964 | $this->x=$this->lMargin; |
898 | - if($h===null) |
|
899 | - $this->y+=$this->lasth; |
|
900 | - else |
|
901 | - $this->y+=$h; |
|
902 | -} |
|
965 | + if($h===null) { |
|
966 | + $this->y+=$this->lasth; |
|
967 | + } else { |
|
968 | + $this->y+=$h; |
|
969 | + } |
|
970 | + } |
|
903 | 971 | |
904 | 972 | function Image($file, $x=null, $y=null, $w=0, $h=0, $type='', $link='') |
905 | 973 | { |
@@ -910,33 +978,36 @@ discard block |
||
910 | 978 | if($type=='') |
911 | 979 | { |
912 | 980 | $pos=strrpos($file,'.'); |
913 | - if(!$pos) |
|
914 | - $this->Error('Image file has no extension and no type was specified: '.$file); |
|
981 | + if(!$pos) { |
|
982 | + $this->Error('Image file has no extension and no type was specified: '.$file); |
|
983 | + } |
|
915 | 984 | $type=substr($file,$pos+1); |
916 | 985 | } |
917 | 986 | $type=strtolower($type); |
918 | - if($type=='jpeg') |
|
919 | - $type='jpg'; |
|
987 | + if($type=='jpeg') { |
|
988 | + $type='jpg'; |
|
989 | + } |
|
920 | 990 | $mtd='_parse'.$type; |
921 | - if(!method_exists($this,$mtd)) |
|
922 | - $this->Error('Unsupported image type: '.$type); |
|
991 | + if(!method_exists($this,$mtd)) { |
|
992 | + $this->Error('Unsupported image type: '.$type); |
|
993 | + } |
|
923 | 994 | $info=$this->$mtd($file); |
924 | 995 | $info['i']=count($this->images)+1; |
925 | 996 | $this->images[$file]=$info; |
997 | + } else { |
|
998 | + $info=$this->images[$file]; |
|
926 | 999 | } |
927 | - else |
|
928 | - $info=$this->images[$file]; |
|
929 | 1000 | //Automatic width and height calculation if needed |
930 | 1001 | if($w==0 && $h==0) |
931 | 1002 | { |
932 | 1003 | //Put image at 72 dpi |
933 | 1004 | $w=$info['w']/$this->k; |
934 | 1005 | $h=$info['h']/$this->k; |
1006 | + } elseif($w==0) { |
|
1007 | + $w=$h*$info['w']/$info['h']; |
|
1008 | + } elseif($h==0) { |
|
1009 | + $h=$w*$info['h']/$info['w']; |
|
935 | 1010 | } |
936 | - elseif($w==0) |
|
937 | - $w=$h*$info['w']/$info['h']; |
|
938 | - elseif($h==0) |
|
939 | - $h=$w*$info['h']/$info['w']; |
|
940 | 1011 | //Flowing mode |
941 | 1012 | if($y===null) |
942 | 1013 | { |
@@ -950,12 +1021,14 @@ discard block |
||
950 | 1021 | $y=$this->y; |
951 | 1022 | $this->y+=$h; |
952 | 1023 | } |
953 | - if($x===null) |
|
954 | - $x=$this->x; |
|
1024 | + if($x===null) { |
|
1025 | + $x=$this->x; |
|
1026 | + } |
|
955 | 1027 | $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'])); |
956 | - if($link) |
|
957 | - $this->Link($x,$y,$w,$h,$link); |
|
958 | -} |
|
1028 | + if($link) { |
|
1029 | + $this->Link($x,$y,$w,$h,$link); |
|
1030 | + } |
|
1031 | + } |
|
959 | 1032 | |
960 | 1033 | function GetX() |
961 | 1034 | { |
@@ -966,11 +1039,12 @@ discard block |
||
966 | 1039 | function SetX($x) |
967 | 1040 | { |
968 | 1041 | //Set x position |
969 | - if($x>=0) |
|
970 | - $this->x=$x; |
|
971 | - else |
|
972 | - $this->x=$this->w+$x; |
|
973 | -} |
|
1042 | + if($x>=0) { |
|
1043 | + $this->x=$x; |
|
1044 | + } else { |
|
1045 | + $this->x=$this->w+$x; |
|
1046 | + } |
|
1047 | + } |
|
974 | 1048 | |
975 | 1049 | function GetY() |
976 | 1050 | { |
@@ -982,11 +1056,12 @@ discard block |
||
982 | 1056 | { |
983 | 1057 | //Set y position and reset x |
984 | 1058 | $this->x=$this->lMargin; |
985 | - if($y>=0) |
|
986 | - $this->y=$y; |
|
987 | - else |
|
988 | - $this->y=$this->h+$y; |
|
989 | -} |
|
1059 | + if($y>=0) { |
|
1060 | + $this->y=$y; |
|
1061 | + } else { |
|
1062 | + $this->y=$this->h+$y; |
|
1063 | + } |
|
1064 | + } |
|
990 | 1065 | |
991 | 1066 | function SetXY($x, $y) |
992 | 1067 | { |
@@ -998,8 +1073,9 @@ discard block |
||
998 | 1073 | function Output($name='', $dest='') |
999 | 1074 | { |
1000 | 1075 | //Output PDF to some destination |
1001 | - if($this->state<3) |
|
1002 | - $this->Close(); |
|
1076 | + if($this->state<3) { |
|
1077 | + $this->Close(); |
|
1078 | + } |
|
1003 | 1079 | $dest=strtoupper($dest); |
1004 | 1080 | if($dest=='') |
1005 | 1081 | { |
@@ -1007,22 +1083,24 @@ discard block |
||
1007 | 1083 | { |
1008 | 1084 | $name='doc.pdf'; |
1009 | 1085 | $dest='I'; |
1086 | + } else { |
|
1087 | + $dest='F'; |
|
1010 | 1088 | } |
1011 | - else |
|
1012 | - $dest='F'; |
|
1013 | 1089 | } |
1014 | 1090 | switch($dest) |
1015 | 1091 | { |
1016 | 1092 | case 'I': |
1017 | 1093 | //Send to standard output |
1018 | - if(ob_get_length()) |
|
1019 | - $this->Error('Some data has already been output, can\'t send PDF file'); |
|
1094 | + if(ob_get_length()) { |
|
1095 | + $this->Error('Some data has already been output, can\'t send PDF file'); |
|
1096 | + } |
|
1020 | 1097 | if(php_sapi_name()!='cli') |
1021 | 1098 | { |
1022 | 1099 | //We send to a browser |
1023 | 1100 | header('Content-Type: application/pdf'); |
1024 | - if(headers_sent()) |
|
1025 | - $this->Error('Some data has already been output, can\'t send PDF file'); |
|
1101 | + if(headers_sent()) { |
|
1102 | + $this->Error('Some data has already been output, can\'t send PDF file'); |
|
1103 | + } |
|
1026 | 1104 | header('Content-Length: '.strlen($this->buffer)); |
1027 | 1105 | header('Content-Disposition: inline; filename="'.$name.'"'); |
1028 | 1106 | header('Cache-Control: private, max-age=0, must-revalidate'); |
@@ -1033,11 +1111,13 @@ discard block |
||
1033 | 1111 | break; |
1034 | 1112 | case 'D': |
1035 | 1113 | //Download file |
1036 | - if(ob_get_length()) |
|
1037 | - $this->Error('Some data has already been output, can\'t send PDF file'); |
|
1114 | + if(ob_get_length()) { |
|
1115 | + $this->Error('Some data has already been output, can\'t send PDF file'); |
|
1116 | + } |
|
1038 | 1117 | header('Content-Type: application/x-download'); |
1039 | - if(headers_sent()) |
|
1040 | - $this->Error('Some data has already been output, can\'t send PDF file'); |
|
1118 | + if(headers_sent()) { |
|
1119 | + $this->Error('Some data has already been output, can\'t send PDF file'); |
|
1120 | + } |
|
1041 | 1121 | header('Content-Length: '.strlen($this->buffer)); |
1042 | 1122 | header('Content-Disposition: attachment; filename="'.$name.'"'); |
1043 | 1123 | header('Cache-Control: private, max-age=0, must-revalidate'); |
@@ -1048,8 +1128,9 @@ discard block |
||
1048 | 1128 | case 'F': |
1049 | 1129 | //Save to local file |
1050 | 1130 | $f=fopen($name,'wb'); |
1051 | - if(!$f) |
|
1052 | - $this->Error('Unable to create output file: '.$name); |
|
1131 | + if(!$f) { |
|
1132 | + $this->Error('Unable to create output file: '.$name); |
|
1133 | + } |
|
1053 | 1134 | fwrite($f,$this->buffer,strlen($this->buffer)); |
1054 | 1135 | fclose($f); |
1055 | 1136 | break; |
@@ -1070,29 +1151,34 @@ discard block |
||
1070 | 1151 | function _dochecks() |
1071 | 1152 | { |
1072 | 1153 | //Check availability of %F |
1073 | - if(sprintf('%.1F',1.0)!='1.0') |
|
1074 | - $this->Error('This version of PHP is not supported'); |
|
1154 | + if(sprintf('%.1F',1.0)!='1.0') { |
|
1155 | + $this->Error('This version of PHP is not supported'); |
|
1156 | + } |
|
1075 | 1157 | //Check mbstring overloading |
1076 | - if(ini_get('mbstring.func_overload') & 2) |
|
1077 | - $this->Error('mbstring overloading must be disabled'); |
|
1158 | + if(ini_get('mbstring.func_overload') & 2) { |
|
1159 | + $this->Error('mbstring overloading must be disabled'); |
|
1160 | + } |
|
1078 | 1161 | //Disable runtime magic quotes |
1079 | - if(get_magic_quotes_runtime()) |
|
1080 | - @set_magic_quotes_runtime(0); |
|
1081 | -} |
|
1162 | + if(get_magic_quotes_runtime()) { |
|
1163 | + @set_magic_quotes_runtime(0); |
|
1164 | + } |
|
1165 | + } |
|
1082 | 1166 | |
1083 | 1167 | function _getpageformat($format) |
1084 | 1168 | { |
1085 | 1169 | $format=strtolower($format); |
1086 | - if(!isset($this->PageFormats[$format])) |
|
1087 | - $this->Error('Unknown page format: '.$format); |
|
1170 | + if(!isset($this->PageFormats[$format])) { |
|
1171 | + $this->Error('Unknown page format: '.$format); |
|
1172 | + } |
|
1088 | 1173 | $a=$this->PageFormats[$format]; |
1089 | 1174 | return array($a[0]/$this->k, $a[1]/$this->k); |
1090 | 1175 | } |
1091 | 1176 | |
1092 | 1177 | function _getfontpath() |
1093 | 1178 | { |
1094 | - if(!defined('FPDF_FONTPATH') && is_dir(dirname(__FILE__).'/font')) |
|
1095 | - define('FPDF_FONTPATH',dirname(__FILE__).'/font/'); |
|
1179 | + if(!defined('FPDF_FONTPATH') && is_dir(dirname(__FILE__).'/font')) { |
|
1180 | + define('FPDF_FONTPATH',dirname(__FILE__).'/font/'); |
|
1181 | + } |
|
1096 | 1182 | return defined('FPDF_FONTPATH') ? FPDF_FONTPATH : ''; |
1097 | 1183 | } |
1098 | 1184 | |
@@ -1105,16 +1191,18 @@ discard block |
||
1105 | 1191 | $this->y=$this->tMargin; |
1106 | 1192 | $this->FontFamily=''; |
1107 | 1193 | //Check page size |
1108 | - if($orientation=='') |
|
1109 | - $orientation=$this->DefOrientation; |
|
1110 | - else |
|
1111 | - $orientation=strtoupper($orientation[0]); |
|
1112 | - if($format=='') |
|
1113 | - $format=$this->DefPageFormat; |
|
1114 | - else |
|
1194 | + if($orientation=='') { |
|
1195 | + $orientation=$this->DefOrientation; |
|
1196 | + } else { |
|
1197 | + $orientation=strtoupper($orientation[0]); |
|
1198 | + } |
|
1199 | + if($format=='') { |
|
1200 | + $format=$this->DefPageFormat; |
|
1201 | + } else |
|
1115 | 1202 | { |
1116 | - if(is_string($format)) |
|
1117 | - $format=$this->_getpageformat($format); |
|
1203 | + if(is_string($format)) { |
|
1204 | + $format=$this->_getpageformat($format); |
|
1205 | + } |
|
1118 | 1206 | } |
1119 | 1207 | if($orientation!=$this->CurOrientation || $format[0]!=$this->CurPageFormat[0] || $format[1]!=$this->CurPageFormat[1]) |
1120 | 1208 | { |
@@ -1123,8 +1211,7 @@ discard block |
||
1123 | 1211 | { |
1124 | 1212 | $this->w=$format[0]; |
1125 | 1213 | $this->h=$format[1]; |
1126 | - } |
|
1127 | - else |
|
1214 | + } else |
|
1128 | 1215 | { |
1129 | 1216 | $this->w=$format[1]; |
1130 | 1217 | $this->h=$format[0]; |
@@ -1135,9 +1222,10 @@ discard block |
||
1135 | 1222 | $this->CurOrientation=$orientation; |
1136 | 1223 | $this->CurPageFormat=$format; |
1137 | 1224 | } |
1138 | - if($orientation!=$this->DefOrientation || $format[0]!=$this->DefPageFormat[0] || $format[1]!=$this->DefPageFormat[1]) |
|
1139 | - $this->PageSizes[$this->page]=array($this->wPt, $this->hPt); |
|
1140 | -} |
|
1225 | + if($orientation!=$this->DefOrientation || $format[0]!=$this->DefPageFormat[0] || $format[1]!=$this->DefPageFormat[1]) { |
|
1226 | + $this->PageSizes[$this->page]=array($this->wPt, $this->hPt); |
|
1227 | + } |
|
1228 | + } |
|
1141 | 1229 | |
1142 | 1230 | function _endpage() |
1143 | 1231 | { |
@@ -1176,15 +1264,13 @@ discard block |
||
1176 | 1264 | $c3=ord($s[$i++]); |
1177 | 1265 | $res.=chr((($c1 & 0x0F)<<4) + (($c2 & 0x3C)>>2)); |
1178 | 1266 | $res.=chr((($c2 & 0x03)<<6) + ($c3 & 0x3F)); |
1179 | - } |
|
1180 | - elseif($c1>=192) |
|
1267 | + } elseif($c1>=192) |
|
1181 | 1268 | { |
1182 | 1269 | //2-byte character |
1183 | 1270 | $c2=ord($s[$i++]); |
1184 | 1271 | $res.=chr(($c1 & 0x1C)>>2); |
1185 | 1272 | $res.=chr((($c1 & 0x03)<<6) + ($c2 & 0x3F)); |
1186 | - } |
|
1187 | - else |
|
1273 | + } else |
|
1188 | 1274 | { |
1189 | 1275 | //Single-byte character |
1190 | 1276 | $res.="\0".chr($c1); |
@@ -1206,22 +1292,26 @@ discard block |
||
1206 | 1292 | { |
1207 | 1293 | //Extract info from a JPEG file |
1208 | 1294 | $a=GetImageSize($file); |
1209 | - if(!$a) |
|
1210 | - $this->Error('Missing or incorrect image file: '.$file); |
|
1211 | - if($a[2]!=2) |
|
1212 | - $this->Error('Not a JPEG file: '.$file); |
|
1213 | - if(!isset($a['channels']) || $a['channels']==3) |
|
1214 | - $colspace='DeviceRGB'; |
|
1215 | - elseif($a['channels']==4) |
|
1216 | - $colspace='DeviceCMYK'; |
|
1217 | - else |
|
1218 | - $colspace='DeviceGray'; |
|
1295 | + if(!$a) { |
|
1296 | + $this->Error('Missing or incorrect image file: '.$file); |
|
1297 | + } |
|
1298 | + if($a[2]!=2) { |
|
1299 | + $this->Error('Not a JPEG file: '.$file); |
|
1300 | + } |
|
1301 | + if(!isset($a['channels']) || $a['channels']==3) { |
|
1302 | + $colspace='DeviceRGB'; |
|
1303 | + } elseif($a['channels']==4) { |
|
1304 | + $colspace='DeviceCMYK'; |
|
1305 | + } else { |
|
1306 | + $colspace='DeviceGray'; |
|
1307 | + } |
|
1219 | 1308 | $bpc=isset($a['bits']) ? $a['bits'] : 8; |
1220 | 1309 | //Read whole file |
1221 | 1310 | $f=fopen($file,'rb'); |
1222 | 1311 | $data=''; |
1223 | - while(!feof($f)) |
|
1224 | - $data.=fread($f,8192); |
|
1312 | + while(!feof($f)) { |
|
1313 | + $data.=fread($f,8192); |
|
1314 | + } |
|
1225 | 1315 | fclose($f); |
1226 | 1316 | return array('w'=>$a[0], 'h'=>$a[1], 'cs'=>$colspace, 'bpc'=>$bpc, 'f'=>'DCTDecode', 'data'=>$data); |
1227 | 1317 | } |
@@ -1230,35 +1320,43 @@ discard block |
||
1230 | 1320 | { |
1231 | 1321 | //Extract info from a PNG file |
1232 | 1322 | $f=fopen($file,'rb'); |
1233 | - if(!$f) |
|
1234 | - $this->Error('Can\'t open image file: '.$file); |
|
1323 | + if(!$f) { |
|
1324 | + $this->Error('Can\'t open image file: '.$file); |
|
1325 | + } |
|
1235 | 1326 | //Check signature |
1236 | - if($this->_readstream($f,8)!=chr(137).'PNG'.chr(13).chr(10).chr(26).chr(10)) |
|
1237 | - $this->Error('Not a PNG file: '.$file); |
|
1327 | + if($this->_readstream($f,8)!=chr(137).'PNG'.chr(13).chr(10).chr(26).chr(10)) { |
|
1328 | + $this->Error('Not a PNG file: '.$file); |
|
1329 | + } |
|
1238 | 1330 | //Read header chunk |
1239 | 1331 | $this->_readstream($f,4); |
1240 | - if($this->_readstream($f,4)!='IHDR') |
|
1241 | - $this->Error('Incorrect PNG file: '.$file); |
|
1332 | + if($this->_readstream($f,4)!='IHDR') { |
|
1333 | + $this->Error('Incorrect PNG file: '.$file); |
|
1334 | + } |
|
1242 | 1335 | $w=$this->_readint($f); |
1243 | 1336 | $h=$this->_readint($f); |
1244 | 1337 | $bpc=ord($this->_readstream($f,1)); |
1245 | - if($bpc>8) |
|
1246 | - $this->Error('16-bit depth not supported: '.$file); |
|
1338 | + if($bpc>8) { |
|
1339 | + $this->Error('16-bit depth not supported: '.$file); |
|
1340 | + } |
|
1247 | 1341 | $ct=ord($this->_readstream($f,1)); |
1248 | - if($ct==0) |
|
1249 | - $colspace='DeviceGray'; |
|
1250 | - elseif($ct==2) |
|
1251 | - $colspace='DeviceRGB'; |
|
1252 | - elseif($ct==3) |
|
1253 | - $colspace='Indexed'; |
|
1254 | - else |
|
1255 | - $this->Error('Alpha channel not supported: '.$file); |
|
1256 | - if(ord($this->_readstream($f,1))!=0) |
|
1257 | - $this->Error('Unknown compression method: '.$file); |
|
1258 | - if(ord($this->_readstream($f,1))!=0) |
|
1259 | - $this->Error('Unknown filter method: '.$file); |
|
1260 | - if(ord($this->_readstream($f,1))!=0) |
|
1261 | - $this->Error('Interlacing not supported: '.$file); |
|
1342 | + if($ct==0) { |
|
1343 | + $colspace='DeviceGray'; |
|
1344 | + } elseif($ct==2) { |
|
1345 | + $colspace='DeviceRGB'; |
|
1346 | + } elseif($ct==3) { |
|
1347 | + $colspace='Indexed'; |
|
1348 | + } else { |
|
1349 | + $this->Error('Alpha channel not supported: '.$file); |
|
1350 | + } |
|
1351 | + if(ord($this->_readstream($f,1))!=0) { |
|
1352 | + $this->Error('Unknown compression method: '.$file); |
|
1353 | + } |
|
1354 | + if(ord($this->_readstream($f,1))!=0) { |
|
1355 | + $this->Error('Unknown filter method: '.$file); |
|
1356 | + } |
|
1357 | + if(ord($this->_readstream($f,1))!=0) { |
|
1358 | + $this->Error('Interlacing not supported: '.$file); |
|
1359 | + } |
|
1262 | 1360 | $this->_readstream($f,4); |
1263 | 1361 | $parms='/DecodeParms <</Predictor 15 /Colors '.($ct==2 ? 3 : 1).' /BitsPerComponent '.$bpc.' /Columns '.$w.'>>'; |
1264 | 1362 | //Scan chunks looking for palette, transparency and image data |
@@ -1274,37 +1372,37 @@ discard block |
||
1274 | 1372 | //Read palette |
1275 | 1373 | $pal=$this->_readstream($f,$n); |
1276 | 1374 | $this->_readstream($f,4); |
1277 | - } |
|
1278 | - elseif($type=='tRNS') |
|
1375 | + } elseif($type=='tRNS') |
|
1279 | 1376 | { |
1280 | 1377 | //Read transparency info |
1281 | 1378 | $t=$this->_readstream($f,$n); |
1282 | - if($ct==0) |
|
1283 | - $trns=array(ord(substr($t,1,1))); |
|
1284 | - elseif($ct==2) |
|
1285 | - $trns=array(ord(substr($t,1,1)), ord(substr($t,3,1)), ord(substr($t,5,1))); |
|
1286 | - else |
|
1379 | + if($ct==0) { |
|
1380 | + $trns=array(ord(substr($t,1,1))); |
|
1381 | + } elseif($ct==2) { |
|
1382 | + $trns=array(ord(substr($t,1,1)), ord(substr($t,3,1)), ord(substr($t,5,1))); |
|
1383 | + } else |
|
1287 | 1384 | { |
1288 | 1385 | $pos=strpos($t,chr(0)); |
1289 | - if($pos!==false) |
|
1290 | - $trns=array($pos); |
|
1386 | + if($pos!==false) { |
|
1387 | + $trns=array($pos); |
|
1388 | + } |
|
1291 | 1389 | } |
1292 | 1390 | $this->_readstream($f,4); |
1293 | - } |
|
1294 | - elseif($type=='IDAT') |
|
1391 | + } elseif($type=='IDAT') |
|
1295 | 1392 | { |
1296 | 1393 | //Read image data block |
1297 | 1394 | $data.=$this->_readstream($f,$n); |
1298 | 1395 | $this->_readstream($f,4); |
1396 | + } elseif($type=='IEND') { |
|
1397 | + break; |
|
1398 | + } else { |
|
1399 | + $this->_readstream($f,$n+4); |
|
1299 | 1400 | } |
1300 | - elseif($type=='IEND') |
|
1301 | - break; |
|
1302 | - else |
|
1303 | - $this->_readstream($f,$n+4); |
|
1304 | 1401 | } |
1305 | 1402 | while($n); |
1306 | - if($colspace=='Indexed' && empty($pal)) |
|
1307 | - $this->Error('Missing palette in '.$file); |
|
1403 | + if($colspace=='Indexed' && empty($pal)) { |
|
1404 | + $this->Error('Missing palette in '.$file); |
|
1405 | + } |
|
1308 | 1406 | fclose($f); |
1309 | 1407 | return array('w'=>$w, 'h'=>$h, 'cs'=>$colspace, 'bpc'=>$bpc, 'f'=>'FlateDecode', 'parms'=>$parms, 'pal'=>$pal, 'trns'=>$trns, 'data'=>$data); |
1310 | 1408 | } |
@@ -1316,13 +1414,15 @@ discard block |
||
1316 | 1414 | while($n>0 && !feof($f)) |
1317 | 1415 | { |
1318 | 1416 | $s=fread($f,$n); |
1319 | - if($s===false) |
|
1320 | - $this->Error('Error while reading stream'); |
|
1417 | + if($s===false) { |
|
1418 | + $this->Error('Error while reading stream'); |
|
1419 | + } |
|
1321 | 1420 | $n-=strlen($s); |
1322 | 1421 | $res.=$s; |
1323 | 1422 | } |
1324 | - if($n>0) |
|
1325 | - $this->Error('Unexpected end of stream'); |
|
1423 | + if($n>0) { |
|
1424 | + $this->Error('Unexpected end of stream'); |
|
1425 | + } |
|
1326 | 1426 | return $res; |
1327 | 1427 | } |
1328 | 1428 | |
@@ -1336,19 +1436,24 @@ discard block |
||
1336 | 1436 | function _parsegif($file) |
1337 | 1437 | { |
1338 | 1438 | //Extract info from a GIF file (via PNG conversion) |
1339 | - if(!function_exists('imagepng')) |
|
1340 | - $this->Error('GD extension is required for GIF support'); |
|
1341 | - if(!function_exists('imagecreatefromgif')) |
|
1342 | - $this->Error('GD has no GIF read support'); |
|
1439 | + if(!function_exists('imagepng')) { |
|
1440 | + $this->Error('GD extension is required for GIF support'); |
|
1441 | + } |
|
1442 | + if(!function_exists('imagecreatefromgif')) { |
|
1443 | + $this->Error('GD has no GIF read support'); |
|
1444 | + } |
|
1343 | 1445 | $im=imagecreatefromgif($file); |
1344 | - if(!$im) |
|
1345 | - $this->Error('Missing or incorrect image file: '.$file); |
|
1446 | + if(!$im) { |
|
1447 | + $this->Error('Missing or incorrect image file: '.$file); |
|
1448 | + } |
|
1346 | 1449 | imageinterlace($im,0); |
1347 | 1450 | $tmp=tempnam('.','gif'); |
1348 | - if(!$tmp) |
|
1349 | - $this->Error('Unable to create a temporary file'); |
|
1350 | - if(!imagepng($im,$tmp)) |
|
1351 | - $this->Error('Error while saving to temporary file'); |
|
1451 | + if(!$tmp) { |
|
1452 | + $this->Error('Unable to create a temporary file'); |
|
1453 | + } |
|
1454 | + if(!imagepng($im,$tmp)) { |
|
1455 | + $this->Error('Error while saving to temporary file'); |
|
1456 | + } |
|
1352 | 1457 | imagedestroy($im); |
1353 | 1458 | $info=$this->_parsepng($tmp); |
1354 | 1459 | unlink($tmp); |
@@ -1373,11 +1478,12 @@ discard block |
||
1373 | 1478 | function _out($s) |
1374 | 1479 | { |
1375 | 1480 | //Add a line to the document |
1376 | - if($this->state==2) |
|
1377 | - $this->pages[$this->page].=$s."\n"; |
|
1378 | - else |
|
1379 | - $this->buffer.=$s."\n"; |
|
1380 | -} |
|
1481 | + if($this->state==2) { |
|
1482 | + $this->pages[$this->page].=$s."\n"; |
|
1483 | + } else { |
|
1484 | + $this->buffer.=$s."\n"; |
|
1485 | + } |
|
1486 | + } |
|
1381 | 1487 | |
1382 | 1488 | function _putpages() |
1383 | 1489 | { |
@@ -1385,15 +1491,15 @@ discard block |
||
1385 | 1491 | if(!empty($this->AliasNbPages)) |
1386 | 1492 | { |
1387 | 1493 | //Replace number of pages |
1388 | - for($n=1;$n<=$nb;$n++) |
|
1389 | - $this->pages[$n]=str_replace($this->AliasNbPages,$nb,$this->pages[$n]); |
|
1494 | + for($n=1;$n<=$nb;$n++) { |
|
1495 | + $this->pages[$n]=str_replace($this->AliasNbPages,$nb,$this->pages[$n]); |
|
1496 | + } |
|
1390 | 1497 | } |
1391 | 1498 | if($this->DefOrientation=='P') |
1392 | 1499 | { |
1393 | 1500 | $wPt=$this->DefPageFormat[0]*$this->k; |
1394 | 1501 | $hPt=$this->DefPageFormat[1]*$this->k; |
1395 | - } |
|
1396 | - else |
|
1502 | + } else |
|
1397 | 1503 | { |
1398 | 1504 | $wPt=$this->DefPageFormat[1]*$this->k; |
1399 | 1505 | $hPt=$this->DefPageFormat[0]*$this->k; |
@@ -1405,8 +1511,9 @@ discard block |
||
1405 | 1511 | $this->_newobj(); |
1406 | 1512 | $this->_out('<</Type /Page'); |
1407 | 1513 | $this->_out('/Parent 1 0 R'); |
1408 | - if(isset($this->PageSizes[$n])) |
|
1409 | - $this->_out(sprintf('/MediaBox [0 0 %.2F %.2F]',$this->PageSizes[$n][0],$this->PageSizes[$n][1])); |
|
1514 | + if(isset($this->PageSizes[$n])) { |
|
1515 | + $this->_out(sprintf('/MediaBox [0 0 %.2F %.2F]',$this->PageSizes[$n][0],$this->PageSizes[$n][1])); |
|
1516 | + } |
|
1410 | 1517 | $this->_out('/Resources 2 0 R'); |
1411 | 1518 | if(isset($this->PageLinks[$n])) |
1412 | 1519 | { |
@@ -1416,9 +1523,9 @@ discard block |
||
1416 | 1523 | { |
1417 | 1524 | $rect=sprintf('%.2F %.2F %.2F %.2F',$pl[0],$pl[1],$pl[0]+$pl[2],$pl[1]-$pl[3]); |
1418 | 1525 | $annots.='<</Type /Annot /Subtype /Link /Rect ['.$rect.'] /Border [0 0 0] '; |
1419 | - if(is_string($pl[4])) |
|
1420 | - $annots.='/A <</S /URI /URI '.$this->_textstring($pl[4]).'>>>>'; |
|
1421 | - else |
|
1526 | + if(is_string($pl[4])) { |
|
1527 | + $annots.='/A <</S /URI /URI '.$this->_textstring($pl[4]).'>>>>'; |
|
1528 | + } else |
|
1422 | 1529 | { |
1423 | 1530 | $l=$this->links[$pl[4]]; |
1424 | 1531 | $h=isset($this->PageSizes[$l[0]]) ? $this->PageSizes[$l[0]][1] : $hPt; |
@@ -1441,8 +1548,9 @@ discard block |
||
1441 | 1548 | $this->_out('1 0 obj'); |
1442 | 1549 | $this->_out('<</Type /Pages'); |
1443 | 1550 | $kids='/Kids ['; |
1444 | - for($i=0;$i<$nb;$i++) |
|
1445 | - $kids.=(3+2*$i).' 0 R '; |
|
1551 | + for($i=0;$i<$nb;$i++) { |
|
1552 | + $kids.=(3+2*$i).' 0 R '; |
|
1553 | + } |
|
1446 | 1554 | $this->_out($kids.']'); |
1447 | 1555 | $this->_out('/Count '.$nb); |
1448 | 1556 | $this->_out(sprintf('/MediaBox [0 0 %.2F %.2F]',$wPt,$hPt)); |
@@ -1467,10 +1575,12 @@ discard block |
||
1467 | 1575 | $this->FontFiles[$file]['n']=$this->n; |
1468 | 1576 | $font=''; |
1469 | 1577 | $f=fopen($this->_getfontpath().$file,'rb',1); |
1470 | - if(!$f) |
|
1471 | - $this->Error('Font file not found'); |
|
1472 | - while(!feof($f)) |
|
1473 | - $font.=fread($f,8192); |
|
1578 | + if(!$f) { |
|
1579 | + $this->Error('Font file not found'); |
|
1580 | + } |
|
1581 | + while(!feof($f)) { |
|
1582 | + $font.=fread($f,8192); |
|
1583 | + } |
|
1474 | 1584 | fclose($f); |
1475 | 1585 | $compressed=(substr($file,-2)=='.z'); |
1476 | 1586 | if(!$compressed && isset($info['length2'])) |
@@ -1488,11 +1598,13 @@ discard block |
||
1488 | 1598 | } |
1489 | 1599 | } |
1490 | 1600 | $this->_out('<</Length '.strlen($font)); |
1491 | - if($compressed) |
|
1492 | - $this->_out('/Filter /FlateDecode'); |
|
1601 | + if($compressed) { |
|
1602 | + $this->_out('/Filter /FlateDecode'); |
|
1603 | + } |
|
1493 | 1604 | $this->_out('/Length1 '.$info['length1']); |
1494 | - if(isset($info['length2'])) |
|
1495 | - $this->_out('/Length2 '.$info['length2'].' /Length3 0'); |
|
1605 | + if(isset($info['length2'])) { |
|
1606 | + $this->_out('/Length2 '.$info['length2'].' /Length3 0'); |
|
1607 | + } |
|
1496 | 1608 | $this->_out('>>'); |
1497 | 1609 | $this->_putstream($font); |
1498 | 1610 | $this->_out('endobj'); |
@@ -1510,12 +1622,12 @@ discard block |
||
1510 | 1622 | $this->_out('<</Type /Font'); |
1511 | 1623 | $this->_out('/BaseFont /'.$name); |
1512 | 1624 | $this->_out('/Subtype /Type1'); |
1513 | - if($name!='Symbol' && $name!='ZapfDingbats') |
|
1514 | - $this->_out('/Encoding /WinAnsiEncoding'); |
|
1625 | + if($name!='Symbol' && $name!='ZapfDingbats') { |
|
1626 | + $this->_out('/Encoding /WinAnsiEncoding'); |
|
1627 | + } |
|
1515 | 1628 | $this->_out('>>'); |
1516 | 1629 | $this->_out('endobj'); |
1517 | - } |
|
1518 | - elseif($type=='Type1' || $type=='TrueType') |
|
1630 | + } elseif($type=='Type1' || $type=='TrueType') |
|
1519 | 1631 | { |
1520 | 1632 | //Additional Type1 or TrueType font |
1521 | 1633 | $this->_newobj(); |
@@ -1527,10 +1639,11 @@ discard block |
||
1527 | 1639 | $this->_out('/FontDescriptor '.($this->n+2).' 0 R'); |
1528 | 1640 | if($font['enc']) |
1529 | 1641 | { |
1530 | - if(isset($font['diff'])) |
|
1531 | - $this->_out('/Encoding '.($nf+$font['diff']).' 0 R'); |
|
1532 | - else |
|
1533 | - $this->_out('/Encoding /WinAnsiEncoding'); |
|
1642 | + if(isset($font['diff'])) { |
|
1643 | + $this->_out('/Encoding '.($nf+$font['diff']).' 0 R'); |
|
1644 | + } else { |
|
1645 | + $this->_out('/Encoding /WinAnsiEncoding'); |
|
1646 | + } |
|
1534 | 1647 | } |
1535 | 1648 | $this->_out('>>'); |
1536 | 1649 | $this->_out('endobj'); |
@@ -1538,27 +1651,30 @@ discard block |
||
1538 | 1651 | $this->_newobj(); |
1539 | 1652 | $cw=&$font['cw']; |
1540 | 1653 | $s='['; |
1541 | - for($i=32;$i<=255;$i++) |
|
1542 | - $s.=$cw[chr($i)].' '; |
|
1654 | + for($i=32;$i<=255;$i++) { |
|
1655 | + $s.=$cw[chr($i)].' '; |
|
1656 | + } |
|
1543 | 1657 | $this->_out($s.']'); |
1544 | 1658 | $this->_out('endobj'); |
1545 | 1659 | //Descriptor |
1546 | 1660 | $this->_newobj(); |
1547 | 1661 | $s='<</Type /FontDescriptor /FontName /'.$name; |
1548 | - foreach($font['desc'] as $k=>$v) |
|
1549 | - $s.=' /'.$k.' '.$v; |
|
1662 | + foreach($font['desc'] as $k=>$v) { |
|
1663 | + $s.=' /'.$k.' '.$v; |
|
1664 | + } |
|
1550 | 1665 | $file=$font['file']; |
1551 | - if($file) |
|
1552 | - $s.=' /FontFile'.($type=='Type1' ? '' : '2').' '.$this->FontFiles[$file]['n'].' 0 R'; |
|
1666 | + if($file) { |
|
1667 | + $s.=' /FontFile'.($type=='Type1' ? '' : '2').' '.$this->FontFiles[$file]['n'].' 0 R'; |
|
1668 | + } |
|
1553 | 1669 | $this->_out($s.'>>'); |
1554 | 1670 | $this->_out('endobj'); |
1555 | - } |
|
1556 | - else |
|
1671 | + } else |
|
1557 | 1672 | { |
1558 | 1673 | //Allow for additional types |
1559 | 1674 | $mtd='_put'.strtolower($type); |
1560 | - if(!method_exists($this,$mtd)) |
|
1561 | - $this->Error('Unsupported font type: '.$type); |
|
1675 | + if(!method_exists($this,$mtd)) { |
|
1676 | + $this->Error('Unsupported font type: '.$type); |
|
1677 | + } |
|
1562 | 1678 | $this->$mtd($font); |
1563 | 1679 | } |
1564 | 1680 | } |
@@ -1576,24 +1692,28 @@ discard block |
||
1576 | 1692 | $this->_out('/Subtype /Image'); |
1577 | 1693 | $this->_out('/Width '.$info['w']); |
1578 | 1694 | $this->_out('/Height '.$info['h']); |
1579 | - if($info['cs']=='Indexed') |
|
1580 | - $this->_out('/ColorSpace [/Indexed /DeviceRGB '.(strlen($info['pal'])/3-1).' '.($this->n+1).' 0 R]'); |
|
1581 | - else |
|
1695 | + if($info['cs']=='Indexed') { |
|
1696 | + $this->_out('/ColorSpace [/Indexed /DeviceRGB '.(strlen($info['pal'])/3-1).' '.($this->n+1).' 0 R]'); |
|
1697 | + } else |
|
1582 | 1698 | { |
1583 | 1699 | $this->_out('/ColorSpace /'.$info['cs']); |
1584 | - if($info['cs']=='DeviceCMYK') |
|
1585 | - $this->_out('/Decode [1 0 1 0 1 0 1 0]'); |
|
1700 | + if($info['cs']=='DeviceCMYK') { |
|
1701 | + $this->_out('/Decode [1 0 1 0 1 0 1 0]'); |
|
1702 | + } |
|
1586 | 1703 | } |
1587 | 1704 | $this->_out('/BitsPerComponent '.$info['bpc']); |
1588 | - if(isset($info['f'])) |
|
1589 | - $this->_out('/Filter /'.$info['f']); |
|
1590 | - if(isset($info['parms'])) |
|
1591 | - $this->_out($info['parms']); |
|
1705 | + if(isset($info['f'])) { |
|
1706 | + $this->_out('/Filter /'.$info['f']); |
|
1707 | + } |
|
1708 | + if(isset($info['parms'])) { |
|
1709 | + $this->_out($info['parms']); |
|
1710 | + } |
|
1592 | 1711 | if(isset($info['trns']) && is_array($info['trns'])) |
1593 | 1712 | { |
1594 | 1713 | $trns=''; |
1595 | - for($i=0;$i<count($info['trns']);$i++) |
|
1596 | - $trns.=$info['trns'][$i].' '.$info['trns'][$i].' '; |
|
1714 | + for($i=0;$i<count($info['trns']);$i++) { |
|
1715 | + $trns.=$info['trns'][$i].' '.$info['trns'][$i].' '; |
|
1716 | + } |
|
1597 | 1717 | $this->_out('/Mask ['.$trns.']'); |
1598 | 1718 | } |
1599 | 1719 | $this->_out('/Length '.strlen($info['data']).'>>'); |
@@ -1614,16 +1734,18 @@ discard block |
||
1614 | 1734 | |
1615 | 1735 | function _putxobjectdict() |
1616 | 1736 | { |
1617 | - foreach($this->images as $image) |
|
1618 | - $this->_out('/I'.$image['i'].' '.$image['n'].' 0 R'); |
|
1619 | -} |
|
1737 | + foreach($this->images as $image) { |
|
1738 | + $this->_out('/I'.$image['i'].' '.$image['n'].' 0 R'); |
|
1739 | + } |
|
1740 | + } |
|
1620 | 1741 | |
1621 | 1742 | function _putresourcedict() |
1622 | 1743 | { |
1623 | 1744 | $this->_out('/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]'); |
1624 | 1745 | $this->_out('/Font <<'); |
1625 | - foreach($this->fonts as $font) |
|
1626 | - $this->_out('/F'.$font['i'].' '.$font['n'].' 0 R'); |
|
1746 | + foreach($this->fonts as $font) { |
|
1747 | + $this->_out('/F'.$font['i'].' '.$font['n'].' 0 R'); |
|
1748 | + } |
|
1627 | 1749 | $this->_out('>>'); |
1628 | 1750 | $this->_out('/XObject <<'); |
1629 | 1751 | $this->_putxobjectdict(); |
@@ -1646,16 +1768,21 @@ discard block |
||
1646 | 1768 | function _putinfo() |
1647 | 1769 | { |
1648 | 1770 | $this->_out('/Producer '.$this->_textstring('FPDF '.FPDF_VERSION)); |
1649 | - if(!empty($this->title)) |
|
1650 | - $this->_out('/Title '.$this->_textstring($this->title)); |
|
1651 | - if(!empty($this->subject)) |
|
1652 | - $this->_out('/Subject '.$this->_textstring($this->subject)); |
|
1653 | - if(!empty($this->author)) |
|
1654 | - $this->_out('/Author '.$this->_textstring($this->author)); |
|
1655 | - if(!empty($this->keywords)) |
|
1656 | - $this->_out('/Keywords '.$this->_textstring($this->keywords)); |
|
1657 | - if(!empty($this->creator)) |
|
1658 | - $this->_out('/Creator '.$this->_textstring($this->creator)); |
|
1771 | + if(!empty($this->title)) { |
|
1772 | + $this->_out('/Title '.$this->_textstring($this->title)); |
|
1773 | + } |
|
1774 | + if(!empty($this->subject)) { |
|
1775 | + $this->_out('/Subject '.$this->_textstring($this->subject)); |
|
1776 | + } |
|
1777 | + if(!empty($this->author)) { |
|
1778 | + $this->_out('/Author '.$this->_textstring($this->author)); |
|
1779 | + } |
|
1780 | + if(!empty($this->keywords)) { |
|
1781 | + $this->_out('/Keywords '.$this->_textstring($this->keywords)); |
|
1782 | + } |
|
1783 | + if(!empty($this->creator)) { |
|
1784 | + $this->_out('/Creator '.$this->_textstring($this->creator)); |
|
1785 | + } |
|
1659 | 1786 | $this->_out('/CreationDate '.$this->_textstring('D:'.@date('YmdHis'))); |
1660 | 1787 | } |
1661 | 1788 | |
@@ -1663,21 +1790,23 @@ discard block |
||
1663 | 1790 | { |
1664 | 1791 | $this->_out('/Type /Catalog'); |
1665 | 1792 | $this->_out('/Pages 1 0 R'); |
1666 | - if($this->ZoomMode=='fullpage') |
|
1667 | - $this->_out('/OpenAction [3 0 R /Fit]'); |
|
1668 | - elseif($this->ZoomMode=='fullwidth') |
|
1669 | - $this->_out('/OpenAction [3 0 R /FitH null]'); |
|
1670 | - elseif($this->ZoomMode=='real') |
|
1671 | - $this->_out('/OpenAction [3 0 R /XYZ null null 1]'); |
|
1672 | - elseif(!is_string($this->ZoomMode)) |
|
1673 | - $this->_out('/OpenAction [3 0 R /XYZ null null '.($this->ZoomMode/100).']'); |
|
1674 | - if($this->LayoutMode=='single') |
|
1675 | - $this->_out('/PageLayout /SinglePage'); |
|
1676 | - elseif($this->LayoutMode=='continuous') |
|
1677 | - $this->_out('/PageLayout /OneColumn'); |
|
1678 | - elseif($this->LayoutMode=='two') |
|
1679 | - $this->_out('/PageLayout /TwoColumnLeft'); |
|
1680 | -} |
|
1793 | + if($this->ZoomMode=='fullpage') { |
|
1794 | + $this->_out('/OpenAction [3 0 R /Fit]'); |
|
1795 | + } elseif($this->ZoomMode=='fullwidth') { |
|
1796 | + $this->_out('/OpenAction [3 0 R /FitH null]'); |
|
1797 | + } elseif($this->ZoomMode=='real') { |
|
1798 | + $this->_out('/OpenAction [3 0 R /XYZ null null 1]'); |
|
1799 | + } elseif(!is_string($this->ZoomMode)) { |
|
1800 | + $this->_out('/OpenAction [3 0 R /XYZ null null '.($this->ZoomMode/100).']'); |
|
1801 | + } |
|
1802 | + if($this->LayoutMode=='single') { |
|
1803 | + $this->_out('/PageLayout /SinglePage'); |
|
1804 | + } elseif($this->LayoutMode=='continuous') { |
|
1805 | + $this->_out('/PageLayout /OneColumn'); |
|
1806 | + } elseif($this->LayoutMode=='two') { |
|
1807 | + $this->_out('/PageLayout /TwoColumnLeft'); |
|
1808 | + } |
|
1809 | + } |
|
1681 | 1810 | |
1682 | 1811 | function _putheader() |
1683 | 1812 | { |
@@ -1713,8 +1842,9 @@ discard block |
||
1713 | 1842 | $this->_out('xref'); |
1714 | 1843 | $this->_out('0 '.($this->n+1)); |
1715 | 1844 | $this->_out('0000000000 65535 f '); |
1716 | - for($i=1;$i<=$this->n;$i++) |
|
1717 | - $this->_out(sprintf('%010d 00000 n ',$this->offsets[$i])); |
|
1845 | + for($i=1;$i<=$this->n;$i++) { |
|
1846 | + $this->_out(sprintf('%010d 00000 n ',$this->offsets[$i])); |
|
1847 | + } |
|
1718 | 1848 | //Trailer |
1719 | 1849 | $this->_out('trailer'); |
1720 | 1850 | $this->_out('<<'); |