setSourceFile("../app/Http/Controllers/documentTemplates/a.pdf"); // import page 1 for ($pageNo = 1; $pageNo <= $pageCount; $pageNo++) { // import a page $templateId = $pdf->importPage($pageNo); // get the size of the imported page $size = $pdf->getTemplateSize($templateId); // create a page (landscape or portrait depending on the imported page size) if ($size[0] > $size[1]) { $pdf->AddPage('L', array($size[0], $size[1])); } else { $pdf->AddPage('P', array($size[0], $size[1])); } $pdf->useTemplate($templateId); if($pageNo == 1){ $str = iconv('UTF-8', 'cp1250', 'zazółcić gęślą jaźń'); // $xyz = iconv('UTF-8', 'cp1250', $fireFighterID); $dec = iconv('UTF-8', 'cp1250', $decoration); // now write some text above the imported page $pdf->SetFont('times'); $pdf->SetTextColor(128, 128, 128); #Pieczęć $pdf->SetXY(30, 30); // $pdf->Write(0, $decoration); #Nazwa odznaczenia $pdf->SetXY(120, 50); //$pdf->Write(0, $decoration); $pdf->Cell(20,10, $decoration, 1, 0, 'C'); #Imie $pdf->SetXY(35, 74); //$pdf->Write(0, $decoration); $pdf->Cell(20,10, $userData->name, 1, 0, 'C'); #Nazwisko $pdf->SetXY(95, 74); //$pdf->Write(0, $decoration); $pdf->Cell(20,10, $userData->surname, 1, 0, 'C'); #Data Urodzenia $pdf->SetXY(35, 93); //$pdf->Write(0, $decoration); $pdf->Cell(20,10, $this->peselBirthDay($userData->PESEL), 1, 0, 'C'); #Funkcja $pdf->SetXY(124, 113); $pdf->Cell(20,10, $userData->unitFunction, 1, 0, 'C'); #Funkcja $pdf->SetXY(35, 113); $pdf->Cell(20,10, $fireStation->postOffice, 1, 0, 'C'); } } $pdf->Output(); } }