diff --git a/.idea/workspace.xml b/.idea/workspace.xml index aa7f111..3eb070b 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,9 +2,8 @@ - - + + - + @@ -262,7 +262,7 @@ - + diff --git a/app/Common/Helpers.php b/app/Common/Helpers.php index ece701a..3c733f2 100644 --- a/app/Common/Helpers.php +++ b/app/Common/Helpers.php @@ -58,5 +58,9 @@ class Helpers return array($day, $month, $year); } + public static function textConvert($text){ + return iconv('utf-8','iso-8859-2',$text); + } + } diff --git a/app/Common/fonts/arialpl.php b/app/Common/fonts/arialpl.php new file mode 100644 index 0000000..21cf9d0 --- /dev/null +++ b/app/Common/fonts/arialpl.php @@ -0,0 +1,25 @@ +905,'Descent'=>-212,'CapHeight'=>716,'Flags'=>32,'FontBBox'=>'[-46 -283 979 896]','ItalicAngle'=>0,'StemV'=>70,'MissingWidth'=>750); +$up=-106; +$ut=73; +$cw=array( + chr(0)=>750,chr(1)=>750,chr(2)=>750,chr(3)=>750,chr(4)=>750,chr(5)=>750,chr(6)=>750,chr(7)=>750,chr(8)=>750,chr(9)=>750,chr(10)=>750,chr(11)=>750,chr(12)=>750,chr(13)=>750,chr(14)=>750,chr(15)=>750,chr(16)=>750,chr(17)=>750,chr(18)=>750,chr(19)=>750,chr(20)=>750,chr(21)=>750, + chr(22)=>750,chr(23)=>750,chr(24)=>750,chr(25)=>750,chr(26)=>750,chr(27)=>750,chr(28)=>750,chr(29)=>750,chr(30)=>750,chr(31)=>750,' '=>278,'!'=>278,'"'=>355,'#'=>556,'$'=>556,'%'=>889,'&'=>667,'\''=>191,'('=>333,')'=>333,'*'=>389,'+'=>584, + ','=>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, + '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, + '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, + '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)=>750,chr(128)=>750,chr(129)=>750,chr(130)=>750,chr(131)=>750, + chr(132)=>750,chr(133)=>750,chr(134)=>750,chr(135)=>750,chr(136)=>750,chr(137)=>750,chr(138)=>750,chr(139)=>750,chr(140)=>750,chr(141)=>750,chr(142)=>750,chr(143)=>750,chr(144)=>750,chr(145)=>750,chr(146)=>750,chr(147)=>750,chr(148)=>750,chr(149)=>750,chr(150)=>750,chr(151)=>750,chr(152)=>750,chr(153)=>750, + chr(154)=>750,chr(155)=>750,chr(156)=>750,chr(157)=>750,chr(158)=>750,chr(159)=>750,chr(160)=>278,chr(161)=>667,chr(162)=>333,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>667,chr(167)=>556,chr(168)=>333,chr(169)=>667,chr(170)=>667,chr(171)=>611,chr(172)=>611,chr(173)=>333,chr(174)=>611,chr(175)=>611, + chr(176)=>400,chr(177)=>556,chr(178)=>333,chr(179)=>222,chr(180)=>333,chr(181)=>292,chr(182)=>500,chr(183)=>333,chr(184)=>333,chr(185)=>500,chr(186)=>500,chr(187)=>375,chr(188)=>500,chr(189)=>333,chr(190)=>500,chr(191)=>500,chr(192)=>722,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>556, + chr(198)=>722,chr(199)=>722,chr(200)=>722,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>667,chr(205)=>278,chr(206)=>278,chr(207)=>722,chr(208)=>722,chr(209)=>722,chr(210)=>722,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722, + chr(220)=>722,chr(221)=>667,chr(222)=>611,chr(223)=>611,chr(224)=>333,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>222,chr(230)=>500,chr(231)=>500,chr(232)=>500,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>556,chr(237)=>278,chr(238)=>278,chr(239)=>615,chr(240)=>556,chr(241)=>556, + chr(242)=>556,chr(243)=>556,chr(244)=>556,chr(245)=>556,chr(246)=>556,chr(247)=>549,chr(248)=>333,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>278,chr(255)=>333); +$enc='iso-8859-2'; +$diff='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 161 /Aogonek /breve /Lslash 165 /Lcaron /Sacute 169 /Scaron /Scedilla /Tcaron /Zacute 174 /Zcaron /Zdotaccent 177 /aogonek /ogonek /lslash 181 /lcaron /sacute /caron 185 /scaron /scedilla /tcaron /zacute /hungarumlaut /zcaron /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'; +$file='arialpl.z'; +$size1=5911; +$size2=25241; +?> diff --git a/app/Common/fonts/arialpl.z b/app/Common/fonts/arialpl.z new file mode 100644 index 0000000..f68a8a4 Binary files /dev/null and b/app/Common/fonts/arialpl.z differ diff --git a/app/Common/fonts/arialplb.php b/app/Common/fonts/arialplb.php new file mode 100644 index 0000000..d2d98a6 --- /dev/null +++ b/app/Common/fonts/arialplb.php @@ -0,0 +1,26 @@ +905,'Descent'=>-212,'CapHeight'=>716,'Flags'=>32,'FontBBox'=>'[-46 -319 972 919]','ItalicAngle'=>0,'StemV'=>120,'MissingWidth'=>750); +$up=-106; +$ut=105; +$cw=array( + chr(0)=>750,chr(1)=>750,chr(2)=>750,chr(3)=>750,chr(4)=>750,chr(5)=>750,chr(6)=>750,chr(7)=>750,chr(8)=>750,chr(9)=>750,chr(10)=>750,chr(11)=>750,chr(12)=>750,chr(13)=>750,chr(14)=>750,chr(15)=>750,chr(16)=>750,chr(17)=>750,chr(18)=>750,chr(19)=>750,chr(20)=>750,chr(21)=>750, + chr(22)=>750,chr(23)=>750,chr(24)=>750,chr(25)=>750,chr(26)=>750,chr(27)=>750,chr(28)=>750,chr(29)=>750,chr(30)=>750,chr(31)=>750,' '=>278,'!'=>333,'"'=>474,'#'=>556,'$'=>556,'%'=>889,'&'=>722,'\''=>238,'('=>333,')'=>333,'*'=>389,'+'=>584, + ','=>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, + '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, + '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, + '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)=>750,chr(128)=>750,chr(129)=>750,chr(130)=>750,chr(131)=>750, + chr(132)=>750,chr(133)=>750,chr(134)=>750,chr(135)=>750,chr(136)=>750,chr(137)=>750,chr(138)=>750,chr(139)=>750,chr(140)=>750,chr(141)=>750,chr(142)=>750,chr(143)=>750,chr(144)=>750,chr(145)=>750,chr(146)=>750,chr(147)=>750,chr(148)=>750,chr(149)=>750,chr(150)=>750,chr(151)=>750,chr(152)=>750,chr(153)=>750, + chr(154)=>750,chr(155)=>750,chr(156)=>750,chr(157)=>750,chr(158)=>750,chr(159)=>750,chr(160)=>278,chr(161)=>722,chr(162)=>333,chr(163)=>611,chr(164)=>556,chr(165)=>611,chr(166)=>667,chr(167)=>556,chr(168)=>333,chr(169)=>667,chr(170)=>667,chr(171)=>611,chr(172)=>611,chr(173)=>333,chr(174)=>611,chr(175)=>611, + chr(176)=>400,chr(177)=>556,chr(178)=>333,chr(179)=>278,chr(180)=>333,chr(181)=>385,chr(182)=>556,chr(183)=>333,chr(184)=>333,chr(185)=>556,chr(186)=>556,chr(187)=>479,chr(188)=>500,chr(189)=>333,chr(190)=>500,chr(191)=>500,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>611, + chr(198)=>722,chr(199)=>722,chr(200)=>722,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>667,chr(205)=>278,chr(206)=>278,chr(207)=>722,chr(208)=>722,chr(209)=>722,chr(210)=>722,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722, + chr(220)=>722,chr(221)=>667,chr(222)=>611,chr(223)=>611,chr(224)=>389,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>278,chr(230)=>556,chr(231)=>556,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>556,chr(237)=>278,chr(238)=>278,chr(239)=>719,chr(240)=>611,chr(241)=>611, + chr(242)=>611,chr(243)=>611,chr(244)=>611,chr(245)=>611,chr(246)=>611,chr(247)=>549,chr(248)=>389,chr(249)=>611,chr(250)=>611,chr(251)=>611,chr(252)=>611,chr(253)=>556,chr(254)=>333,chr(255)=>333); +$enc='iso-8859-2'; +$diff='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 161 /Aogonek /breve /Lslash 165 /Lcaron /Sacute 169 /Scaron /Scedilla /Tcaron /Zacute 174 /Zcaron /Zdotaccent 177 /aogonek /ogonek /lslash 181 /lcaron /sacute /caron 185 /scaron /scedilla /tcaron /zacute /hungarumlaut /zcaron /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'; +$file='arialplb.z'; +$size1=5925; +$size2=25741; +?> +© 2020 GitHub, Inc. diff --git a/app/Common/fonts/arialplb.z b/app/Common/fonts/arialplb.z new file mode 100644 index 0000000..745a0c2 Binary files /dev/null and b/app/Common/fonts/arialplb.z differ diff --git a/app/Http/Controllers/documentOverlayController.php b/app/Http/Controllers/documentOverlayController.php index 1df2363..778f3c8 100644 --- a/app/Http/Controllers/documentOverlayController.php +++ b/app/Http/Controllers/documentOverlayController.php @@ -13,6 +13,9 @@ class documentOverlayController extends Controller public function wniosekNadaniePDF($userData, $decoration, $fireStation, $awardedDecorations){ // initiate FPDI $pdf = new Fpdi(); + $pdf->fontpath = "../app/Common/fonts/"; + $pdf->AddFont('arialpl', '', 'arialpl.php'); + #$pdf->AddFont('arialpl', 'B', 'arialplb.php'); // set the source file $pageCount = $pdf->setSourceFile("../app/Http/Controllers/documentTemplates/a.pdf"); // import page 1 @@ -36,7 +39,7 @@ class documentOverlayController extends Controller // $xyz = iconv('UTF-8', 'cp1250', $fireFighterID); $dec = iconv('UTF-8', 'cp1250', $decoration); // now write some text above the imported page - $pdf->SetFont('times'); + $pdf->SetFont('arialpl'); $pdf->SetTextColor(128, 128, 128); #Pieczęć @@ -46,38 +49,38 @@ class documentOverlayController extends Controller #Nazwa odznaczenia $pdf->SetXY(120, 50); //$pdf->Write(0, $decoration); - $pdf->Cell(20,10, $decoration, 0, 0, 'C'); + $pdf->Cell(20,10, Helpers::textConvert($decoration), 0, 0, 'C'); #Imie $pdf->SetXY(35, 74); //$pdf->Write(0, $decoration); - $pdf->Cell(20,10, $userData->name, 0, 0, 'C'); + $pdf->Cell(20,10, Helpers::textConvert($userData->name), 0, 0, 'C'); #Nazwisko $pdf->SetXY(95, 74); //$pdf->Write(0, $decoration); - $pdf->Cell(20,10, $userData->surname, 0, 0, 'C'); + $pdf->Cell(20,10, Helpers::textConvert($userData->surname), 0, 0, 'C'); #Data Urodzenia $pdf->SetXY(35, 93); //$pdf->Write(0, $decoration); - $pdf->Cell(20,10, Helpers::peselBirthdayDate($userData->PESEL), 0, 0, 'C'); + $pdf->Cell(20,10, Helpers::textConvert(Helpers::peselBirthdayDate($userData->PESEL)), 0, 0, 'C'); #Funkcja $pdf->SetXY(124, 113); - $pdf->Cell(20,10, $userData->unitFunction, 0, 0, 'C'); + $pdf->Cell(20,10, Helpers::textConvert($userData->unitFunction), 0, 0, 'C'); #Funkcja $pdf->SetXY(35, 113); - $pdf->Cell(20,10, $fireStation->postOffice, 0, 0, 'C'); + $pdf->Cell(20,10, Helpers::textConvert($fireStation->postOffice), 0, 0, 'C'); $txt = ""; foreach($awardedDecorations as $awardedDecoration){ $txt = $txt." ".$awardedDecoration->decorationName."\n"; } $pdf->SetXY(18, 132); - $pdf->MultiCell(86,4, $txt, 1, 'l', 0); + $pdf->MultiCell(86,4, Helpers::textConvert($txt), 0, 'l', 0); } } @@ -91,6 +94,8 @@ class documentOverlayController extends Controller public function kartaEwidencyjnaPDF($userData, $fireStation, $userTrainings){ // initiate FPDI $pdf = new Fpdi(); + $pdf->fontpath = "../app/Common/fonts/"; + $pdf->AddFont('arialpl', '', 'arialpl.php'); // set the source file $pageCount = $pdf->setSourceFile("../app/Http/Controllers/documentTemplates/b.pdf"); // import page 1 @@ -111,12 +116,12 @@ class documentOverlayController extends Controller if($pageNo == 1) { - $pdf->SetFont('times'); + $pdf->SetFont('arialpl'); $pdf->SetTextColor(128, 128, 128); # Imie i nazwisko $pdf->SetXY(84, 31.5); - $pdf->Cell(0, 10, $userData->surname . ' ' . $userData->name, 0, 0, 'l'); + $pdf->Cell(0, 10, Helpers::textConvert($userData->surname . ' ' . $userData->name), 0, 0, 'l'); # PESEL $peselArray = str_split($userData->PESEL); @@ -149,9 +154,9 @@ class documentOverlayController extends Controller $pdf->SetXY(20, $y); $pdf->Cell(0, 10, $lp, 0, 0, 'l'); $pdf->SetXY(26, $y); - $pdf->Cell(0, 10, $userTraining->trainingName, 0, 0, 'l'); + $pdf->Cell(0, 10, Helpers::textConvert($userTraining->trainingName), 0, 0, 'l'); $pdf->SetXY(162, $y); - $pdf->Cell(0, 10, $userTraining->dateOfComplete, 0, 0, 'l'); + $pdf->Cell(0, 10, Helpers::textConvert($userTraining->dateOfComplete), 0, 0, 'l'); $y = $y + 5.5; $lp = $lp + 1; }