Skip to content

Commit

Permalink
PDF renderer replaced instead of image renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
MartkCz committed May 20, 2018
1 parent a264250 commit 85ca557
Show file tree
Hide file tree
Showing 29 changed files with 1,076 additions and 1,129 deletions.
29 changes: 3 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@ php 7.1
composer require webchemistry/invoice
```

php 5.5

```
composer require webchemistry/invoice:^1.0
```

## Usage

### Company
Expand Down Expand Up @@ -56,12 +50,6 @@ $order->addItem('Logitech G700s Rechargeable Gaming Mouse', 4, 1790);

### Customizing

```php
$template = new WebChemistry\Invoice\Data\Template();

// ...
```

```php
class CustomFormatter implements IFormatter {

Expand Down Expand Up @@ -92,21 +80,14 @@ class CustomFormatter implements IFormatter {
```php
$invoice = new \WebChemistry\Invoice\Invoice($company);

$images = $invoice->create($customer, $order);
foreach ($images as $page => $invoice) {
$invoice->save(__DIR__ . "/invoice-$page.jpg");
}

// Show first page

header('Content-Type: image/jpeg');
echo $images[0]->encode();
header('Content-Type: application/pdf');
echo $invoice->create($customer, $order);
```

## Generating preview

```php
header('Content-Type: image/jpeg');
header('Content-Type: application/pdf');
echo $invoice->generatePreview();
```

Expand Down Expand Up @@ -148,7 +129,3 @@ First page:

Second page:
![second page](http://i.imgbox.com/ebrwXldf.jpg)

Customizing:
![customizing](https://i.imgbox.com/LTLUYWtQ.jpg)

27 changes: 27 additions & 0 deletions assets/OpenSans-Regular.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php
$type = 'TrueType';
$name = 'OpenSans';
$desc = ['Ascent' => 765, 'Descent' => -240, 'CapHeight' => 714, 'Flags' => 32, 'FontBBox' => '[-550 -271 1204 1048]', 'ItalicAngle' => 0, 'StemV' => 70, 'MissingWidth' => 600];
$up = -75;
$ut = 50;
$cw = [
chr(0) => 600, chr(1) => 600, chr(2) => 600, chr(3) => 600, chr(4) => 600, chr(5) => 600, chr(6) => 600, chr(7) => 600, chr(8) => 600, chr(9) => 600, chr(10) => 600, chr(11) => 600, chr(12) => 600, chr(13) => 600, chr(14) => 600, chr(15) => 600, chr(16) => 600, chr(17) => 600, chr(18) => 600, chr(19) => 600, chr(20) => 600, chr(21) => 600,
chr(22) => 600, chr(23) => 600, chr(24) => 600, chr(25) => 600, chr(26) => 600, chr(27) => 600, chr(28) => 600, chr(29) => 600, chr(30) => 600, chr(31) => 600, ' ' => 260, '!' => 267, '"' => 401, '#' => 646, '$' => 572, '%' => 823, '&' => 730, '\'' => 221, '(' => 296, ')' => 296, '*' => 552, '+' => 572,
',' => 245, '-' => 322, '.' => 266, '/' => 367, '0' => 572, '1' => 572, '2' => 572, '3' => 572, '4' => 572, '5' => 572, '6' => 572, '7' => 572, '8' => 572, '9' => 572, ':' => 266, ';' => 266, '<' => 572, '=' => 572, '>' => 572, '?' => 429, '@' => 899, 'A' => 633,
'B' => 648, 'C' => 631, 'D' => 729, 'E' => 556, 'F' => 516, 'G' => 728, 'H' => 738, 'I' => 279, 'J' => 267, 'K' => 614, 'L' => 519, 'M' => 903, 'N' => 754, 'O' => 779, 'P' => 602, 'Q' => 779, 'R' => 618, 'S' => 549, 'T' => 553, 'U' => 728, 'V' => 595, 'W' => 926,
'X' => 577, 'Y' => 560, 'Z' => 571, '[' => 329, '\\' => 367, ']' => 329, '^' => 542, '_' => 448, '`' => 577, 'a' => 556, 'b' => 613, 'c' => 476, 'd' => 613, 'e' => 561, 'f' => 339, 'g' => 548, 'h' => 614, 'i' => 253, 'j' => 253, 'k' => 525, 'l' => 253, 'm' => 930,
'n' => 614, 'o' => 604, 'p' => 613, 'q' => 613, 'r' => 408, 's' => 477, 't' => 353, 'u' => 614, 'v' => 501, 'w' => 778, 'x' => 524, 'y' => 504, 'z' => 468, '{' => 379, '|' => 551, '}' => 379, '~' => 572, chr(127) => 600, chr(128) => 590, chr(129) => 600, chr(130) => 245, chr(131) => 600,
chr(132) => 405, chr(133) => 784, chr(134) => 502, chr(135) => 510, chr(136) => 600, chr(137) => 1202, chr(138) => 549, chr(139) => 304, chr(140) => 549, chr(141) => 553, chr(142) => 571, chr(143) => 571, chr(144) => 600, chr(145) => 170, chr(146) => 170, chr(147) => 350, chr(148) => 350, chr(149) => 376, chr(150) => 500, chr(151) => 1000, chr(152) => 600, chr(153) => 776,
chr(154) => 477, chr(155) => 304, chr(156) => 477, chr(157) => 353, chr(158) => 468, chr(159) => 468, chr(160) => 260, chr(161) => 592, chr(162) => 592, chr(163) => 523, chr(164) => 572, chr(165) => 633, chr(166) => 551, chr(167) => 516, chr(168) => 577, chr(169) => 832, chr(170) => 549, chr(171) => 497, chr(172) => 572, chr(173) => 322, chr(174) => 832, chr(175) => 571,
chr(176) => 428, chr(177) => 572, chr(178) => 197, chr(179) => 261, chr(180) => 577, chr(181) => 619, chr(182) => 655, chr(183) => 266, chr(184) => 227, chr(185) => 556, chr(186) => 477, chr(187) => 497, chr(188) => 519, chr(189) => 577, chr(190) => 253, chr(191) => 468, chr(192) => 618, chr(193) => 633, chr(194) => 633, chr(195) => 633, chr(196) => 633, chr(197) => 519,
chr(198) => 631, chr(199) => 631, chr(200) => 631, chr(201) => 556, chr(202) => 556, chr(203) => 556, chr(204) => 556, chr(205) => 279, chr(206) => 279, chr(207) => 729, chr(208) => 722, chr(209) => 754, chr(210) => 754, chr(211) => 779, chr(212) => 779, chr(213) => 779, chr(214) => 779, chr(215) => 572, chr(216) => 618, chr(217) => 728, chr(218) => 728, chr(219) => 728,
chr(220) => 728, chr(221) => 560, chr(222) => 553, chr(223) => 622, chr(224) => 408, chr(225) => 556, chr(226) => 556, chr(227) => 556, chr(228) => 556, chr(229) => 253, chr(230) => 476, chr(231) => 476, chr(232) => 476, chr(233) => 561, chr(234) => 561, chr(235) => 561, chr(236) => 561, chr(237) => 253, chr(238) => 253, chr(239) => 613, chr(240) => 613, chr(241) => 614,
chr(242) => 614, chr(243) => 604, chr(244) => 604, chr(245) => 604, chr(246) => 604, chr(247) => 572, chr(248) => 408, chr(249) => 614, chr(250) => 614, chr(251) => 614, chr(252) => 614, chr(253) => 504, chr(254) => 353, chr(255) => 253,
];
$enc = 'cp1250';
$diff = '131 /.notdef 136 /.notdef 140 /Sacute /Tcaron 143 /Zacute 152 /.notdef 156 /sacute /tcaron 159 /zacute 161 /caron /breve /Lslash 165 /Aogonek 170 /Scedilla 175 /Zdotaccent 178 /ogonek /lslash 185 /aogonek /scedilla 188 /Lcaron /hungarumlaut /lcaron /zdotaccent /Racute 195 /Abreve 197 /Lacute /Cacute 200 /Ccaron 202 /Eogonek 204 /Ecaron 207 /Dcaron /Dcroat /Nacute /Ncaron 213 /Ohungarumlaut 216 /Rcaron /Uring 219 /Uhungarumlaut 222 /Tcommaaccent 224 /racute 227 /abreve 229 /lacute /cacute 232 /ccaron 234 /eogonek 236 /ecaron 239 /dcaron /dcroat /nacute /ncaron 245 /ohungarumlaut 248 /rcaron /uring 251 /uhungarumlaut 254 /tcommaaccent /dotaccent';
$uv = [0 => [0, 128], 128 => 8364, 130 => 8218, 132 => 8222, 133 => 8230, 134 => [8224, 2], 137 => 8240, 138 => 352, 139 => 8249, 140 => 346, 141 => 356, 142 => 381, 143 => 377, 145 => [8216, 2], 147 => [8220, 2], 149 => 8226, 150 => [8211, 2], 153 => 8482, 154 => 353, 155 => 8250, 156 => 347, 157 => 357, 158 => 382, 159 => 378, 160 => 160, 161 => 711, 162 => 728, 163 => 321, 164 => 164, 165 => 260, 166 => [166, 4], 170 => 350, 171 => [171, 4], 175 => 379, 176 => [176, 2], 178 => 731, 179 => 322, 180 => [180, 5], 185 => 261, 186 => 351, 187 => 187, 188 => 317, 189 => 733, 190 => 318, 191 => 380, 192 => 340, 193 => [193, 2], 195 => 258, 196 => 196, 197 => 313, 198 => 262, 199 => 199, 200 => 268, 201 => 201, 202 => 280, 203 => 203, 204 => 282, 205 => [205, 2], 207 => 270, 208 => 272, 209 => 323, 210 => 327, 211 => [211, 2], 213 => 336, 214 => [214, 2], 216 => 344, 217 => 366, 218 => 218, 219 => 368, 220 => [220, 2], 222 => 354, 223 => 223, 224 => 341, 225 => [225, 2], 227 => 259, 228 => 228, 229 => 314, 230 => 263, 231 => 231, 232 => 269, 233 => 233, 234 => 281, 235 => 235, 236 => 283, 237 => [237, 2], 239 => 271, 240 => 273, 241 => 324, 242 => 328, 243 => [243, 2], 245 => 337, 246 => [246, 2], 248 => 345, 249 => 367, 250 => 250, 251 => 369, 252 => [252, 2], 254 => 355, 255 => 729];
$file = 'OpenSans-Regular.z';
$originalsize = 27996;
$subsetted = true;

Binary file added assets/OpenSans-Regular.z
Binary file not shown.
26 changes: 26 additions & 0 deletions assets/OpenSans-Semibold.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php
$type = 'TrueType';
$name = 'OpenSans-Semibold';
$desc = array('Ascent'=>765,'Descent'=>-240,'CapHeight'=>714,'Flags'=>32,'FontBBox'=>'[-584 -282 1261 1049]','ItalicAngle'=>0,'StemV'=>70,'MissingWidth'=>600);
$up = -75;
$ut = 50;
$cw = array(
chr(0)=>600,chr(1)=>600,chr(2)=>600,chr(3)=>600,chr(4)=>600,chr(5)=>600,chr(6)=>600,chr(7)=>600,chr(8)=>600,chr(9)=>600,chr(10)=>600,chr(11)=>600,chr(12)=>600,chr(13)=>600,chr(14)=>600,chr(15)=>600,chr(16)=>600,chr(17)=>600,chr(18)=>600,chr(19)=>600,chr(20)=>600,chr(21)=>600,
chr(22)=>600,chr(23)=>600,chr(24)=>600,chr(25)=>600,chr(26)=>600,chr(27)=>600,chr(28)=>600,chr(29)=>600,chr(30)=>600,chr(31)=>600,' '=>260,'!'=>276,'"'=>436,'#'=>646,'$'=>571,'%'=>862,'&'=>740,'\''=>243,'('=>317,')'=>317,'*'=>548,'+'=>571,
','=>267,'-'=>322,'.'=>275,'/'=>390,'0'=>571,'1'=>571,'2'=>571,'3'=>571,'4'=>571,'5'=>571,'6'=>571,'7'=>571,'8'=>571,'9'=>571,':'=>275,';'=>278,'<'=>571,'='=>571,'>'=>571,'?'=>453,'@'=>898,'A'=>661,
'B'=>660,'C'=>634,'D'=>734,'E'=>558,'F'=>532,'G'=>726,'H'=>751,'I'=>305,'J'=>299,'K'=>639,'L'=>542,'M'=>923,'N'=>783,'O'=>787,'P'=>615,'Q'=>787,'R'=>639,'S'=>550,'T'=>566,'U'=>742,'V'=>622,'W'=>946,
'X'=>622,'Y'=>592,'Z'=>575,'['=>330,'\\'=>390,']'=>330,'^'=>537,'_'=>429,'`'=>592,'a'=>580,'b'=>623,'c'=>495,'d'=>623,'e'=>576,'f'=>363,'g'=>556,'h'=>635,'i'=>279,'j'=>279,'k'=>572,'l'=>279,'m'=>956,
'n'=>635,'o'=>611,'p'=>623,'q'=>623,'r'=>431,'s'=>487,'t'=>393,'u'=>635,'v'=>535,'w'=>817,'x'=>551,'y'=>536,'z'=>478,'{'=>386,'|'=>551,'}'=>371,'~'=>571,chr(127)=>600,chr(128)=>580,chr(129)=>600,chr(130)=>268,chr(131)=>600,
chr(132)=>461,chr(133)=>819,chr(134)=>509,chr(135)=>518,chr(136)=>600,chr(137)=>1241,chr(138)=>550,chr(139)=>336,chr(140)=>550,chr(141)=>566,chr(142)=>575,chr(143)=>575,chr(144)=>600,chr(145)=>193,chr(146)=>193,chr(147)=>397,chr(148)=>397,chr(149)=>376,chr(150)=>500,chr(151)=>1000,chr(152)=>600,chr(153)=>762,
chr(154)=>487,chr(155)=>336,chr(156)=>487,chr(157)=>393,chr(158)=>478,chr(159)=>478,chr(160)=>260,chr(161)=>599,chr(162)=>599,chr(163)=>544,chr(164)=>571,chr(165)=>661,chr(166)=>551,chr(167)=>501,chr(168)=>592,chr(169)=>832,chr(170)=>550,chr(171)=>556,chr(172)=>571,chr(173)=>322,chr(174)=>832,chr(175)=>575,
chr(176)=>428,chr(177)=>571,chr(178)=>201,chr(179)=>295,chr(180)=>592,chr(181)=>639,chr(182)=>655,chr(183)=>275,chr(184)=>216,chr(185)=>580,chr(186)=>487,chr(187)=>556,chr(188)=>542,chr(189)=>582,chr(190)=>279,chr(191)=>478,chr(192)=>639,chr(193)=>661,chr(194)=>661,chr(195)=>661,chr(196)=>661,chr(197)=>542,
chr(198)=>634,chr(199)=>634,chr(200)=>634,chr(201)=>558,chr(202)=>558,chr(203)=>558,chr(204)=>558,chr(205)=>305,chr(206)=>305,chr(207)=>734,chr(208)=>731,chr(209)=>783,chr(210)=>783,chr(211)=>787,chr(212)=>787,chr(213)=>787,chr(214)=>787,chr(215)=>571,chr(216)=>639,chr(217)=>742,chr(218)=>742,chr(219)=>742,
chr(220)=>742,chr(221)=>592,chr(222)=>566,chr(223)=>666,chr(224)=>431,chr(225)=>580,chr(226)=>580,chr(227)=>580,chr(228)=>580,chr(229)=>279,chr(230)=>495,chr(231)=>495,chr(232)=>495,chr(233)=>576,chr(234)=>576,chr(235)=>576,chr(236)=>576,chr(237)=>279,chr(238)=>279,chr(239)=>623,chr(240)=>631,chr(241)=>635,
chr(242)=>635,chr(243)=>611,chr(244)=>611,chr(245)=>611,chr(246)=>611,chr(247)=>571,chr(248)=>431,chr(249)=>635,chr(250)=>635,chr(251)=>635,chr(252)=>635,chr(253)=>536,chr(254)=>393,chr(255)=>279);
$enc = 'cp1250';
$diff = '131 /.notdef 136 /.notdef 140 /Sacute /Tcaron 143 /Zacute 152 /.notdef 156 /sacute /tcaron 159 /zacute 161 /caron /breve /Lslash 165 /Aogonek 170 /Scedilla 175 /Zdotaccent 178 /ogonek /lslash 185 /aogonek /scedilla 188 /Lcaron /hungarumlaut /lcaron /zdotaccent /Racute 195 /Abreve 197 /Lacute /Cacute 200 /Ccaron 202 /Eogonek 204 /Ecaron 207 /Dcaron /Dcroat /Nacute /Ncaron 213 /Ohungarumlaut 216 /Rcaron /Uring 219 /Uhungarumlaut 222 /Tcommaaccent 224 /racute 227 /abreve 229 /lacute /cacute 232 /ccaron 234 /eogonek 236 /ecaron 239 /dcaron /dcroat /nacute /ncaron 245 /ohungarumlaut 248 /rcaron /uring 251 /uhungarumlaut 254 /tcommaaccent /dotaccent';
$uv = array(0=>array(0,128),128=>8364,130=>8218,132=>8222,133=>8230,134=>array(8224,2),137=>8240,138=>352,139=>8249,140=>346,141=>356,142=>381,143=>377,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),153=>8482,154=>353,155=>8250,156=>347,157=>357,158=>382,159=>378,160=>160,161=>711,162=>728,163=>321,164=>164,165=>260,166=>array(166,4),170=>350,171=>array(171,4),175=>379,176=>array(176,2),178=>731,179=>322,180=>array(180,5),185=>261,186=>351,187=>187,188=>317,189=>733,190=>318,191=>380,192=>340,193=>array(193,2),195=>258,196=>196,197=>313,198=>262,199=>199,200=>268,201=>201,202=>280,203=>203,204=>282,205=>array(205,2),207=>270,208=>272,209=>323,210=>327,211=>array(211,2),213=>336,214=>array(214,2),216=>344,217=>366,218=>218,219=>368,220=>array(220,2),222=>354,223=>223,224=>341,225=>array(225,2),227=>259,228=>228,229=>314,230=>263,231=>231,232=>269,233=>233,234=>281,235=>235,236=>283,237=>array(237,2),239=>271,240=>273,241=>324,242=>328,243=>array(243,2),245=>337,246=>array(246,2),248=>345,249=>367,250=>250,251=>369,252=>array(252,2),254=>355,255=>729);
$file = 'OpenSans-Semibold.z';
$originalsize = 28972;
$subsetted = true;
?>
Binary file added assets/OpenSans-Semibold.z
Binary file not shown.
26 changes: 26 additions & 0 deletions assets/pe.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php
$type = 'TrueType';
$name = 'Pe-icon-7-stroke';
$desc = array('Ascent'=>938,'Descent'=>-63,'CapHeight'=>938,'Flags'=>32,'FontBBox'=>'[0 -63 1002 938]','ItalicAngle'=>0,'StemV'=>70,'MissingWidth'=>0);
$up = 0;
$ut = 0;
$cw = array(
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,
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,' '=>0,'!'=>0,'"'=>0,'#'=>0,'$'=>0,'%'=>0,'&'=>0,'\''=>0,'('=>0,')'=>0,'*'=>0,'+'=>0,
','=>0,'-'=>0,'.'=>0,'/'=>0,'0'=>0,'1'=>0,'2'=>0,'3'=>0,'4'=>0,'5'=>0,'6'=>0,'7'=>0,'8'=>0,'9'=>0,':'=>0,';'=>0,'<'=>0,'='=>0,'>'=>0,'?'=>0,'@'=>0,'A'=>0,
'B'=>0,'C'=>0,'D'=>0,'E'=>0,'F'=>0,'G'=>0,'H'=>0,'I'=>0,'J'=>0,'K'=>0,'L'=>0,'M'=>0,'N'=>0,'O'=>0,'P'=>0,'Q'=>0,'R'=>0,'S'=>0,'T'=>0,'U'=>0,'V'=>0,'W'=>0,
'X'=>0,'Y'=>0,'Z'=>0,'['=>0,'\\'=>0,']'=>0,'^'=>0,'_'=>0,'`'=>0,'a'=>1000,'b'=>1000,'c'=>459,'d'=>918,'e'=>0,'f'=>0,'g'=>0,'h'=>0,'i'=>0,'j'=>0,'k'=>0,'l'=>0,'m'=>0,
'n'=>0,'o'=>0,'p'=>0,'q'=>0,'r'=>0,'s'=>0,'t'=>0,'u'=>0,'v'=>0,'w'=>0,'x'=>0,'y'=>0,'z'=>0,'{'=>0,'|'=>0,'}'=>0,'~'=>0,chr(127)=>0,chr(128)=>0,chr(129)=>0,chr(130)=>0,chr(131)=>0,
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,
chr(154)=>0,chr(155)=>0,chr(156)=>0,chr(157)=>0,chr(158)=>0,chr(159)=>0,chr(160)=>0,chr(161)=>0,chr(162)=>0,chr(163)=>0,chr(164)=>0,chr(165)=>0,chr(166)=>0,chr(167)=>0,chr(168)=>0,chr(169)=>0,chr(170)=>0,chr(171)=>0,chr(172)=>0,chr(173)=>0,chr(174)=>0,chr(175)=>0,
chr(176)=>0,chr(177)=>0,chr(178)=>0,chr(179)=>0,chr(180)=>0,chr(181)=>0,chr(182)=>0,chr(183)=>0,chr(184)=>0,chr(185)=>0,chr(186)=>0,chr(187)=>0,chr(188)=>0,chr(189)=>0,chr(190)=>0,chr(191)=>0,chr(192)=>0,chr(193)=>0,chr(194)=>0,chr(195)=>0,chr(196)=>0,chr(197)=>0,
chr(198)=>0,chr(199)=>0,chr(200)=>0,chr(201)=>0,chr(202)=>0,chr(203)=>0,chr(204)=>0,chr(205)=>0,chr(206)=>0,chr(207)=>0,chr(208)=>0,chr(209)=>0,chr(210)=>0,chr(211)=>0,chr(212)=>0,chr(213)=>0,chr(214)=>0,chr(215)=>0,chr(216)=>0,chr(217)=>0,chr(218)=>0,chr(219)=>0,
chr(220)=>0,chr(221)=>0,chr(222)=>0,chr(223)=>0,chr(224)=>0,chr(225)=>0,chr(226)=>0,chr(227)=>0,chr(228)=>0,chr(229)=>0,chr(230)=>0,chr(231)=>0,chr(232)=>0,chr(233)=>0,chr(234)=>0,chr(235)=>0,chr(236)=>0,chr(237)=>0,chr(238)=>0,chr(239)=>0,chr(240)=>0,chr(241)=>0,
chr(242)=>0,chr(243)=>0,chr(244)=>0,chr(245)=>0,chr(246)=>0,chr(247)=>0,chr(248)=>0,chr(249)=>0,chr(250)=>0,chr(251)=>0,chr(252)=>0,chr(253)=>0,chr(254)=>0,chr(255)=>0);
$enc = 'font';
$diff = '32 /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef 101 /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef 128 /.notdef 130 /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef 142 /.notdef 145 /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef 158 /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef';
$uv = array(97=>58976,98=>58949,99=>59043,100=>59020);
$file = 'pe.z';
$originalsize = 2832;
$subsetted = true;
?>
Binary file added assets/pe.z
Binary file not shown.
8 changes: 5 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
],
"require": {
"php": ">=7.1",
"intervention/image": "^2.3",
"nette/utils": "^2.3"
"nette/utils": "^2.3",
"setasign/fpdf": "^1.8"
},
"require-dev": {
"nette/di": "^2.3",
Expand All @@ -19,5 +19,7 @@
"psr-4": {
"WebChemistry\\Invoice\\": "src/"
}
}
},
"minimum-stability": "dev",
"prefer-stable": true
}
36 changes: 0 additions & 36 deletions src/Components/IPaginator.php

This file was deleted.

17 changes: 0 additions & 17 deletions src/Components/IPaginatorFactory.php

This file was deleted.

21 changes: 14 additions & 7 deletions src/Components/Paginator.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@

use WebChemistry\Invoice\Data\Item;

class Paginator implements IPaginator {

const ITEMS_PER_PAGE = 9;
class Paginator {

/** @var Item[] */
private $items;
Expand All @@ -19,12 +17,17 @@ class Paginator implements IPaginator {
/** @var int */
protected $totalPages;

/** @var int */
private $itemsPerPage;

/**
* @param Item[] $items
* @param int $itemsPerPage
*/
public function __construct(array $items) {
public function __construct(array $items, int $itemsPerPage) {
$this->items = $items;
$this->totalPages = (int) ceil(count($this->items) / self::ITEMS_PER_PAGE);
$this->totalPages = (int) ceil(count($this->items) / $itemsPerPage);
$this->itemsPerPage = $itemsPerPage;
}

/**
Expand All @@ -40,7 +43,11 @@ public function getTotalPages(): int {
public function getItems(): array {
$page = $this->currentPage - 1;

return array_slice($this->items, $page * self::ITEMS_PER_PAGE, $page * self::ITEMS_PER_PAGE + self::ITEMS_PER_PAGE);
return array_slice($this->items, $page * $this->itemsPerPage, $page * $this->itemsPerPage + $this->itemsPerPage);
}

public function isFirstPage(): bool {
return $this->currentPage === 1;
}

/**
Expand All @@ -60,7 +67,7 @@ public function getCurrentPage(): int {
/**
* @return bool
*/
public function hasNextPage(): bool {
public function nextPage(): bool {
if ($this->isLastPage()) {
return FALSE;
}
Expand Down
Loading

0 comments on commit 85ca557

Please sign in to comment.