function generate_mitgliedsbescheinigung($titleAndName, $strasse, $plz, $ort, $land, $jahr, $vorstand, $datum) { // initiate FPDI $pdf = new FPDI(); // add a page $pdf->AddPage(); // set the source file $pdf->setSourceFile(HOME_DIRECTORY . 'alumpiHP_libraries/Mitgliedsbestaetigung_blank.pdf'); // import page 1 $tplIdx = $pdf->importPage(1); // use the imported page and place it at position 0,0 with a width of 210 mm (full page) $pdf->useTemplate($tplIdx, 0, 0, 210); // add the font DejaVu $pdf->AddFont('DejaVuSans', '', 'DejaVuSans.ttf', true); $pdf->AddFont('DejaVuSans-Bold', '', 'DejaVuSans-Bold.ttf', true); // text settings $pdf->SetTextColor(0, 0, 0); // add address of the member $addressString = $titleAndName . "\n"; $addressString .= $strasse . "\n"; $addressString .= $plz . " " . $ort . "\n"; $addressString .= $land; $pdf->SetFont('DejaVuSans'); $pdf->SetFontSize(12); $pdf->SetXY(20, 23); $pdf->Multicell(80, 6, $addressString); //add heading $headingString = "Mitgliedsbescheinigung " . $jahr; $pdf->SetFont('DejaVuSans-Bold'); $pdf->SetFontSize(16); $pdf->SetXY(20, 80); $pdf->Multicell(170, 6, $headingString); // add main text $textString = "Hiermit wird bestätigt, dass " . $titleAndName . " im Kalenderjahr " . $jahr; $textString .= " ordentliches Mitglied des Absolventen- und Förderverein MPI Uni Bayreuth e.V. (aluMPI) ist.\n"; $textString .= "\n"; $pdf->SetFont('DejaVuSans'); $pdf->SetFontSize(12); $pdf->SetXY(20, 100); $pdf->Multicell(170, 6, $textString); // add signature text $signatureString = "Absolventen- und Förderverein MPI Uni Bayreuth e.V.\n"; $signatureString .= "1. Vorstand: " . $vorstand . "\n"; $pdf->SetXY(20, 140); $pdf->Multicell(170, 6, $signatureString); // add signature $pdf->Image(HOME_DIRECTORY . 'alumpiHP_libraries/unterschrift_krinninger.png', 20, 155, 50); // add place and date $dateString = "Bayreuth, " . $datum; $pdf->SetXY(20, 180); $pdf->Multicell(170, 6, $dateString); ob_clean(); $pdf->Output(); }
public function listAction() { $receipt = new \FPDI(); // PDFの余白(上左右)を設定 $receipt->SetMargins(0, 0, 0); // ヘッダーの出力を無効化 $receipt->setPrintHeader(false); // フッターの出力を無効化 $receipt->setPrintFooter(false); // フォントを登録 $fontPathRegular = $this->getLibPath() . '/tcpdf/fonts/migmix-2p-regular.ttf'; // $regularFont = $receipt->addTTFfont($fontPathRegular, '', '', 32); $font = new TCPDF_FONTS(); $regularFont = $font->addTTFfont($fontPathRegular); $fontPathBold = $this->getLibPath() . '/tcpdf/fonts/migmix-2p-bold.ttf'; // $boldFont = $receipt->addTTFfont($fontPathBold, '', '', 32); $font = new TCPDF_FONTS(); $boldFont = $font->addTTFfont($fontPathBold); // ページを追加 $receipt->AddPage(); // テンプレートを読み込み // $receipt->setSourceFile($this->getLibPath() . '/tcpdf/tpl/receipt.pdf'); // $receipt->setSourceFile($this->getLibPath() . '/tcpdf/tpl/template.pdf'); // $receipt->setSourceFile($this->getLibPath() . '/tcpdf/tpl/w01_1.pdf'); $receipt->setSourceFile($this->getLibPath() . '/tcpdf/tpl/senijiten.pdf'); // 読み込んだPDFの1ページ目のインデックスを取得 $tplIdx = $receipt->importPage(1); // 読み込んだPDFの1ページ目をテンプレートとして使用 $receipt->useTemplate($tplIdx, null, null, null, null, true); // 書き込む文字列のフォントを指定 $receipt->SetFont($regularFont, '', 11); // 書き込む文字列の文字色を指定 $receipt->SetTextColor(0, 0, 255); // X : 42mm / Y : 108mm の位置に $receipt->SetXY(59, 248); // 文字列を書き込む $receipt->Write(0, isset($_POST['name']) ? $_POST['name'] . 'さん' : '名無しさん'); /* $response = new Response( // Output関数の第一引数にはファイル名、第二引数には出力タイプを指定する // 今回は文字列で返してほしいので、ファイル名はnull、出力タイプは S = String を選択する $receipt->Output(null, 'S'), 200, array('content-type' => 'application/pdf') ); // レスポンスヘッダーにContent-Dispositionをセットし、ファイル名をreceipt.pdfに指定 $response->headers->set('Content-Disposition', 'attachment; filename="receipt.pdf"'); return $response; */ // $receipt-> $receipt->output('newpdf.pdf', 'I'); }
function renderPDF($id,$mode) { $pdf = new FPDI(); $db_catalogue_pages = new catalogue_pages; $db_catalogue_pages->get_one_catalogue_pages($id); $db_catalogue_pages->load(); $template_id = $db_catalogue_pages->get_pag_template(); $template = new catalogue_templates; $template->getOne($template_id); $template->load(); $pdf->addPage("Landscape","Letter"); $db_catalogue_objects = new catalogue_objects; $db_catalogue_objects->get_all($id); $pdf->SetFont('Arial','',14); $pdf->Image("pdftemplates/".$template->get_tem_file().".jpg",0,0); while($db_catalogue_objects->load()) { $var = explode("_",$db_catalogue_objects->get_obj_var()); if($var[0] == "image") { if(file_exists($db_catalogue_objects->field->obj_image)) $pdf->Image($db_catalogue_objects->field->obj_image,($db_catalogue_objects->field->obj_posx*0.353),($db_catalogue_objects->field->obj_posy*0.353),"50","50"); } $pdf->SetXY($db_catalogue_objects->field->obj_posx*0.353,($db_catalogue_objects->field->obj_posy*0.35) + 60); $pdf->Write(5,$db_catalogue_objects->field->obj_text); } $db_catalogue_objects->close(); $db_catalogue_pages->close(); //if($mode=="I") $pdf->Output("page_".$id.".pdf", "I"); //else $pdf->Output("pages/page_".$id.".pdf", "F"); $pdf->Output("pages/page_".$id.".pdf", "F"); }
protected function execute(InputInterface $input, OutputInterface $output) { $id = $input->getArgument('id'); $pdffile = $input->getArgument('pdf'); $em = $this->getContainer()->get('doctrine'); $tab = $this->csv($pdffile); $template = $em->getRepository('PrintBundle:Template')->find($id); $path = $this->getContainer()->get('kernel')->getRootDir() . '/../web/uploads/pdf/' . $template->getPdffile(); $width = $template->getWidth(); $height = $template->getHeight(); $orientation = $height > $width ? 'P' : 'L'; $custom_layout = array($width, $height); $i = 1; foreach ($tab as $key => $value) { $pdf = new \FPDI($orientation, 'mm', $custom_layout, true, 'UTF-8', false); $pdf->setPageOrientation($orientation); $pdf->SetMargins(PDF_MARGIN_LEFT, 40, PDF_MARGIN_RIGHT); $pdf->SetAutoPageBreak(true, 40); $pdf->setFontSubsetting(false); // add a page $pdf->AddPage($orientation); $pdf->setSourceFile($path); $_tplIdx = $pdf->importPage(1); $size = $pdf->useTemplate($_tplIdx, 0, 0, $width, true); foreach ($template->getChildactivity() as $opt) { $pdf->SetXY($opt->getX(), $opt->getY()); $pdf->SetFont($opt->getFont(), '', $opt->getFontsize() * 2); // echo $opt->getFontsize()."\n"; $pdf->Cell($opt->getWidth(), $opt->getHeight(), $value[$opt->getName()]); } //$pdf->Cell(0, $size['h'], 'TCPDF and FPDI'); // echo $template->getId(); $pdf->Output($this->getContainer()->get('kernel')->getRootDir() . '/../web/folder/pdf' . $template->getId() . "-{$i}.pdf", 'F'); $i++; } }
function back_id($results) { $this->load->helper('settings'); //print preview of MR $this->load->library('fpdf'); $this->load->library('fpdi'); // initiate FPDI $pdf = new FPDI('L'); // add a page $pdf->AddPage(); // set the sourcefile $pagecount = $pdf->setSourceFile('pdf-report/id/back-id.pdf'); // import page 1 $tplIdx = $pdf->importPage(1); // use the imported page and place it at point 10,10 with a width of 100 mm $pdf->useTemplate($tplIdx); // now write some text above the imported page $pdf->SetTextColor(0, 0, 0); $pdf->SetFont('Arial', '', 7); $n = 1; foreach ($results as $result) { $s = new Personal_m(); $row = $s->get_by_employee_id($result->employee_id); //======================== START Column 1 | Right to Left ============================== if ($n == 11) { //add new page $pdf->addPage(); for ($n = 1; $n <= 1; $n++) { $tplidx = $pdf->ImportPage(1); $pdf->useTemplate($tplIdx); //, 1, 1, 210 } $n = $n - 1; } $bday = $row->birth_date; $address = $row->res_address; $blood_type = '"' . $row->blood_type . '"'; $gsis = $row->gsis; $pagibig = $row->pagibig; $philhealth = $row->philhealth; $tin = $row->tin; $emergency = ''; $contact = $row->cp; //----------------------------- Row 1 ---------------------------------- ///Birthday if ($n == 1) { //Birthday if ($bday != '0000-00-00') { $pdf->SetXY(247, 23); $pdf->Cell(50, 0, date('F d, Y', strtotime(date('F d, Y', strtotime($bday)))), '0', 0, 'C', false); } //Address $pdf->SetXY(257, 15); $addr = splitstroverflow(ucwords(strtolower(utf8_decode($address))), 28); $pdf->Cell(30, 0, $addr[0], '0', 0, 'C', false); //display text overflow if ($addr[1]) { $pdf->Ln(2.5); $pdf->SetX(257); $pdf->Cell(30, 0, $addr[1], '0', 0, 'C', false); } if ($addr[2]) { $pdf->Ln(2.5); $pdf->SetX(257); $pdf->Cell(30, 0, $addr[2], '0', 0, 'C', false); } if ($addr[3]) { $pdf->Ln(2.5); $pdf->SetX(257); $pdf->Cell(30, 0, $addr[3], '0', 0, 'C', false); } //Blood Type $pdf->SetXY(247, 28.3); $pdf->Cell(50, 0, strtoupper($blood_type), '0', 0, 'C', false); //GSIS $pdf->SetXY(247, 33); $pdf->Cell(50, 0, strtoupper($gsis), '0', 0, 'C', false); //PAGIBIG $pdf->SetXY(247, 38); $pdf->Cell(50, 0, strtoupper($pagibig), '0', 0, 'C', false); //PHILHEALTH $pdf->SetXY(247, 43.5); $pdf->Cell(50, 0, strtoupper($philhealth), '0', 0, 'C', false); //PHILHEALTH $pdf->SetXY(247, 48.5); $pdf->Cell(50, 0, strtoupper($tin), '0', 0, 'C', false); //in case of emergency $pdf->SetXY(235, 75.5); $pdf->Cell(60, 0, strtoupper($emergency), '0', 0, 'C', false); //CP No. $pdf->SetXY(250, 78); $cpno = splitstroverflow($contact, 13); $pdf->Cell(30, 0, $cpno[0], '0', 0, 'C', false); if ($cpno[1]) { $pdf->Ln(3); $pdf->SetX(250); $pdf->Cell(30, 0, $cpno[1], '0', 0, 'C', false); } } //----------------------------- Row 2 ---------------------------------- if ($n == 2) { //Birthday if ($bday != '0000-00-00') { $pdf->SetXY(189, 23); $pdf->Cell(50, 0, date('F d, Y', strtotime(date('F d, Y', strtotime($bday)))), '0', 0, 'C', false); } //Address $pdf->SetXY(199, 15); $addr = splitstroverflow(ucwords(strtolower(utf8_decode($address))), 28); $pdf->Cell(30, 0, $addr[0], '0', 0, 'C', false); //display text overflow if ($addr[1]) { $pdf->Ln(2.5); $pdf->SetX(199); $pdf->Cell(30, 0, $addr[1], '0', 0, 'C', false); } if ($addr[2]) { $pdf->Ln(2.5); $pdf->SetX(199); $pdf->Cell(30, 0, $addr[2], '0', 0, 'C', false); } if ($addr[3]) { $pdf->Ln(2.5); $pdf->SetX(199); $pdf->Cell(30, 0, $addr[3], '0', 0, 'C', false); } //Blood Type $pdf->SetXY(189, 28.3); $pdf->Cell(50, 0, strtoupper($blood_type), '0', 0, 'C', false); //GSIS $pdf->SetXY(189, 33); $pdf->Cell(50, 0, strtoupper($gsis), '0', 0, 'C', false); //PAGIBIG $pdf->SetXY(189, 38); $pdf->Cell(50, 0, strtoupper($pagibig), '0', 0, 'C', false); //PHILHEALTH $pdf->SetXY(189, 43.5); $pdf->Cell(50, 0, strtoupper($philhealth), '0', 0, 'C', false); //PHILHEALTH $pdf->SetXY(189, 48.5); $pdf->Cell(50, 0, strtoupper($tin), '0', 0, 'C', false); //in case of emergency $pdf->SetXY(177, 75.5); $pdf->Cell(60, 0, strtoupper($emergency), '0', 0, 'C', false); //CP No. $pdf->SetXY(192, 78); $cpno = splitstroverflow($contact, 13); $pdf->Cell(30, 0, $cpno[0], '0', 0, 'C', false); if ($cpno[1]) { $pdf->Ln(3); $pdf->SetX(192); $pdf->Cell(30, 0, $cpno[1], '0', 0, 'C', false); } } //----------------------------- Row 3 ---------------------------------- if ($n == 3) { //Birthday if ($bday != '0000-00-00') { $pdf->SetXY(131, 23); $pdf->Cell(50, 0, date('F d, Y', strtotime(date('F d, Y', strtotime($bday)))), '0', 0, 'C', false); } //Address $pdf->SetXY(141, 15); $addr = splitstroverflow(ucwords(strtolower(utf8_decode($address))), 28); $pdf->Cell(30, 0, $addr[0], '0', 0, 'C', false); //display text overflow if ($addr[1]) { $pdf->Ln(2.5); $pdf->SetX(141); $pdf->Cell(30, 0, $addr[1], '0', 0, 'C', false); } if ($addr[2]) { $pdf->Ln(2.5); $pdf->SetX(141); $pdf->Cell(30, 0, $addr[2], '0', 0, 'C', false); } if ($addr[3]) { $pdf->Ln(2.5); $pdf->SetX(141); $pdf->Cell(30, 0, $addr[3], '0', 0, 'C', false); } //Blood Type $pdf->SetXY(131, 28.3); $pdf->Cell(50, 0, strtoupper($blood_type), '0', 0, 'C', false); //GSIS $pdf->SetXY(131, 33); $pdf->Cell(50, 0, strtoupper($gsis), '0', 0, 'C', false); //PAGIBIG $pdf->SetXY(131, 38); $pdf->Cell(50, 0, strtoupper($pagibig), '0', 0, 'C', false); //PHILHEALTH $pdf->SetXY(131, 43.5); $pdf->Cell(50, 0, strtoupper($philhealth), '0', 0, 'C', false); //PHILHEALTH $pdf->SetXY(131, 48.5); $pdf->Cell(50, 0, strtoupper($tin), '0', 0, 'C', false); //in case of emergency $pdf->SetXY(119, 75.5); $pdf->Cell(60, 0, strtoupper($emergency), '0', 0, 'C', false); //CP No. $pdf->SetXY(134, 78); $cpno = splitstroverflow($contact, 13); $pdf->Cell(30, 0, $cpno[0], '0', 0, 'C', false); if ($cpno[1]) { $pdf->Ln(3); $pdf->SetX(134); $pdf->Cell(30, 0, $cpno[1], '0', 0, 'C', false); } } //----------------------------- Row 4 ---------------------------------- if ($n == 4) { //Birthday if ($bday != '0000-00-00') { $pdf->SetXY(73, 23); $pdf->Cell(50, 0, date('F d, Y', strtotime(date('F d, Y', strtotime($bday)))), '0', 0, 'C', false); } //Address $pdf->SetXY(83, 15); $addr = splitstroverflow(ucwords(strtolower(utf8_decode($address))), 28); $pdf->Cell(30, 0, $addr[0], '0', 0, 'C', false); //display text overflow if ($addr[1]) { $pdf->Ln(2.5); $pdf->SetX(83); $pdf->Cell(30, 0, $addr[1], '0', 0, 'C', false); } if ($addr[2]) { $pdf->Ln(2.5); $pdf->SetX(83); $pdf->Cell(30, 0, $addr[2], '0', 0, 'C', false); } if ($addr[3]) { $pdf->Ln(2.5); $pdf->SetX(3); $pdf->Cell(30, 0, $addr[3], '0', 0, 'C', false); } //Blood Type $pdf->SetXY(73, 28.3); $pdf->Cell(50, 0, strtoupper($blood_type), '0', 0, 'C', false); //GSIS $pdf->SetXY(73, 33); $pdf->Cell(50, 0, strtoupper($gsis), '0', 0, 'C', false); //PAGIBIG $pdf->SetXY(73, 38); $pdf->Cell(50, 0, strtoupper($pagibig), '0', 0, 'C', false); //PHILHEALTH $pdf->SetXY(73, 43.5); $pdf->Cell(50, 0, strtoupper($philhealth), '0', 0, 'C', false); //PHILHEALTH $pdf->SetXY(73, 48.5); $pdf->Cell(50, 0, strtoupper($tin), '0', 0, 'C', false); //in case of emergency $pdf->SetXY(61, 75.5); $pdf->Cell(60, 0, strtoupper($emergency), '0', 0, 'C', false); //CP No. $pdf->SetXY(76, 78); $cpno = splitstroverflow($contact, 13); $pdf->Cell(30, 0, $cpno[0], '0', 0, 'C', false); if ($cpno[1]) { $pdf->Ln(3); $pdf->SetX(76); $pdf->Cell(30, 0, $cpno[1], '0', 0, 'C', false); } } //----------------------------- Row 5 ---------------------------------- if ($n == 5) { //Birthday if ($bday != '0000-00-00') { $pdf->SetXY(15, 23); $pdf->Cell(50, 0, date('F d, Y', strtotime(date('F d, Y', strtotime($bday)))), '0', 0, 'C', false); } //Address $pdf->SetXY(25, 15); $addr = splitstroverflow(ucwords(strtolower(utf8_decode($address))), 28); $pdf->Cell(30, 0, $addr[0], '0', 0, 'C', false); //display text overflow if ($addr[1]) { $pdf->Ln(2.5); $pdf->SetX(25); $pdf->Cell(30, 0, $addr[1], '0', 0, 'C', false); } if ($addr[2]) { $pdf->Ln(2.5); $pdf->SetX(25); $pdf->Cell(30, 0, $addr[2], '0', 0, 'C', false); } if ($addr[3]) { $pdf->Ln(2.5); $pdf->SetX(25); $pdf->Cell(30, 0, $addr[3], '0', 0, 'C', false); } //Blood Type $pdf->SetXY(15, 28.3); $pdf->Cell(50, 0, strtoupper($blood_type), '0', 0, 'C', false); //GSIS $pdf->SetXY(15, 33); $pdf->Cell(50, 0, strtoupper($gsis), '0', 0, 'C', false); //PAGIBIG $pdf->SetXY(15, 38); $pdf->Cell(50, 0, strtoupper($pagibig), '0', 0, 'C', false); //PHILHEALTH $pdf->SetXY(15, 43.5); $pdf->Cell(50, 0, strtoupper($philhealth), '0', 0, 'C', false); //PHILHEALTH $pdf->SetXY(15, 48.5); $pdf->Cell(50, 0, strtoupper($tin), '0', 0, 'C', false); //in case of emergency $pdf->SetXY(3, 75.5); $pdf->Cell(60, 0, strtoupper($emergency), '0', 0, 'C', false); //CP No. $pdf->SetXY(18, 78); $cpno = splitstroverflow($contact, 13); $pdf->Cell(30, 0, $cpno[0], '0', 0, 'C', false); if ($cpno[1]) { $pdf->Ln(3); $pdf->SetX(18); $pdf->Cell(30, 0, $cpno[1], '0', 0, 'C', false); } } //======================== END Column 1 | Right to Left ============================== //======================== START Column 2 | Right to Left ============================== //----------------------------- Row 1 ---------------------------------- ///Birthday if ($n == 6) { //Birthday if ($bday != '0000-00-00') { $pdf->SetXY(247, 123.5); $pdf->Cell(50, 0, date('F d, Y', strtotime(date('F d, Y', strtotime($bday)))), '0', 0, 'C', false); } //Address $pdf->SetXY(257, 115); $addr = splitstroverflow(ucwords(strtolower(utf8_decode($address))), 28); $pdf->Cell(30, 0, $addr[0], '0', 0, 'C', false); //display text overflow if ($addr[1]) { $pdf->Ln(2.5); $pdf->SetX(257); $pdf->Cell(30, 0, $addr[1], '0', 0, 'C', false); } if ($addr[2]) { $pdf->Ln(2.5); $pdf->SetX(257); $pdf->Cell(30, 0, $addr[2], '0', 0, 'C', false); } if ($addr[3]) { $pdf->Ln(2.5); $pdf->SetX(257); $pdf->Cell(30, 0, $addr[3], '0', 0, 'C', false); } //Blood Type $pdf->SetXY(247, 128.5); $pdf->Cell(50, 0, strtoupper($blood_type), '0', 0, 'C', false); //GSIS $pdf->SetXY(247, 133.5); $pdf->Cell(50, 0, strtoupper($gsis), '0', 0, 'C', false); //PAGIBIG $pdf->SetXY(247, 138.5); $pdf->Cell(50, 0, strtoupper($pagibig), '0', 0, 'C', false); //PHILHEALTH $pdf->SetXY(247, 144); $pdf->Cell(50, 0, strtoupper($philhealth), '0', 0, 'C', false); //TIN $pdf->SetXY(247, 149); $pdf->Cell(50, 0, strtoupper($tin), '0', 0, 'C', false); //in case of emergency $pdf->SetXY(235, 176.3); $pdf->Cell(60, 0, strtoupper($emergency), '0', 0, 'C', false); //CP No. $pdf->SetXY(250, 178.5); $cpno = splitstroverflow($contact, 13); $pdf->Cell(30, 0, $cpno[0], '0', 0, 'C', false); if ($cpno[1]) { $pdf->Ln(3); $pdf->SetX(250); $pdf->Cell(30, 0, $cpno[1], '0', 0, 'C', false); } } //----------------------------- Row 2 ---------------------------------- //----------------------------- Row 2 ---------------------------------- if ($n == 7) { //Birthday if ($bday != '0000-00-00') { $pdf->SetXY(189, 123.5); $pdf->Cell(50, 0, date('F d, Y', strtotime(date('F d, Y', strtotime($bday)))), '0', 0, 'C', false); } //Address $pdf->SetXY(199, 115); $addr = splitstroverflow(ucwords(strtolower(utf8_decode($address))), 28); $pdf->Cell(30, 0, $addr[0], '0', 0, 'C', false); //display text overflow if ($addr[1]) { $pdf->Ln(2.5); $pdf->SetX(199); $pdf->Cell(30, 0, $addr[1], '0', 0, 'C', false); } if ($addr[2]) { $pdf->Ln(2.5); $pdf->SetX(199); $pdf->Cell(30, 0, $addr[2], '0', 0, 'C', false); } if ($addr[3]) { $pdf->Ln(2.5); $pdf->SetX(199); $pdf->Cell(30, 0, $addr[3], '0', 0, 'C', false); } //Blood Type $pdf->SetXY(189, 128.5); $pdf->Cell(50, 0, strtoupper($blood_type), '0', 0, 'C', false); //GSIS $pdf->SetXY(189, 133.5); $pdf->Cell(50, 0, strtoupper($gsis), '0', 0, 'C', false); //PAGIBIG $pdf->SetXY(189, 138.5); $pdf->Cell(50, 0, strtoupper($pagibig), '0', 0, 'C', false); //PHILHEALTH $pdf->SetXY(189, 144); $pdf->Cell(50, 0, strtoupper($philhealth), '0', 0, 'C', false); //tin $pdf->SetXY(189, 149); $pdf->Cell(50, 0, strtoupper($tin), '0', 0, 'C', false); //in case of emergency $pdf->SetXY(177, 176.3); $pdf->Cell(60, 0, strtoupper($emergency), '0', 0, 'C', false); //CP No. $pdf->SetXY(192, 178.5); $cpno = splitstroverflow($contact, 13); $pdf->Cell(30, 0, $cpno[0], '0', 0, 'C', false); if ($cpno[1]) { $pdf->Ln(3); $pdf->SetX(192); $pdf->Cell(30, 0, $cpno[1], '0', 0, 'C', false); } } //----------------------------- Row 3 ---------------------------------- if ($n == 8) { //Birthday if ($bday != '0000-00-00') { $pdf->SetXY(131, 123.5); $pdf->Cell(50, 0, date('F d, Y', strtotime(date('F d, Y', strtotime($bday)))), '0', 0, 'C', false); } //Address $pdf->SetXY(141, 115); $addr = splitstroverflow(ucwords(strtolower(utf8_decode($address))), 28); $pdf->Cell(30, 0, $addr[0], '0', 0, 'C', false); //display text overflow if ($addr[1]) { $pdf->Ln(2.5); $pdf->SetX(141); $pdf->Cell(30, 0, $addr[1], '0', 0, 'C', false); } if ($addr[2]) { $pdf->Ln(2.5); $pdf->SetX(141); $pdf->Cell(30, 0, $addr[2], '0', 0, 'C', false); } if ($addr[3]) { $pdf->Ln(2.5); $pdf->SetX(141); $pdf->Cell(30, 0, $addr[3], '0', 0, 'C', false); } //Blood Type $pdf->SetXY(131, 128.5); $pdf->Cell(50, 0, strtoupper($blood_type), '0', 0, 'C', false); //GSIS $pdf->SetXY(131, 133.5); $pdf->Cell(50, 0, strtoupper($gsis), '0', 0, 'C', false); //PAGIBIG $pdf->SetXY(131, 138.5); $pdf->Cell(50, 0, strtoupper($pagibig), '0', 0, 'C', false); //PHILHEALTH $pdf->SetXY(131, 144); $pdf->Cell(50, 0, strtoupper($philhealth), '0', 0, 'C', false); //PHILHEALTH $pdf->SetXY(131, 149); $pdf->Cell(50, 0, strtoupper($tin), '0', 0, 'C', false); //in case of emergency $pdf->SetXY(119, 176.3); $pdf->Cell(60, 0, strtoupper($emergency), '0', 0, 'C', false); //CP No. $pdf->SetXY(134, 178.5); $cpno = splitstroverflow($contact, 13); $pdf->Cell(30, 0, $cpno[0], '0', 0, 'C', false); if ($cpno[1]) { $pdf->Ln(3); $pdf->SetX(134); $pdf->Cell(30, 0, $cpno[1], '0', 0, 'C', false); } } //----------------------------- Row 4 ---------------------------------- if ($n == 9) { //Birthday if ($bday != '0000-00-00') { $pdf->SetXY(73, 123.5); $pdf->Cell(50, 0, date('F d, Y', strtotime(date('F d, Y', strtotime($bday)))), '0', 0, 'C', false); } //Address $pdf->SetXY(83, 115); $addr = splitstroverflow(ucwords(strtolower(utf8_decode($address))), 28); $pdf->Cell(30, 0, $addr[0], '0', 0, 'C', false); //display text overflow if ($addr[1]) { $pdf->Ln(2.5); $pdf->SetX(83); $pdf->Cell(30, 0, $addr[1], '0', 0, 'C', false); } if ($addr[2]) { $pdf->Ln(2.5); $pdf->SetX(83); $pdf->Cell(30, 0, $addr[2], '0', 0, 'C', false); } if ($addr[3]) { $pdf->Ln(2.5); $pdf->SetX(3); $pdf->Cell(30, 0, $addr[3], '0', 0, 'C', false); } //Blood Type $pdf->SetXY(73, 128.5); $pdf->Cell(50, 0, strtoupper($blood_type), '0', 0, 'C', false); //GSIS $pdf->SetXY(73, 133.5); $pdf->Cell(50, 0, strtoupper($gsis), '0', 0, 'C', false); //PAGIBIG $pdf->SetXY(73, 138.5); $pdf->Cell(50, 0, strtoupper($pagibig), '0', 0, 'C', false); //PHILHEALTH $pdf->SetXY(73, 144); $pdf->Cell(50, 0, strtoupper($philhealth), '0', 0, 'C', false); //PHILHEALTH $pdf->SetXY(73, 149); $pdf->Cell(50, 0, strtoupper($tin), '0', 0, 'C', false); //in case of emergency $pdf->SetXY(61, 176.3); $pdf->Cell(60, 0, strtoupper($emergency), '0', 0, 'C', false); //CP No. $pdf->SetXY(76, 178.5); $cpno = splitstroverflow($contact, 13); $pdf->Cell(30, 0, $cpno[0], '0', 0, 'C', false); if ($cpno[1]) { $pdf->Ln(3); $pdf->SetX(76); $pdf->Cell(30, 0, $cpno[1], '0', 0, 'C', false); } } //----------------------------- Row 5 ---------------------------------- if ($n == 10) { //Birthday if ($bday != '0000-00-00') { $pdf->SetXY(15, 123.5); $pdf->Cell(50, 0, date('F d, Y', strtotime(date('F d, Y', strtotime($bday)))), '0', 0, 'C', false); } //Address $pdf->SetXY(25, 115); $addr = splitstroverflow(ucwords(strtolower(utf8_decode($address))), 28); $pdf->Cell(30, 0, $addr[0], '0', 0, 'C', false); //display text overflow if ($addr[1]) { $pdf->Ln(2.5); $pdf->SetX(25); $pdf->Cell(30, 0, $addr[1], '0', 0, 'C', false); } if ($addr[2]) { $pdf->Ln(2.5); $pdf->SetX(25); $pdf->Cell(30, 0, $addr[2], '0', 0, 'C', false); } if ($addr[3]) { $pdf->Ln(2.5); $pdf->SetX(25); $pdf->Cell(30, 0, $addr[3], '0', 0, 'C', false); } //Blood Type $pdf->SetXY(15, 128.5); $pdf->Cell(50, 0, strtoupper($blood_type), '0', 0, 'C', false); //GSIS $pdf->SetXY(15, 133.5); $pdf->Cell(50, 0, strtoupper($gsis), '0', 0, 'C', false); //PAGIBIG $pdf->SetXY(15, 138.5); $pdf->Cell(50, 0, strtoupper($pagibig), '0', 0, 'C', false); //PHILHEALTH $pdf->SetXY(15, 144); $pdf->Cell(50, 0, strtoupper($philhealth), '0', 0, 'C', false); //tin $pdf->SetXY(15, 149); $pdf->Cell(50, 0, strtoupper($tin), '0', 0, 'C', false); //in case of emergency $pdf->SetXY(3, 176.3); $pdf->Cell(60, 0, strtoupper($emergency), '0', 0, 'C', false); //CP No. $pdf->SetXY(18, 178.5); $cpno = splitstroverflow($contact, 13); $pdf->Cell(30, 0, $cpno[0], '0', 0, 'C', false); if ($cpno[1]) { $pdf->Ln(3); $pdf->SetX(18); $pdf->Cell(30, 0, $cpno[1], '0', 0, 'C', false); } } //======================== END Column 2 | Right to Left ============================== $n++; } // Output $pdf->Output('pdf-report/back-id.pdf', 'F'); return 'pdf-report/back-id.pdf'; }
public function executeBatchPrintBadge(sfWebRequest $request) { $ids = $request->getParameter('ids'); // initiate FPDI $pdf = new FPDI('P', 'pt'); // set the sourcefile $pdf->setSourceFile(sfConfig::get('sf_upload_dir') . '/badges/ID_new.pdf'); foreach ($ids as $id) { $this->employee = EmployeePeer::retrieveByPk($id); // import page 1 $tplIdx = $pdf->importPage(1); // add a new page based on size of the badge $s = $pdf->getTemplatesize($tplIdx); $pdf->AddPage('P', array($s['w'], $s['h'])); $pdf->useTemplate($tplIdx); $pdf->setMargins(0, 0, 0, 0); $pdf->SetAutoPageBreak(false); if ($this->employee->getPicture()) { $pdf->Image(sfConfig::get('sf_upload_dir') . '/' . sfConfig::get('app_employee_images_dir') . '/' . $this->employee->getPicture(), 29.5, 25.5, 60.3, 74.3); } else { $pdf->Image(sfConfig::get('sf_upload_dir') . '/badges/picture_missing.jpg', 29.5, 25.5, 60.3, 74.3); } // now write some text above the imported page $pdf->SetFont('freesans', 'B', 12); $pdf->SetTextColor(82, 78, 134); $pdf->SetXY(22, 110); $pdf->Cell(0, 12, $this->employee->getFullName()); $pdf->Ln(); $pdf->SetX(22); $pdf->SetFont('freesans', 'BI', 10); $pdf->Cell(0, 14, $this->employee->getJob()); $pdf->SetDisplayMode('real'); } return $pdf->Output('newpdf.pdf', 'D'); }
require_once '../modelo/utilidades/Fpdf/fpdf.php'; require_once '../modelo/utilidades/Fpdi/fpdi.php'; //Get the base-64 string from data $filteredData = substr($_POST['img_val'], strpos($_POST['img_val'], ",") + 1); //Decode the string $unencodedData = base64_decode($filteredData); //Save the image file_put_contents('img.png', $unencodedData); //Show the image //echo '<img src="'.$_POST['img_val'].'" />'; $pdf = new FPDI(); $pdf->setSourceFile('TemplateReporte.pdf'); // seteamos la fuente, el estilo y el tamano $pdf->SetFont('Times', 'B', 10); // seteamos la posicion inicial $pdf->SetXY(25, 80); date_default_timezone_set('America/Bogota'); setlocale(LC_ALL, "es_ES"); $dias = array("Domingo", "Lunes", "Martes", "Miercoles", "Jueves", "Viernes", "Sábado"); $meses = array("Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"); //agregamos una pagina $pdf->AddPage(); $pdf->SetFont('Arial'); // seleccionamos la primera pagina del docuemnto importado $tplIdx = $pdf->importPage(1); // usamos la pagina importado como template $pdf->useTemplate($tplIdx); //seteamos la posicion X $pdf->SetX(25); //salto de linea $pdf->Ln(55.2);
{ if (!$value || !$key1 || !$key2) { return false; } $crypttext = base64_decode($value); $decrypttext = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key1, $crypttext, MCRYPT_MODE_ECB, $key2); return trim($decrypttext); } //loads the data from the table into the array $row $row = $results->fetchArray(); //print var_dump($row); //exit(); //instructions for where and how to place each piece of information on the pdf form //Name $pdf->SetFont('Arial'); $pdf->SetXY(36, 35.5); $pdf->Write(10, $row["FIRST_NAME"] . " " . $row["LAST_NAME"]); //Phone $pdf->SetXY(147, 35.5); $pdf->Write(10, $row["HOME_PHONE"]); //Cell Phone if (strlen($row["CELL_PHONE"]) > 3) { $pdf->SetXY(142, 42.2); $pdf->Write(10, $row["CELL_PHONE"]); } //Street Address $pdf->SetXY(27, 42.2); $pdf->Write(10, $row["ADDRESS"]); //Email $pdf->SetXY(136, 48.5); $pdf->Write(10, $row["EMAIL"]);
public function pdfImg($file) { require_once $_SERVER['DOCUMENT_ROOT'] . 'tyj_oa/Public/fpdf/fpdf.php'; require_once $_SERVER['DOCUMENT_ROOT'] . 'tyj_oa/Public/fpdi/fpdi.php'; $pdf = new FPDI(); $pageCount = $pdf->setSourceFile($file); for ($pageNo = 1; $pageNo <= $pageCount; $pageNo++) { $templateId = $pdf->importPage($pageNo); $size = $pdf->getTemplateSize($templateId); if ($size['w'] > $size['h']) { $pdf->AddPage('L', array($size['w'], $size['h'])); } else { $pdf->AddPage('P', array($size['w'], $size['h'])); } if ($pageNo == $pageCount) { $img = $_SERVER['DOCUMENT_ROOT'] . get_save_url() . D('user')->where('id = ' . get_user_id())->getField('pic_yin'); $pdf->Image($img, 150, 250, 0, 20); } $pdf->useTemplate($templateId); $pdf->SetFont('Helvetica'); $pdf->SetXY(5, 5); } $pdf->Output($file); }
} $pdf = new FPDI(); if ($user->getPrivilege() <= 10) { $source = "docs/certificatelead.pdf"; } else { $source = "docs/certificate.pdf"; } $pagecount = $pdf->setSourceFile($source); $tplidx = $pdf->importPage(1); $pdf->addPage('L'); $pdf->useTemplate($tplidx, 0, 0, 0); $date = date('jS F Y'); $pdf->AddFont('DejaVu', '', 'DejaVuSansCondensed.ttf', true); $pdf->SetFont('DejaVu', '', 30); $pdf->SetTextColor(0, 0, 0); $pdf->SetXY(0, 95); $pdf->Cell(297, 15, $name, 0, 0, 'C', 0); $pdf->SetFont('Arial', '', 18); $pdf->SetXY(170, 160); $pdf->Write(0, $date); $attachment = $pdf->output('Certificate.pdf', 'S'); header('Pragma: public'); header('Expires: -1'); header('Content-Transfer-Encoding: binary'); header('Content-Type: application/pdf'); header('Content-Disposition: attachment;filename="ISOS%20Certificate.pdf"'); header('Cache-Control: max-age=0'); // output the file echo $attachment; exit; break;
function cto_apps($id = '') { $c = CompensatoryTimeoff::find($id); $name = $this->Employee->get_employee_info($c->employee_id); $office_name = $this->Office->get_office_name($name['office_id']); $this->load->library('fpdf'); define('FPDF_FONTPATH', $this->config->item('fonts_path')); $this->load->library('fpdi'); $pdf = new FPDI('P', 'mm', 'Legal'); // add a page $pdf->AddPage(); // set the sourcefile $pdf->setSourceFile('dtr/template/app_for_offset.pdf'); // select the first page $tplIdx = $pdf->importPage(1); // use the page we imported $pdf->useTemplate($tplIdx); // set font, font style, font size. $pdf->SetFont('Arial', 'B', 12); // set initial placement $pdf->SetXY(158, 10.5); $pdf->Write(0, 'Tracking no: ' . $id); $pdf->Ln(9); $pdf->SetX(158); $pdf->Ln(20); // go to 25 X (indent) $pdf->SetX(12); $this->Office->fields = array('office_code'); $office = $this->Office->get_office_info($name['office_id']); // write office $pdf->SetFont('Arial', 'B', 10); $pdf->Write(0, $office['office_name']); $pdf->SetFont('Arial', 'B', 12); //lname $pdf->SetX(99); $pdf->Write(0, $name['lname']); //fname $pdf->SetX(145); $pdf->Write(0, $name['fname']); //mname $pdf->SetX(187); $pdf->Write(0, $name['mname'][0] . '.'); $pdf->Ln(10); //date of file $pdf->SetX(20); $pdf->Write(0, $c->date_file); //position $pdf->SetFont('Arial', 'B', 10); $pdf->SetX(63); $pdf->Write(0, $name['position']); $pdf->SetFont('Arial', 'B', 12); // We need to check what salary grade the office use if ($office['salary_grade_type'] == 'hospital') { $this->Salary_grade->salary_grade_type = 'hospital'; } //monthly salary $pdf->SetX(140); $pdf->Write(0, 'P ' . number_format($this->Salary_grade->get_monthly_salary($name['salary_grade'], $name['step']), 2)); $days = 'day'; if ($c->days > 1) { $days = 'days'; } $pdf->Ln(13); $pdf->SetX(30); $pdf->Write(0, $c->days . ' ' . $days); $pdf->SetX(140); //$pdf->Write(0, 'daily rate here'); $pdf->Ln(13); $pdf->SetX(50); $pdf->Write(0, $this->Helps->get_month_name($c->month) . ' ' . $c->dates . ', ' . $c->year); $cto_balances_as_of = date("F d, Y", strtotime($c->date_file . "-1 day")); $pdf->SetXY(30, 106); $pdf->Write(0, $cto_balances_as_of); // Compute balances // (balance + earn) - spent $cto = CompensatoryTimeoff::getBalance($c->employee_id); //$balance = $cto->days; $balance = $cto; $cto = CompensatoryTimeoff::getEarnedSpent($c->employee_id); //$earn = $cto->days; $earn = $cto; $cto = CompensatoryTimeoff::getEarnedSpent($c->employee_id, 'spent'); //$spent = $cto->days; $spent = $cto; $total_balance = $balance + $earn - $spent; $pdf->SetXY(35, 116); $pdf->Write(0, $total_balance); $pdf->SetX(87); $pdf->Write(0, ''); // hours here // Get office head $office = $this->Office->get_office_info($name['office_id']); // If detailed if ($name['detailed_office_id'] != 0) { $detailed_office = $this->Office->get_office_info($name['detailed_office_id']); $office['office_head'] = $detailed_office['office_head']; $office['position'] = $detailed_office['position']; } // If Employee is Department head $o = new Office_m(); $o->get_by_employee_id($c->employee_id); if ($o->exists()) { $office['office_head'] = 'CARMENCITA O. REYES'; $office['position'] = 'Governor'; } // We need to work out for this as exception if ($c->employee_id == '61') { $office['office_head'] = 'ANTONIO L. UY, JR. M.D.'; $office['position'] = 'Vice Governor'; } $pdf->Ln(6); $pdf->SetX(120); $pdf->Cell(73, 4, strtoupper($office['office_head']), '0', 0, 'C', FALSE); $pdf->Ln(5); $pdf->SetFont('Arial', '', 10); $pdf->SetX(120); $pdf->Cell(73, 4, $office['position'], '0', 0, 'C', FALSE); $pdf->SetFont('Arial', 'B', 12); // Statement of CTO signatory $statement_certified = Setting::getField('cto_certification'); $statement_certified_position = Setting::getField('cto_certification_position'); $pdf->Ln(5); $pdf->SetX(22); $pdf->Cell(73, 4, strtoupper($statement_certified), '0', 0, 'C', FALSE); $pdf->Ln(5); $pdf->SetFont('Arial', '', 10); $pdf->SetX(22); $pdf->Cell(73, 4, $statement_certified_position, '0', 0, 'C', FALSE); $pdf->SetFont('Arial', 'B', 12); // ====================Second Form ============= $pdf->Ln(44); $pdf->SetX(12); // write office $pdf->SetFont('Arial', 'B', 10); $pdf->Write(0, $office['office_name']); $pdf->SetFont('Arial', 'B', 12); //lname $pdf->SetX(99); $pdf->Write(0, $name['lname']); //fname $pdf->SetX(145); $pdf->Write(0, $name['fname']); //mname $pdf->SetX(187); $pdf->Write(0, $name['mname'][0] . '.'); $pdf->Ln(10); //date of file $pdf->SetX(20); $pdf->Write(0, $c->date_file); //position $pdf->SetFont('Arial', 'B', 10); $pdf->SetX(63); $pdf->Write(0, $name['position']); $pdf->SetFont('Arial', 'B', 12); //monthly salary $pdf->SetX(140); $pdf->Write(0, 'P ' . number_format($this->Salary_grade->get_monthly_salary($name['salary_grade'], $name['step']), 2)); $pdf->Ln(13); $pdf->SetX(30); $pdf->Write(0, $c->days . ' ' . $days); $pdf->SetX(140); //$pdf->Write(0, 'daily rate here'); $pdf->Ln(13); $pdf->SetX(50); $pdf->Write(0, $this->Helps->get_month_name($c->month) . ' ' . $c->dates . ', ' . $c->year); $cto_balances_as_of = date("F d, Y", strtotime($c->date_file . "-1 day")); $pdf->Ln(30); $pdf->SetX(30); //$pdf->Write(0, $cto_balances_as_of); $pdf->Ln(10); $pdf->SetX(35); //$pdf->Write(0, $total_balance); $pdf->Ln(6); $pdf->SetX(120); $pdf->Cell(73, 4, strtoupper($office['office_head']), '0', 0, 'C', FALSE); $pdf->Ln(5); $pdf->SetFont('Arial', '', 10); $pdf->SetX(120); $pdf->Cell(73, 4, $office['position'], '0', 0, 'C', FALSE); $pdf->SetFont('Arial', 'B', 12); $pdf->Ln(5); $pdf->SetX(22); $pdf->Cell(73, 4, strtoupper($statement_certified), '0', 0, 'C', FALSE); $pdf->Ln(5); $pdf->SetFont('Arial', '', 10); $pdf->SetX(22); $pdf->Cell(73, 4, $statement_certified_position, '0', 0, 'C', FALSE); $pdf->SetFont('Arial', 'B', 12); header('Cache-Control: maxage=3600'); //Adjust maxage appropriately header('Pragma: public'); $pdf->Output('dtr/reports/cto-apps-' . intval($c->employee_id) . '.pdf', 'I'); //return Redirect::to('dtr/reports/leave-apps-'.$rows['employee_id'].'.pdf', 'refresh'); }
function write_instruction($rec_ind, $q, $data) { // $ind = recipe index, $q = quote array, $data = recipe data array // Dynamic Data $bul = html_entity_decode("•", ENT_HTML401, "cp1252"); $deg = html_entity_decode("°", ENT_HTML401, "cp1252"); $recipe = $data[$rec_ind][0]; $style = $data[$rec_ind][1]; $og = $data[$rec_ind][2]; $fg = $data[$rec_ind][3]; $abv = $data[$rec_ind][4] . "%"; //$hop1 = $bul . " " . $data[$rec_ind][5]; if (empty($data[$rec_ind][5])) { $hop1 = ""; } else { $hop1 = $bul . " " . $data[$rec_ind][5]; } if (empty($data[$rec_ind][6])) { $hop2 = ""; } else { $hop2 = $bul . " " . $data[$rec_ind][6]; } if (empty($data[$rec_ind][7])) { $hop3 = ""; } else { $hop3 = $bul . " " . $data[$rec_ind][7]; } if (empty($data[$rec_ind][8])) { $hop4 = ""; } else { $hop4 = $bul . " " . $data[$rec_ind][8]; } if (empty($data[$rec_ind][9])) { $hop5 = ""; } else { $hop5 = $bul . " " . $data[$rec_ind][9]; } if (empty($data[$rec_ind][10])) { $hop6 = ""; } else { $hop6 = $bul . " " . $data[$rec_ind][10]; } if (empty($data[$rec_ind][11])) { $sp_inst = "No special instructions needed. Instead, we have included a quote about beer: \n" . $q[rand(0, 12)]; } else { $sp_inst = $data[$rec_ind][11]; } if (empty($data[$rec_ind][12])) { $ing1 = ""; } else { $ing1 = $bul . " " . $data[$rec_ind][12]; } if (empty($data[$rec_ind][13])) { $ing2 = ""; } else { $ing2 = $bul . " " . $data[$rec_ind][13]; } if (empty($data[$rec_ind][14])) { $ing3 = ""; } else { $ing3 = $bul . " " . $data[$rec_ind][14]; } if (empty($data[$rec_ind][15])) { $ing4 = ""; } else { $ing4 = $bul . " " . $data[$rec_ind][15]; } if (empty($data[$rec_ind][16])) { $ing5 = ""; } else { $ing5 = $bul . " " . $data[$rec_ind][16]; } if (empty($data[$rec_ind][17])) { $ing6 = ""; } else { $ing6 = $bul . " " . $data[$rec_ind][17]; } if (empty($data[$rec_ind][18])) { $ing7 = ""; } else { $ing7 = $bul . " " . $data[$rec_ind][18]; } if (empty($data[$rec_ind][19])) { $ing8 = ""; } else { $ing8 = $bul . " " . $data[$rec_ind][19]; } if (empty($data[$rec_ind][20])) { $ing9 = ""; } else { $ing9 = $bul . " " . $data[$rec_ind][20]; } if (empty($data[$rec_ind][21])) { $ing10 = ""; } else { $ing10 = $bul . " " . $data[$rec_ind][21]; } if (empty($data[$rec_ind][22])) { $ing11 = ""; } else { $ing11 = $bul . " " . $data[$rec_ind][22]; } if (empty($data[$rec_ind][23])) { $ing12 = ""; } else { $ing12 = $bul . " " . $data[$rec_ind][23]; } if (empty($data[$rec_ind][24])) { $ing13 = ""; } else { $ing13 = $bul . " " . $data[$rec_ind][24]; } if (empty($data[$rec_ind][25])) { $ing14 = ""; } else { $ing14 = $bul . " " . $data[$rec_ind][25]; } if (empty($data[$rec_ind][26])) { $ing15 = ""; } else { $ing15 = $bul . " " . $data[$rec_ind][26]; } if (empty($data[$rec_ind][27])) { $ing16 = ""; } else { $ing16 = $bul . " " . $data[$rec_ind][27]; } if (empty($data[$rec_ind][28])) { $ing17 = ""; } else { $ing17 = $bul . " " . $data[$rec_ind][28]; } if (empty($data[$rec_ind][29])) { $ing18 = ""; } else { $ing18 = $bul . " " . $data[$rec_ind][29]; } // Initiate FPDI & FPDF $pdf = new FPDI(); $pdf->setSourceFile("extract_template.pdf"); // Create page 1 & Read Template Page 1 $pdf->AddPage('P', 'Letter'); $tmp = $pdf->importPage(1); $pdf->useTemplate($tmp, 0, 0); // Declare Fonts $pdf->AddFont('Kenyancoffee', '', 'Kenyancoffeerg.php'); $pdf->AddFont('Roboto', '', 'Roboto-Regular.php'); $pdf->AddFont('Roboto', 'L', 'Roboto-Light.php'); $pdf->AddFont('Roboto', 'B', 'Roboto-Bold.php'); // Write Dynamic Data - Header $pdf->SetFont('Kenyancoffee', '', 23); $pdf->SetTextColor(229, 80, 84); $pdf->SetXY(57.3, 19); $pdf->Cell(0, 0, $recipe); $pdf->SetFont('Roboto', 'L', 9.9); $pdf->SetTextColor(0, 0, 0); $pdf->SetXY(57.3, 25.5); $pdf->Cell(0, 0, $style); $pdf->SetFont('Roboto', 'L', 9.9); $pdf->SetTextColor(0, 0, 0); $pdf->SetXY(65.2, 36.2); $pdf->Cell(0, 0, $og); $pdf->SetFont('Roboto', 'L', 9.9); $pdf->SetTextColor(0, 0, 0); $pdf->SetXY(85.2, 36.2); $pdf->Cell(0, 0, $fg); $pdf->SetFont('Roboto', 'L', 9.9); $pdf->SetTextColor(0, 0, 0); $pdf->SetXY(108.5, 36.2); $pdf->Cell(0, 0, $abv); // Write Dynamic Data - Ingredients $pdf->SetFont('Roboto', 'B', 7.5); $pdf->SetTextColor(255, 255, 255); $pdf->SetXY(5.3, 156.5); $pdf->Cell(0, 0, $ing1); $pdf->SetFont('Roboto', 'B', 7.5); $pdf->SetTextColor(255, 255, 255); $pdf->SetXY(5.3, 161.5); $pdf->Cell(0, 0, $ing2); $pdf->SetFont('Roboto', 'B', 7.5); $pdf->SetTextColor(255, 255, 255); $pdf->SetXY(5.3, 166.5); $pdf->Cell(0, 0, $ing3); $pdf->SetFont('Roboto', 'B', 7.5); $pdf->SetTextColor(255, 255, 255); $pdf->SetXY(5.3, 171.5); $pdf->Cell(0, 0, $ing4); $pdf->SetFont('Roboto', 'B', 7.5); $pdf->SetTextColor(255, 255, 255); $pdf->SetXY(5.3, 176.5); $pdf->Cell(0, 0, $ing5); $pdf->SetFont('Roboto', 'B', 7.5); $pdf->SetTextColor(255, 255, 255); $pdf->SetXY(5.3, 181.5); $pdf->Cell(0, 0, $ing6); $pdf->SetFont('Roboto', 'B', 7.5); $pdf->SetTextColor(255, 255, 255); $pdf->SetXY(5.3, 186.5); $pdf->Cell(0, 0, $ing7); $pdf->SetFont('Roboto', 'B', 7.5); $pdf->SetTextColor(255, 255, 255); $pdf->SetXY(5.3, 191.5); $pdf->Cell(0, 0, $ing8); $pdf->SetFont('Roboto', 'B', 7.5); $pdf->SetTextColor(255, 255, 255); $pdf->SetXY(5.3, 196.5); $pdf->Cell(0, 0, $ing9); $pdf->SetFont('Roboto', 'B', 7.5); $pdf->SetTextColor(255, 255, 255); $pdf->SetXY(5.3, 201.5); $pdf->Cell(0, 0, $ing10); $pdf->SetFont('Roboto', 'B', 7.5); $pdf->SetTextColor(255, 255, 255); $pdf->SetXY(5.3, 206.5); $pdf->Cell(0, 0, $ing11); $pdf->SetFont('Roboto', 'B', 7.5); $pdf->SetTextColor(255, 255, 255); $pdf->SetXY(5.3, 211.5); $pdf->Cell(0, 0, $ing12); $pdf->SetFont('Roboto', 'B', 7.5); $pdf->SetTextColor(255, 255, 255); $pdf->SetXY(5.3, 216.5); $pdf->Cell(0, 0, $ing13); $pdf->SetFont('Roboto', 'B', 7.5); $pdf->SetTextColor(255, 255, 255); $pdf->SetXY(5.3, 221.5); $pdf->Cell(0, 0, $ing14); $pdf->SetFont('Roboto', 'B', 7.5); $pdf->SetTextColor(255, 255, 255); $pdf->SetXY(5.3, 226.5); $pdf->Cell(0, 0, $ing15); $pdf->SetFont('Roboto', 'B', 7.5); $pdf->SetTextColor(255, 255, 255); $pdf->SetXY(5.3, 231.5); $pdf->Cell(0, 0, $ing16); $pdf->SetFont('Roboto', 'B', 7.5); $pdf->SetTextColor(255, 255, 255); $pdf->SetXY(5.3, 236.5); $pdf->Cell(0, 0, $ing17); $pdf->SetFont('Roboto', 'B', 7.5); $pdf->SetTextColor(255, 255, 255); $pdf->SetXY(5.3, 241.5); $pdf->Cell(0, 0, $ing18); // Write Dynamic Data - Hop Schedule $pdf->SetFont('Roboto', '', 7.5); $pdf->SetTextColor(0, 0, 0); $pdf->SetXY(114, 171); $pdf->Cell(0, 0, $hop1); $pdf->SetFont('Roboto', '', 7.5); $pdf->SetTextColor(0, 0, 0); $pdf->SetXY(114, 174.2); $pdf->Cell(0, 0, $hop2); $pdf->SetFont('Roboto', '', 7.5); $pdf->SetTextColor(0, 0, 0); $pdf->SetXY(114, 177.4); $pdf->Cell(0, 0, $hop3); $pdf->SetFont('Roboto', '', 7.5); $pdf->SetTextColor(0, 0, 0); $pdf->SetXY(114, 180.6); $pdf->Cell(0, 0, $hop4); $pdf->SetFont('Roboto', '', 7.5); $pdf->SetTextColor(0, 0, 0); $pdf->SetXY(114, 183.8); $pdf->Cell(0, 0, $hop5); $pdf->SetFont('Roboto', '', 7.5); $pdf->SetTextColor(0, 0, 0); $pdf->SetXY(114, 187); $pdf->Cell(0, 0, $hop6); // Create page 2 & Read Template Page 2 $pdf->AddPage('P', 'Letter'); $tmp = $pdf->importPage(2); $pdf->useTemplate($tmp, 0, 0); // Write Dynamic Data - Special Instructions $pdf->SetFont('Roboto', '', 7.5); $pdf->SetTextColor(255, 255, 255); $pdf->SetXY(11, 13); $pdf->MultiCell(165, 3, utf8_decode($sp_inst)); $shortname = str_replace(' ', '', $recipe); $filename = "C:/Users/tyler/Google Drive/MonsterBrew/Product/Recipe Kits/Instructions/Instructions - Extract/EX_INS_" . $shortname . ".pdf"; $pdf->Output($filename, 'F'); }
<?php if (@$_POST['id_certificado']) { global $wpdb; $certificado = $wpdb->get_row($wpdb->prepare("SELECT c.id as id, c.nome as nome, e.id as evento_id FROM participantes c INNER JOIN " . "evento e ON (e.id = c.evento_id) WHERE c.id=%d", $_POST['id_certificado'])); require get_stylesheet_directory() . '/inc/fpdf/fpdf.php'; require get_stylesheet_directory() . '/inc/fpdf/fpdi.php'; $pdf = new FPDI('L', 'mm', "A4"); $pdf->setSourceFile(get_stylesheet_directory() . "/certificados/evento_" . $certificado->evento_id . ".pdf"); $pdf->AddPage('L'); $tplidx = $pdf->importPage(1, '/MediaBox'); $pdf->useTemplate($tplidx, 0, 0, 297, 210, true); $pdf->SetXY(10, 85); //Informamos a fonte, seu estilo e seu tamanho $pdf->SetFont('Arial', '', 28); $pdf->Cell(0, 8, iconv("UTF-8", "CP1252", $certificado->nome), 0, 1, 'C'); $arquivo_certificado = preg_replace('/[^A-Za-z0-9\\-]/', '', str_replace(" ", "_", $certificado->nome)) . ".pdf"; $pdf->Output($arquivo_certificado, 'D'); $wpdb->query($wpdb->prepare("UPDATE participantes SET data_geracao = CURRENT_TIMESTAMP WHERE id=%d", $_POST['id_certificado'])); } get_header(); ?> <section> <div class="container mt-lg mb-lg"> <?php if (have_posts()) { ?> <?php while (have_posts()) { the_post();
// $pdf->setSourceFile('blank/bso3.pdf'); // // Указываем номер импортируемой страницы // $tplIdx = $pdf->importPage(1); // //указываем размер страницы // //$pdf->useTemplate($tplIdx, 0, 0, 210, 297, true); // $pdf->useTemplate($tplIdx, 0, 0, 210, 297, true); //Ставим поля по нулям $pdf->SetMargins(0, 0, 0, 0); $pdf->SetAutoPageBreak(false); //указываем шрифт и размер $pdf->SetFont('Arial-BoldMT', '', '13'); //указываем цвет текста $pdf->SetTextColor(0, 0, 0); ////////////////////////////////////////////////////////Добавляем данные в полис////////////////////////////// //Время начала действия договора $pdf->SetXY(120.8, 42.5); $pdf->Write(0, $contract_data['start_time'][0]); $pdf->SetXY(125.8, 42.5); $pdf->Write(0, $contract_data['start_time'][1]); $pdf->SetXY(137.3, 42.5); $pdf->Write(0, $contract_data['start_time'][3]); $pdf->SetXY(142.3, 42.5); $pdf->Write(0, $contract_data['start_time'][4]); //Дата начала $pdf->SetXY(156, 42.5); $pdf->Write(0, $contract_data['start_date'][0]); $pdf->SetXY(161, 42.5); $pdf->Write(0, $contract_data['start_date'][1]); $pdf->SetXY(168.7, 42.5); $pdf->Write(0, $contract_data['start_date'][3]); $pdf->SetXY(173.9, 42.5);
else $pdf = new FPDI(); $pdf->setSourceFile(DATA_AVISO_OBRA_PATH.$_REQUEST["filename"].".".$_REQUEST["extension"]); $pdf->AddPage(); $tplIdx = $pdf->importPage(1); $pdf->useTemplate($tplIdx); $_REQUEST["x"] = $_REQUEST["x"] * 0.686; $_REQUEST["y"] = $_REQUEST["y"] * 0.728; if ($_REQUEST["tipoSello"] == "n") { $pdf->SetFont("Arial", "B", 14); $pdf->SetTextColor(0, 0, 0); $pdf->SetXY($_REQUEST["x"] + 8, $_REQUEST["y"] + 18); $pdf->Cell(0, 0, "NO CORRESPONDE PRESENTACIÓN"); $pdf->SetXY($_REQUEST["x"] + 11, $_REQUEST["y"] + 24); $pdf->Cell(0, 0, "POR ACTIVIDAD DESARROLLADA"); } else { $pdf->SetFont("Arial", "B", 16); switch ($_REQUEST["tipoSello"]) { case "e": $pdf->SetDrawColor(0, 0, 196); $pdf->SetTextColor(0, 0, 196); break; case "h": $pdf->SetDrawColor(196, 0, 0); $pdf->SetTextColor(196, 0, 0); break;
require_once 'fpdf.php'; require_once 'pdf/fpdi.php'; // initiate FPDI $pdf = new FPDI(); // add a page $pdf->AddPage(); // set the sourcefile $pdf->setSourceFile('Guía de Traslado.pdf'); // import page 1 $tplIdx = $pdf->importPage(1); // use the imported page and place it at point 10,10 with a width of 100 mm $pdf->useTemplate($tplIdx, 0, 0, null); // now write some text above the imported page $pdf->SetFont('Arial', '', 10); $pdf->SetTextColor(255, 0, 0); $pdf->SetXY(40, 31); $pdf->Write(0, "Establecimiento"); $pdf->SetXY(40, 35); $pdf->Write(0, "HEYMAN GRACIELA BEATRIZ"); $pdf->SetXY(40, 39); $pdf->Write(0, "HEYMAN GRACIELA BEATRIZ"); $pdf->SetXY(40, 43); $pdf->Write(0, "27059421862"); $pdf->SetXY(40, 47); $pdf->Write(0, "CHA.72 PC.12 PARQUE INDUSTRIAL"); $pdf->SetXY(40, 51); $pdf->Write(0, "General Guemes"); $pdf->SetXY(40, 55); $pdf->Write(0, "Chaco"); $pdf->SetFont('Arial', '', 8); $pdf->SetXY(16, 35);
function ten_tardiness_second($second_offenders = array()) { $this->load->library('fpdf'); define('FPDF_FONTPATH', $this->config->item('fonts_path')); $this->load->library('fpdi'); // initiate FPDI $pdf = new FPDI('P', 'mm', 'Legal'); $pdf->SetLeftMargin(20); $pdf->SetRightMargin(15); // add a page $pdf->AddPage(); // set the sourcefile $pdf->setSourceFile('dtr/template/notice2nd.pdf'); // select the first page $tplIdx = $pdf->importPage(1); // use the page we imported $pdf->useTemplate($tplIdx); $offices = Input::get('offices'); $office_id = $offices[0]; $m1 = 'Jul'; $m2 = 'Aug'; $m3 = 'Sep'; $m4 = 'Oct'; $m5 = 'Nov'; $m6 = 'Dec'; $mo1 = '07'; $mo2 = '08'; $mo3 = '09'; $mo4 = '10'; $mo5 = '11'; $mo6 = '12'; $pdf->SetFont('Arial', '', '12'); $pdf->SetXY(155, 50); $pdf->Write(0, date('F d, Y')); $pdf->SetX(35); $pdf->SetFont('Arial', 'B', ''); $pdf->Cell(0, 6, "HON. EDWARD S. HAGEDORN ", '', 1, 'L', FALSE); $pdf->SetFont('Arial', '', ''); $pdf->SetX(35); $pdf->Cell(0, 6, "City Mayor", '', 1, 'L', FALSE); $pdf->SetX(35); $pdf->Cell(0, 6, "Puerto Princesa City", '', 1, 'L', FALSE); $pdf->Cell(0, 6, "", '', 1, 'C', FALSE); $pdf->Cell(0, 6, "Thru: ATTY. SHIRLEY R. DAGANTA", '', 1, 'C', FALSE); $pdf->Cell(0, 6, "CG Assistant Dept. Head II", '', 1, 'C', FALSE); $pdf->Cell(0, 6, "Assistant City Legal Officer II", '', 1, 'C', FALSE); $pdf->Ln(12); $pdf->SetX(35); $pdf->SetFont('Arial', 'B', ''); $pdf->Write(0, 'Madam:'); $pdf->SetFont('Arial', '', ''); $pdf->Ln(6); $pdf->SetX(35); $pdf->MultiCell(0, 6, " Please be informed that despite the first notice issued to him/her as per records in this office, it has been observed that the he/she has continuously incurred the following tardiness and undertime, viz:", 0, 'L', false); //$pdf->SetX(35); //$pdf->Cell(0,6," $number of your employees has incurred the following, viz:",'',0,'L',false); $pdf->SetFont('Arial', 'BI', 10); $pdf->Ln(2); $pdf->SetFillColor(210, 210, 210); //$pdf->SetX(20); //header $pdf->Cell(50, 8, "Name", 'RLTB', 0, 'C', 1); $pdf->Cell(20, 4, $m1, '1', 0, 'C', 1); $pdf->Cell(20, 4, $m2, '1', 0, 'C', 1); $pdf->Cell(20, 4, $m3, '1', 0, 'C', 1); $pdf->Cell(20, 4, $m4, '1', 0, 'C', 1); $pdf->Cell(20, 4, $m5, '1', 0, 'C', 1); $pdf->Cell(20, 4, $m6, '1', 1, 'C', 1); $pdf->SetFont('Arial', '', 9); $pdf->SetFillColor(240, 240, 240); $pdf->Cell(50, 4, "", 'RLB', 0, 'C', false); $pdf->Cell(10, 4, "Tardy", '1', 0, 'C', 1); $pdf->Cell(10, 4, "UT", '1', 0, 'C', 1); $pdf->Cell(10, 4, "Tardy", '1', 0, 'C', 1); $pdf->Cell(10, 4, "UT", '1', 0, 'C', 1); $pdf->Cell(10, 4, "Tardy", '1', 0, 'C', 1); $pdf->Cell(10, 4, "UT", '1', 0, 'C', 1); $pdf->Cell(10, 4, "Tardy", '1', 0, 'C', 1); $pdf->Cell(10, 4, "UT", '1', 0, 'C', 1); $pdf->Cell(10, 4, "Tardy", '1', 0, 'C', 1); $pdf->Cell(10, 4, "UT", '1', 0, 'C', 1); $pdf->Cell(10, 4, "Tardy", '1', 0, 'C', 1); $pdf->Cell(10, 4, "UT", '1', 1, 'C', 1); $pdf->SetFillColor(215, 255, 215); $year1 = Input::get('year'); $tardis = $second_offenders; if (is_array($tardis)) { foreach ($tardis as $tardi) { $name = $this->Employee->get_employee_info($tardi, $field = ''); $late1 = $this->Tardiness->count_late($name['employee_id'], $mo1, $year1, 1, 3); $late2 = $this->Tardiness->count_late($name['employee_id'], $mo2, $year1, 1, 3); $late3 = $this->Tardiness->count_late($name['employee_id'], $mo3, $year1, 1, 3); $late4 = $this->Tardiness->count_late($name['employee_id'], $mo4, $year1, 1, 3); $late5 = $this->Tardiness->count_late($name['employee_id'], $mo5, $year1, 1, 3); $late6 = $this->Tardiness->count_late($name['employee_id'], $mo6, $year1, 1, 3); $under_time1 = $this->Tardiness->count_late($name['employee_id'], $mo1, $year1, 2, 4); $under_time2 = $this->Tardiness->count_late($name['employee_id'], $mo2, $year1, 2, 4); $under_time3 = $this->Tardiness->count_late($name['employee_id'], $mo3, $year1, 2, 4); $under_time4 = $this->Tardiness->count_late($name['employee_id'], $mo4, $year1, 2, 4); $under_time5 = $this->Tardiness->count_late($name['employee_id'], $mo5, $year1, 2, 4); $under_time6 = $this->Tardiness->count_late($name['employee_id'], $mo6, $year1, 2, 4); $late1['tardi_count'] = $this->Tardiness->is_tardy_zero($late1['tardi_count']); $late2['tardi_count'] = $this->Tardiness->is_tardy_zero($late2['tardi_count']); $late3['tardi_count'] = $this->Tardiness->is_tardy_zero($late3['tardi_count']); $late4['tardi_count'] = $this->Tardiness->is_tardy_zero($late4['tardi_count']); $late5['tardi_count'] = $this->Tardiness->is_tardy_zero($late5['tardi_count']); $late6['tardi_count'] = $this->Tardiness->is_tardy_zero($late6['tardi_count']); $under_time1['tardi_count'] = $this->Tardiness->is_tardy_zero($under_time1['tardi_count']); $under_time2['tardi_count'] = $this->Tardiness->is_tardy_zero($under_time2['tardi_count']); $under_time3['tardi_count'] = $this->Tardiness->is_tardy_zero($under_time3['tardi_count']); $under_time4['tardi_count'] = $this->Tardiness->is_tardy_zero($under_time4['tardi_count']); $under_time5['tardi_count'] = $this->Tardiness->is_tardy_zero($under_time5['tardi_count']); $under_time6['tardi_count'] = $this->Tardiness->is_tardy_zero($under_time6['tardi_count']); //start employee tardy $pdf->Cell(50, 4, ucwords(strtolower(utf8_decode($name['fname'] . ' ' . $name['mname'] . ' ' . $name['lname']))), 'RLTB', 0, 'L', false); $pdf->Cell(10, 4, $late1['tardi_count'], '1', 0, 'C', FALSE); $pdf->Cell(10, 4, $under_time1['tardi_count'], '1', 0, 'C', FALSE); $pdf->Cell(10, 4, $late2['tardi_count'], '1', 0, 'C', FALSE); $pdf->Cell(10, 4, $under_time2['tardi_count'], '1', 0, 'C', FALSE); $pdf->Cell(10, 4, $late3['tardi_count'], '1', 0, 'C', FALSE); $pdf->Cell(10, 4, $under_time3['tardi_count'], '1', 0, 'C', FALSE); $pdf->Cell(10, 4, $late4['tardi_count'], '1', 0, 'C', FALSE); $pdf->Cell(10, 4, $under_time4['tardi_count'], '1', 0, 'C', FALSE); $pdf->Cell(10, 4, $late5['tardi_count'], '1', 0, 'C', FALSE); $pdf->Cell(10, 4, $under_time5['tardi_count'], '1', 0, 'C', FALSE); $pdf->Cell(10, 4, $late6['tardi_count'], '1', 0, 'C', FALSE); $pdf->Cell(10, 4, $under_time6['tardi_count'], '1', 1, 'C', FALSE); } } $pdf->Cell(50, 4, "", 'RLTB', 0, 'L', FALSE); $pdf->Cell(10, 4, "", '1', 0, 'C', FALSE); $pdf->Cell(10, 4, "", '1', 0, 'C', FALSE); $pdf->Cell(10, 4, "", '1', 0, 'C', FALSE); $pdf->Cell(10, 4, "", '1', 0, 'C', FALSE); $pdf->Cell(10, 4, "", '1', 0, 'C', FALSE); $pdf->Cell(10, 4, "", '1', 0, 'C', FALSE); $pdf->Cell(10, 4, "", '1', 0, 'C', FALSE); $pdf->Cell(10, 4, "", '1', 0, 'C', FALSE); $pdf->Cell(10, 4, "", '1', 0, 'C', FALSE); $pdf->Cell(10, 4, "", '1', 0, 'C', FALSE); $pdf->Cell(10, 4, "", '1', 0, 'C', FALSE); $pdf->Cell(10, 4, "", '1', 1, 'C', FALSE); // line break $pdf->Ln(5); $pdf->SetFont('Arial', '', '12'); $pdf->SetX(35); $pdf->MultiCell(0, 6, " Section 8, Rule XVII of the Omnibus Rules Implementing Book V of Executive Order No. 292, states that: \n\t\t\t\t 'Officers and employees who have incurred tardiness and undertime, regardless of the number of minutes per day, ten (10) times a month for at least two (2) consecutive months during the year or for at least two (2) months in a semester shall be subject to disciplinary action.'\n\t\t\t\t Violation of the said rule carries the following penalties:\n\t\t\n\t\t\t\t 1.\tFirst Offense - Reprimand;\n\t\t\t\t 2.\tSecond Offense - Suspension for one (1) day to thirty (30) days; and\n\t\t\t\t 3.\tThird Offense - Dismissal.\n\t\t\n\t\t\t\t For your appropriate action.\n\t\t", '', 1, 'L', false); $pdf->Cell(0, 6, " Very truly yours, ", 0, 'R', FALSE); $pdf->Cell(0, 6, " ", '', 1, 'R', FALSE); $pdf->Cell(0, 6, " ", '', 1, 'R', FALSE); $pdf->SetFont('Arial', 'B', ''); $pdf->Cell(0, 6, " FELIMON R. SABAS ", '', 1, 'R', FALSE); $pdf->SetFont('Arial', '', ''); $pdf->Cell(0, 6, " CG Department Head II ", '', 1, 'R', FALSE); $pdf->Cell(0, 6, " (City Personnel Officer) ", '', 1, 'R', FALSE); $pdf->MultiCell(0, 6, "\n\t\tNOTED:\n\t\t\n\t\tBY AUTHORITY OF THE CITY MAYOR:", 0, 'L', FALSE); $pdf->SetFont('Arial', 'B', ''); $pdf->Cell(0, 6, " ATTY. AGUSTIN M. ROCAMORA", '', 1, 'L', FALSE); $pdf->SetFont('Arial', '', ''); $pdf->Cell(0, 6, " City Administrator II", '', 1, 'L', FALSE); header('Cache-Control: maxage=3600'); //Adjust maxage appropriately header('Pragma: public'); //If the parameter is D = download F = save as file $pdf->Output('dtr/reports/ten_tardiness_second.pdf', 'F'); }
/** * Creates a PDF form for the copy center to print * * @param unknown $context * @param unknown $exam * @param unknown $userrequests * @param unknown $useraccepts * @param unknown $category * @param unknown $totalpages * @param unknown $course */ function emarking_create_printform($context, $exam, $userrequests, $useraccepts, $category, $course) { global $CFG; require_once $CFG->dirroot . "/mod/assign/feedback/editpdf/fpdi/fpdi2tcpdf_bridge.php"; require_once $CFG->dirroot . "/mod/assign/feedback/editpdf/fpdi/fpdi.php"; $originalsheets = $exam->totalpages + $exam->extrasheets; $copies = $exam->totalstudents + $exam->extraexams; $totalpages = emarking_exam_total_pages_to_print($exam); $pdf = new FPDI(); $pdf->setSourceFile($CFG->dirroot . "/mod/emarking/img/printformtemplate.pdf"); // Adds the form page from the template $pdf->AddPage(); $tplIdx = $pdf->importPage(1); $pdf->useTemplate($tplIdx, 0, 0, 0, 0, $adjustPageSize = true); // Copy / Printing $pdf->SetXY(32, 48.5); $pdf->Write(1, "x"); // Date $pdf->SetXY(153, 56); $pdf->Write(1, core_text::strtoupper(date('d'))); $pdf->SetXY(163, 56); $pdf->Write(1, core_text::strtoupper(date('m'))); $pdf->SetXY(173, 56); $pdf->Write(1, core_text::strtoupper(date('Y'))); // Requested by $pdf->SetXY(95, 69); $pdf->Write(1, core_text::strtoupper($useraccepts->firstname . " " . $useraccepts->lastname)); // Cost center $pdf->SetXY(95, 75.5); $pdf->Write(1, core_text::strtoupper($category->idnumber)); // UAI campus $pdf->SetXY(95, 80.8); $pdf->Write(1, core_text::strtoupper("")); // Originals $pdf->SetXY(35, 106.5); $pdf->Write(1, core_text::strtoupper($originalsheets)); // Copies $pdf->SetXY(60, 106.5); $pdf->Write(1, core_text::strtoupper("--")); // Number of printings $pdf->SetXY(84, 106.5); $pdf->Write(1, core_text::strtoupper($copies)); // Black and white $pdf->SetXY(106, 106.5); $pdf->Write(1, "x"); // Total pages $pdf->SetXY(135, 106.5); $pdf->Write(1, core_text::strtoupper($totalpages)); // Number of printings Total $pdf->SetXY(84, 133.8); $pdf->Write(1, core_text::strtoupper("")); // Total pages Total $pdf->SetXY(135, 133.8); $pdf->Write(1, core_text::strtoupper("")); // Páginas totales Total $pdf->SetXY(43, 146); $pdf->Write(1, core_text::strtoupper($course->fullname . " , " . $exam->name)); // Recepcionado por Nombre $pdf->SetXY(30, 164.5); $pdf->Write(1, core_text::strtoupper("")); // Recepcionado por RUT $pdf->SetXY(127, 164.5); $pdf->Write(1, core_text::strtoupper("")); $pdf->Output("PrintForm" . $exam->id . ".pdf", "I"); // se genera el nuevo pdf }
} // use the imported page $pdf->useTemplate($templateId); $pdf->SetAutoPageBreak(false); //$db = new SQLite3('/home1/columch7/public_html/Columbia.db'); $db = new SQLite3($columbiaDB); $ID = $_GET["ID"]; $AUTH = $_GET["AUTH"]; $results = $db->query('SELECT * FROM benton_new_patients where ID =' . $ID . ' and AUTH = ' . $AUTH); //$results = $db->query('SELECT * FROM Pasco_new_patients where ID=24'); $row = $results->fetchArray(); //print var_dump($row); //exit(); //Name $pdf->SetFont('Helvetica'); $pdf->SetXY(36, 36.5); $pdf->Write(10, $row["FIRST_NAME"] . " " . $row["LAST_NAME"]); //Phone if (strlen($row["PHONE"]) > 4) { $pdf->SetXY(150, 36.5); $pdf->Write(10, $row["PHONE"]); } //Cell Phone if (strlen($row["CELL_PHONE"]) > 4) { $pdf->SetXY(150, 43); $pdf->Write(10, $row["CELL_PHONE"]); } //Street Address $pdf->SetXY(25, 43); $pdf->Write(10, $row["ADDRESS"]); //Email
private function _generatePdfSamplePage($filePath) { //error_reporting(E_ALL); //Zend_Loader::registerAutoload(false); //require_once('TCPDF.php'); require_once 'PdfTool/fpdf/fpdf.php'; require_once 'PdfTool/fpdi/fpdi.php'; // initiate FPDI $pdf = new FPDI(); // add a page $pdf->AddPage(); // set the sourcefile $pageCount = $pdf->setSourceFile($filePath); //print_r($pageCount); //die(); // import page 1 $tplIdx = $pdf->importPage(1); // use the imported page and place it at point 10,10 with a width of 100 mm $pdf->useTemplate($tplIdx, 10, 10, 100); // now write some text above the imported page $pdf->SetFont('Arial'); $pdf->SetTextColor(255, 0, 0); $pdf->SetXY(10, 10); $pdf->Write(0, "SAMPLE FOR VIEWING ONLY"); $pdf->Output('sample.pdf', 'I'); /*$pdf=new FPDF(); $pdf->AddPage(); $pdf->SetFont('Arial','B',16); $pdf->Cell(40,10,'Hello World!'); $pdf->Output();*/ die; }
function preview($rows, $report_name = '') { $html = ' <table width="100%" border="0"> <tr> <td colspan="3" align="center">' . $report_name . '</td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> </table> <table width="100%" border="1"> <tbody><tr> <td width="10%"><strong>Employee ID</strong></td> <td width="9%"><strong>Name</strong></td> <td width="4%"><strong>Sex</strong></td> <td width="10%"><strong>Position/<br /> Designation</strong></td> <td width="13%"><strong>Office / Department</strong></td> <td width="11%"><strong>Employment Status</strong></td> <td width="6%"><strong>Salary Grade</strong></td> <td width="9%"><strong>Eligibility</strong></td> <td width="11%"><strong>Education</strong></td> <td width="8%"><strong>Birthday</strong></td> <td width="9%"><strong>Address</strong></td></tr>'; $office = new Orm_office(); foreach ($rows as $row) { $office->get_by_office_id($row->office_id); $type_employment = $this->options->type_employment(); $birth_date = $row->birth_date; if ($row->birth_date == '0000-00-00') { $birth_date = ''; } $html .= ' <tr> <td>' . $row->id . '</td> <td>' . $row->lname . ',' . $row->fname . ' ' . $row->mname . '</td> <td>' . $row->sex . '</td> <td>' . $row->position . '</td> <td>' . $office->office_name . '</td> <td>' . $type_employment[$row->permanent] . '</td> <td>' . $row->salary_grade . '-' . $row->step . '</td> <td>' . $row->eligibility . '</td> <td>' . $row->education . '</td> <td>' . $birth_date . '</td> <td>' . $row->res_address . '</td> </tr>'; } $html .= ' <tr><td><p> </p></td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td><td> </td></tr> </tbody></table>'; // Signatories $sr_prepared = $this->Settings->get_selected_field('sr_prepared'); $sr_prepared_position = $this->Settings->get_selected_field('sr_prepared_position'); $sr_certified = $this->Settings->get_selected_field('sr_certified'); $sr_certified_position = $this->Settings->get_selected_field('sr_certified_position'); $html .= ' <table width="100%" border="0"> <tr> <td width="38%"> </td> <td width="23%"> </td> <td width="39%"> </td> </tr> <tr> <td align="center">PREPARED BY:</td> <td> </td> <td align="center">CERTIFIED CORRECT:</td> </tr> <tr> <td align="center"> </td> <td> </td> <td align="center"> </td> </tr> <tr> <td align="center"> </td> <td> </td> <td align="center"> </td> </tr> <tr> <td align="center">' . $sr_prepared . '</td> <td> </td> <td align="center">' . $sr_certified . '</td> </tr> <tr> <td align="center">' . $sr_prepared_position . '</td> <td> </td> <td align="center">' . $sr_certified_position . '</td> </tr> </table> '; $this->load->library('MPDF52/mpdf'); //$this->mpdf->WriteHTML('<p>Hello There hahahaha</p>'); //$this->mpdf->Output('mpdf.pdf','I'); // LOAD a stylesheet $stylesheet = file_get_contents(base_url() . 'css/mpdf/mpdfstyletables.css'); $this->mpdf->WriteHTML($stylesheet, 1); // The parameter 1 tells that this is css/style only and no body/html/text $this->mpdf->WriteHTML($html); $this->mpdf->Output('dtr/template/pds/archives/pds_' . date('Y_m_d') . '.pdf', 'F'); return 'dtr/template/pds/archives/pds_' . date('Y_m_d') . '.pdf'; exit; $this->load->helper('settings'); $this->load->library('fpdf'); //define('FPDF_FONTPATH',$this->config->item('fonts_path')); $this->load->library('fpdi'); // initiate FPDI $pdf = new FPDI('L', 'mm', 'Letter'); // add a page $pdf->AddPage(); // set the sourcefile //$pdf->setSourceFile('dtr/template/service_record/service_record.pdf'); // import page 1 //$tplIdx = $pdf->importPage(1); // use the imported page and place it at point 10,10 with a width of 100 mm //$pdf->useTemplate($tplIdx, 1, 1, 210); // now write some text above the imported page $pdf->SetFont('Arial'); $pdf->SetTextColor(0, 0, 0); $pdf->SetXY(15, 60); $pdf->SetFont('Arial', '', 16); $pdf->Cell(0, 3, "Report Name", '', 1, 'C', false); //$pdf->Ln(4); //$e = new Employee_m(); //$e->get_by_employee_id( $employee_id ); $pdf->SetFont('Arial', '', 12); //$pdf->Cell(0,8,"Employee No.:".$e->id ,'',1,'L',false); //$pdf->Ln(2); //$pdf->SetFont('Arial', '', 12); //$pdf->Cell(0,8,"Employee Name:".$e->lname.', '.$e->fname.' '.$e->mname ,'',1,'L',false); $pdf->Ln(4); $pdf->Cell(0, 8, "Emp ID Name Sex Position/Designation Office Employment Status Salary Grade Eligibility Education Birth Day Address", '1', 1, 'L', false); $pdf->Ln(4); $i = 1; $this->load->helper('text'); //$pdf->Cell(30,12, word_wrap('msayado maahhn ndhah ahhhehe so ano gagawin mo now', 10) ,'1',1,'L',false); //$pdf->MultiCell(30,3,word_wrap("hello this is a sample nlong text with line break ", 15) ,'1',1,'L',false); //$pdf->MultiCell(30,3,word_wrap("hello this is a sample nlong text with line break ", 15) ,'0',1,'L',false); foreach ($rows as $row) { $pdf->SetFont('Arial', '', 11); $pdf->SetX(10); //$pdf->Write(0, $row->id); $pdf->Cell(15, 12, $row->id, '1', 0, 'L', false); $pdf->SetX(29); //$pdf->Write(0, $row->lname.', '.$row->fname.''.$row->mname); $pdf->Cell(30, 12, word_wrap($row->lname . ', ' . $row->fname . '' . $row->mname, 10), '1', 1, 'L', false); $pdf->SetFont('Arial', '', 8); $pdf->SetX(62); $pdf->Write(0, $row->sex); $pdf->SetX(75); //$pdf->Write(0, $row->company); $pdf->Write(0, $row->position); //$pdf->SetFont('Arial', '', 12); $pdf->SetX(160); $pdf->Write(0, $row->movement); //$pdf->SetX(150); //$pdf->Write(0, $row->salary_grade); $pdf->SetFont('Arial', '', 8); $pdf->SetX(185); //$pdf->Write(0, $row->status); if ($row->govt_service == 1) { $row->govt_service = 'Yes'; } else { $row->govt_service = 'No'; } $pdf->SetX(190); //$pdf->Write(0, $row->govt_service); $pdf->SetFont('Arial', '', 12); if ($i == 6 || $i == 10 || $i == 13 || $i == 16 || $i == 19 || $i == 22) { $pdf->Ln(8); } else { $pdf->Ln(7); } $i++; } $pdf->Cell(0, 8, "--------------------------------------------------------- Nothing Follows ---------------------------------------------------------", '', 1, 'C', false); // Signatories $pdf->Ln(15); $pdf->SetX(20); $pdf->Cell(90, 5, "PREPARED BY:", '0', 0, 'C', false); $pdf->Cell(90, 5, "CERTIFIED CORRECT:", '0', 1, 'C', false); $pdf->Ln(10); $sr_prepared = $this->Settings->get_selected_field('sr_prepared'); $sr_prepared_position = $this->Settings->get_selected_field('sr_prepared_position'); $sr_certified = $this->Settings->get_selected_field('sr_certified'); $sr_certified_position = $this->Settings->get_selected_field('sr_certified_position'); $pdf->SetX(20); $pdf->Cell(90, 5, $sr_prepared, '0', 0, 'C', false); //4th param border $pdf->Cell(90, 5, $sr_certified, '0', 1, 'C', false); $pdf->SetX(20); $pdf->Cell(90, 5, $sr_prepared_position, '0', 0, 'C', false); $pdf->Cell(90, 5, $sr_certified_position, '0', 1, 'C', false); // Output $pdf->Output('dtr/template/pds/archives/pds_' . date('Y_m_d') . '.pdf', 'F'); return 'dtr/template/pds/archives/pds_' . date('Y_m_d') . '.pdf'; }
$pdf->Text(20, 73, $rowCabecera["CHEQUEREEMP"]); $pdf->Text(58, 73, $rowCabecera["FECHA_CHEQUE"]); $pdf->Text(83, 73, $rowCabecera["OPAGO"]); $pdf->Text(105, 73, $rowCabecera["DESCRIPCION"]); $pdf->Text(170, 73, $rowCabecera["MONTOREEMP"]); //--------------------------------------------------------------------------- $i = 1; $netoAPagar = 0; $posX = 0; $stmt = DBExecSql($conn, $sqlMain, $paramsMain); while ($row = DBGetQuery($stmt, 1, false)) { if ($i == 1 && $netoAPagar > 0) { $pdf->AddPage();} $posX = (93 + ($i*4)); $pdf->SetXY(20, $posX); $pdf->Cell(20, 0, $row["DESCRIPTION"], 0, 0, 'L' ); $pdf->SetX(40); $pdf->Cell(50, 0, $row["BANK_NAME"], 0, 0, 'L' ); $pdf->SetX(88); $pdf->Cell(20, 0, $row["BANK_ACCOUNT_NUM"], 0, 0, 'L' ); $pdf->SetX(120); $pdf->Cell(20, 0, $row["CHEQUE"], 0, 0, 'L' ); $pdf->SetX(146); $pdf->Cell(20, 0, $row["FECHA_OP"], 0, 0, 'L' ); $pdf->SetX(170);
public static function appendVoidText($path_to_dir,$filename,$page=''){ require_once(Yii::app()->basePath.'/extensions/Fpdf/fpdf.php'); require_once(Yii::app()->basePath.'/extensions/Fpdi/fpdi.php'); $pdf = new FPDI(); $pdf->setSourceFile($path_to_dir.'/'.$filename); $tplIdx = $pdf->importPage(1, '/MediaBox'); $pdf->addPage(); $pdf->useTemplate($tplIdx, true); //die("after set sourse"); try{ $pdf->SetFont('Helvetica','B',20); $pdf->SetTextColor(255,0,0); $pdf->SetXY (10,5); $pdf->SetFontSize(10); $pdf->Write(5,'VOID void VOID void VOID void VOID void VOID void VOID void VOID void VOID void VOID void VOID '); $pdf->Output($path_to_dir.'/'.$filename,'F'); }catch (Exception $e) { $result['error']="Could not render this file"; die('Could not render this file'); } $result['path_to_dir']=$path_to_dir; $result['filename']=$filename; $result['ext']='pdf'; return $result; }
public function view_sign_oc(){ require_once('./assets/fpdf17/fpdf.php'); require_once('./assets/fpdf17/fpdi.php'); $oc_id=$this->uri->segment(3,''); // init pce data $oc_dat=$this->m_oc->get_oc_by_id($oc_id); $project=$this->m_project->get_project_by_id($oc_dat->project_id); //init sign pic $ae_sign_user_dat=$this->m_user->get_user_by_login_name($project->project_cs); $ae_sign_filename="no"; if (isset($ae_sign_user_dat->sign_filename)) { $ae_sign_filename=$ae_sign_user_dat->sign_filename; } $finance_sign_dat=$this->m_user->get_user_by_login_name($oc_dat->fc_sign); $finance_sign_filename="no"; if (isset($finance_sign_dat->sign_filename)) { $finance_sign_filename=$finance_sign_dat->sign_filename; } // initiate FPDI $pdf = new FPDI(); // เพิ่มฟอนต์ภาษาไทยเข้ามา ตัวธรรมดา กำหนด ชื่อ เป็น angsana $pdf->AddFont('angsana','','angsa.php'); // เพิ่มฟอนต์ภาษาไทยเข้ามา ตัวหนา กำหนด ชื่อ เป็น angsana $pdf->AddFont('angsana','B','angsab.php'); // เพิ่มฟอนต์ภาษาไทยเข้ามา ตัวหนา กำหนด ชื่อ เป็น angsana $pdf->AddFont('angsana','I','angsai.php'); // เพิ่มฟอนต์ภาษาไทยเข้ามา ตัวหนา กำหนด ชื่อ เป็น angsana $pdf->AddFont('angsana','BI','angsaz.php'); // get the page count $pageCount = $pdf->setSourceFile("./media/real_pdf/".$oc_dat->filename); // iterate through all pages 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['w'] > $size['h']) { $pdf->AddPage('L', array($size['w'], $size['h'])); } else { $pdf->AddPage('P', array($size['w'], $size['h'])); } // use the imported page $pdf->useTemplate($templateId); $pdf->SetTextColor(0,0,0); $pdf->SetFont('angsana','B',14); $pdf->SetXY(5, 5); //$pdf->Write(8, 'A complete document imported with FPDI'); //// temporaly disable if ($finance_sign_filename!="no"&&$finance_sign_filename!=""&&$finance_sign_filename!=null) { //$pdf->Image("./media/sign_photo/".$finance_sign_filename,100,10,40,0); } if ($ae_sign_filename!="no"&&$ae_sign_filename!=""&&$ae_sign_filename!=null) { //$pdf->Image("./media/sign_photo/".$ae_sign_filename,100,110,40,0); } //$pdf->Image("images/play.png",100,100,100,0); } $new_filename=$oc_dat->oc_no."_A.pdf"; // Output the new PDF //@unlink("./media/real_pdf/".$new_filename); $pdf->Output($new_filename,"I"); //redirect("media/real_pdf/".$new_filename); }
require 'fpdf.php'; require 'fpdi.php'; header('Content-Type: text/pdf; charset=UTF-8'); $dni = $_POST["tbDni"]; $nombre = $_POST["tbNombre"]; $fecha = (new DateTime())->format("dd/mm/YY"); $pdf = new FPDI(); $pdf->AddPage(); $pdf->setSourceFile("diploma-plantilla.pdf"); // import page 1 $tplIdx = $pdf->importPage(1); // use the imported page and place it at point 10,10 with a width of 100 mm $pdf->useTemplate($tplIdx, 0, 0, 0, 0, true); $pdf->SetFont('Helvetica', "", 12); $pdf->SetTextColor(0, 0, 0); $pdf->SetXY(30, 80); $pdf->write(0, utf8_decode("La Universidad de La Rioja otorga el siguiente diploma a")); $pdf->SetFont('Helvetica', "", 20); $pdf->SetTextColor(255, 10, 10); $pdf->SetXY(30, 90); $pdf->write(0, utf8_decode(utf8_encode($nombre))); $pdf->SetFont('Helvetica', "", 12); $pdf->SetTextColor(0, 0, 0); $pdf->SetXY(30, 100); $pdf->write(0, utf8_decode("Con dni: " . $dni . " ha superado con éxito el programa formativo,")); $pdf->SetFont('Helvetica', "", 25); $pdf->SetTextColor(255, 30, 30); $pdf->SetXY(30, 110); $pdf->write(0, utf8_decode("CURSO DE MANIPULACIÓN DE PDF")); $pdf->SetFont('Helvetica', "", 12); $pdf->SetTextColor(0, 0, 0);
if (mysql_num_rows($sql) == 1) { $row = mysql_fetch_assoc($sql); } } $pdf = new FPDI(); $pageCount = $pdf->setSourceFile("img/ugoda2014.pdf"); $pageNo = 1; $templateId = $pdf->importPage($pageNo); $size = $pdf->getTemplateSize($templateId); $pdf->AddPage('P', array($size['w'], $size['h'])); $pdf->useTemplate($templateId); $pdf->AddFont('Times', '', 'times.php'); $pdf->SetFont('Times', '', 10); $pdf->SetTextColor(0, 0, 0); $pdf->SetFontSize(11); $pdf->SetXY(35, 61); $pdf->Write(5, $row['lastname'] . " " . $row['firstname'] . " " . $row['patronymic']); $pdf->SetXY(55, 70); if ($row['type'] == "mag") { $pdf->Write(5, "6-й курс, " . $row['faculty']); } if ($row['type'] == "spc") { $pdf->Write(5, "5-й курс " . $row['faculty']); } if ($row['study_type'] == "Денна") { $type = ", денна форма навчання"; } if ($row['study_type'] == "Заочна") { $type = ", заочна форма навчання"; } $pdf->SetXY(68, 76);
public function createScreeningPdf($hash) { $screening_entry_model = ScreeningEntry::findOne(['hash' => $hash]); $screening_form_model = ScreeningForm::findOne(['id' => $screening_entry_model->screening_form_id]); $subject_model = Subject::findOne(['id' => $screening_entry_model->subject_id]); $count = 1; //$permissions = \SetaPDF_Core_SecHandler::PERM_DIGITAL_PRINT ; $this->_font = 'Helvetica'; //class_exists('TCPDF', true); // trigger Composers autoloader to load the TCPDF class $pdf = new \FPDI(); $pdf->SetAutoPageBreak(true); // add a page $pdf->SetTopMargin(30); $pdf->AddPage(); $pdf->setSourceFile(\yii::$app->basePath . "/../letterhead-mini-header.pdf"); $tplIdx = $pdf->importPage(1); // use the imported page and place it at point 10,10 with a width of 100 mm $pdf->useTemplate($tplIdx, 0, 0); $pdf->SetFont($this->_font, '', 9); $pdf->SetXY(10, 6); $pdf->Cell(0, 3, 'Confidential - Participant screening form'); $pdf->SetFont($this->_font, '', 12); $pdf->SetXY(10, 14); $pdf->MultiCell(150, 3, yii::$app->DateComponent->timestampToUkDate($screening_entry_model->created_at), 0, 'R'); $pdf->MultiCell(100, 3, $screening_entry_model->screening_form_title, 0, ''); $pdf->Ln(); $pdf->SetFont($this->_font, '', 9); $pdf->Cell(100, 4, sprintf('Participant: %s %s (dob %s)', $screening_entry_model->subject->first_name, $screening_entry_model->subject->last_name, yii::$app->DateComponent->isoToUkDate($screening_entry_model->subject->dob))); $pdf->Cell(50, 4, sprintf('Identifier: %s', $screening_entry_model->subject->cubric_id), 0, '', 'R'); $pdf->Ln(); $pdf->Cell(100, 4, sprintf('Researcher: %s %s (project %s)', $screening_entry_model->researcher->first_name, $screening_entry_model->researcher->last_name, $screening_entry_model->project->code)); $pdf->Cell(50, 4, sprintf('Resource: %s', $screening_entry_model->resource_title), 0, '', 'R'); $pdf->SetXY(10, 38); $pdf->SetFont($this->_font, '', 12); $pdf->Cell(150, 4, sprintf('Responses')); $pdf->SetFont($this->_font, '', 9); $pdf->Ln(); foreach (yii::$app->screeningresponse->getResponses($hash) as $response) { if (strlen($response['caption']) > 0) { $pdf->Ln(); $pdf->MultiCell(180, 4, sprintf('%s ', $response['caption']), 0, 'U'); $count = 1; } $pdf->MultiCell(180, 4, sprintf('%s. %s ', $count, $response['content'])); $pdf->SetFont($this->_font, 'B', 9); if ($response['response'] === null) { $response['response'] = 'Not specified / Unknown.'; } $pdf->MultiCell(180, 4, sprintf('%s ', $response['response'])); $pdf->SetFont($this->_font, '', 9); $count++; $pdf->Ln(); } $pdf->Ln(); $pdf->SetFont($this->_font, '', 12); $pdf->Cell(180, 4, sprintf('Signatures')); $pdf->Ln(); $pdf->Ln(); $pdf->SetFont($this->_font, '', 9); $pdf->Cell(100, 4, 'Participant '); $pdf->Cell(100, 4, 'Researcher '); $pdf->Ln(); $pdf->Ln(); $currentX = $pdf->GetX(); $currentY = $pdf->GetY(); $pdf->Image(sprintf('/tmp/subject-%s.png', $hash), $currentX, $currentY); $currentX = $pdf->GetX(); $pdf->Image(sprintf('/tmp/researcher-%s.png', $hash), $currentX + 100, $currentY); // now write some text above the imported page // NOW SET ScreeningEntry::progress_id = PUBLISHED so it cannot be edited again. // $pdfData = $pdf->Output('S'); // create a writer // create a Http writer //$writer = new \SetaPDF_Core_Writer_Http("fpdf-sign-demo.pdf", true); // load document by filename //$document = new \SetaPDF_Core_Document::loadByString($pdfData, $writer); //$document = new \SetaPDF_Core_Reader_File($pdf->Output(), $writer); $writer = new \SetaPDF_Core_Writer_File("/Users/Spiro/tmp/myPDF.pdf"); $document = \SetaPDF_Core_Document::loadByString($pdf->Output("S"), $writer); // let's prepare the temporary file writer: \SetaPDF_Core_Writer_TempFile::setTempDir("/tmp/"); // create a signer instance for the document $signer = new \SetaPDF_Signer($document); // add a field with the name "Signature" to the top left of page 1 $signer->addSignatureField(\SetaPDF_Signer_SignatureField::DEFAULT_FIELD_NAME, 1, \SetaPDF_Signer_SignatureField::POSITION_LEFT_BOTTOM, array('x' => 10, 'y' => 10), 180, 50); // set some signature properties $signer->setReason('Integrity'); $signer->setLocation('CUBRIC'); $signer->setContactInfo('+44 2920 703859'); // ccreate an OpenSSL module instance $module = new \SetaPDF_Signer_Signature_Module_OpenSsl(); // set the sign certificate $module->setCertificate(file_get_contents("/Users/spiro/Sites/projects/certs/certificate.pem")); // set the private key for the sign certificate $module->setPrivateKey(array(file_get_contents("/Users/spiro/Sites/projects/certs/key.pem"), "")); // create a Signature appearance $visibleAppearance = new \SetaPDF_Signer_Signature_Appearance_Dynamic($module); // choose a document to get the background from and convert the art box to an xObject $backgroundDocument = \SetaPDF_Core_Document::loadByFilename(Yii::getAlias('@frontend/web/img/cubric-logo.pdf')); $backgroundXObject = $backgroundDocument->getCatalog()->getPages()->getPage(1)->toXObject($document); // format the date $visibleAppearance->setShowFormat(\SetaPDF_Signer_Signature_Appearance_Dynamic::CONFIG_DATE, 'd-m-Y H:i:s'); // disable the distinguished name $visibleAppearance->setShow(\SetaPDF_Signer_Signature_Appearance_Dynamic::CONFIG_DISTINGUISHED_NAME, false); // set the background with 50% opacity $visibleAppearance->setGraphic($backgroundXObject, 0.5); //$visibleAppearance->setBackgroundLogo($backgroundXObject, .5); // sign/certify the document // define the appearance $signer->setAppearance($visibleAppearance); $signer->sign($module); if (file_exists(sprintf('/tmp/subject-%s.png', $hash))) { } // unlink(sprintf('/tmp/subject-%s.png' , $hash)); if (file_exists(sprintf('/tmp/researcher-%s.png', $hash))) { } // unlink(sprintf('/tmp/researcher-%s.png' , $hash)); return true; }
function showForm($data = "", $msg = "") { global $t, $db, $sesIdUsuario, $hoy, $usuario; $idReg = $data[idReg]; $idPedido = $data[idPedido]; //echo "ID_PEDIDO : $idPedido <hr>"; $t->set_file("page", "opGuia.inc.html"); // ----------------------------------------- // Datos del Pedido // ----------------------------------------- $sql = "select id_cliente,ori,des,mov,bkg,pos_fec,pos_hor,pos_min,ori,des, "; $sql .= "destinatario,destinatario_dom "; $sql .= "from PEDIDO where id_pedido='{$idPedido}' "; $db->query($sql); while ($db->next_record()) { $idCliente = $db->f(id_cliente); $cliente = getValueTable("cliente", "CLIENTE", "id_cliente", $idCliente); $ori = $db->f(ori); $des = $db->f(des); $mov = $db->f(mov); $bkg = $db->f(bkg); $posFec = $db->f(pos_fec); $posHor = $db->f(pos_hor); $posMin = $db->f(pos_min); $pos = "{$posFec} {$posHor}:{$posMin}"; $ori = $db->f(ori); $des = $db->f(des); $ruta = "{$ori} / {$des}"; $destinatario = $db->f(destinatario); $destinatarioDom = $db->f(destinatario_dom); } $t->set_var(array("ID_REG" => $idReg, "ID_PEDIDO" => $idPedido, "ACTION" => $PHP_SELF, "MENSAJE" => "", "CLIENTE" => $cliente, "ORI" => $ori, "DES" => $des, "MOV" => $mov, "CANCELADO_DETALLE" => "", "IMPRIMIR" => "<a href=\"javascript:ventanaNueva('opGuiaImp.php?idReg={$idReg}',850,600)\"><img src=\"../images/imp.png\" border=\"0\" height=\"30\" width=\"30\"></a>", "PDF" => "")); // Consultar si esta cancelada la Guia de embarque. $stRegGE = getValueTable("st_reg", "GUIA", "id_guia", $idReg); $bajaIdUsr = getValueTable("baja_id_usr", "GUIA", "id_guia", $idReg); $bajaFec = getValueTable("baja_fec", "GUIA", "id_guia", $idReg); if ($stRegGE == "B") { $bajaUsr = getValueTable("usuario", "USUARIO", "id_usuario", $bajaIdUsr); $bajaDetalle = "<font color=red>**CANCELADO**<br>Por: {$bajaUsr}<br>Fecha : {$bajaFec}</font>"; $t->set_var("CANCELADO_DETALLE", "{$bajaDetalle}"); } else { $stRegColor = "class=\"color3\""; $bajaDetalle = ""; $t->set_var("BAJA", "<a href=\"javascript:submitD(document.frm1,'{$PHP_SELF}','{$idGuia}','baja')\"><img src=\"../images/b_del.png\" border=0></a>"); } if (empty($idReg) || $idReg == 0) { $op = "nuevo"; } elseif ($stRegGE == "B") { $op = "cancelado"; $t->set_var("GUARDAR", ""); $t->set_var("ACTUALIZAR", ""); $t->set_var("IMPRIMIR", ""); } else { $op = "editar"; } switch ($op) { case "editar": if ($usuario->havePerm("1,9", $_SESSION['sesArrPerms'])) { // 9 : [Transporte] Captura Pedidos $t->set_var("GUARDAR", ""); $t->set_var("ACTUALIZAR", "<a href=\"javascript:submitD(document.frm1,'{$PHP_SELF}','{$idReg}','update')\">Actualizar Datos</a>"); } else { $t->set_var("GUARDAR", ""); $t->set_var("ACTUALIZAR", ""); } break; case "nuevo": if ($usuario->havePerm("1,9", $_SESSION['sesArrPerms'])) { if (!empty($idPedido)) { $t->set_var("GUARDAR", "<a href=\"javascript:submitD(document.frm1,'{$PHP_SELF}','','rec')\">Guardar</a>"); $t->set_var("ACTUALIZAR", ""); } else { $t->set_var("GUARDAR", "<font color=\"red\"><b>ERROR : PRIMERO SELECCIONE UN PEDIDO Y LUEGO CREE UNA GUIA DE EMBARQUE.</b></font>"); $t->set_var("ACTUALIZAR", ""); } } else { $t->set_var("GUARDAR", ""); $t->set_var("ACTUALIZAR", ""); } break; } // -------------------------- // CONSULTA DE GUIA // -------------------------- if ($idReg > 0) { $sql = "select * from GUIA where id_guia='{$idReg}'"; $db->query($sql); while ($db->next_record()) { $serie = $db->f(serie); $folio = $db->f(folio); $data[folio] = $serie . $folio; //$data[facturaS] = $db->f(factura_s); $data[factura] = $db->f(factura); $idConte = $db->f(id_contenedor); $idEquipo = getValueTable("id_equipo", "CONTENEDOR", "id_contenedor", $idConte); $data[conte] = getValueTable("numero", "CONTENEDOR", "id_contenedor", $idConte); $data[equipo] = getValueTable("equipo", "EQUIPO", "id_equipo", $idEquipo); $data[sello] = $db->f(sello); $data[flete] = $db->f(flete); $data[seguro] = $db->f(seguro); $data[otroCosto] = $db->f(otro_costo); $data[diceContener] = $db->f(dice_contener); $data[mercancia] = $db->f(mercancia); $data[bulto] = $db->f(bulto); $data[operador] = $db->f(operador); $data[nota] = $db->f(nota); $data[traUni] = $db->f(tra_uni); $data[traPla] = $db->f(tra_pla); $data[chaUni] = $db->f(cha_uni); $data[chaPla] = $db->f(cha_pla); $data[terLlega] = $db->f(ter_llega); $data[terSale] = $db->f(ter_sale); $data[terVacLlega] = $db->f(ter_vac_llega); $data[terVacSale] = $db->f(ter_vac_sale); $data[referencia] = $db->f(referencia); $data[tonelaje] = $db->f(tonelaje); $data[valorDec] = $db->f(valor_dec); $capIdUsr = $db->f(cap_id_usr); $capFec = $db->f(cap_fec); $modIdUsr = $db->f(mod_id_usr); $modFec = $db->f(mod_fec); $capUsr = getValueTable("usuario", "USUARIO", "id_usuario", $capIdUsr); $modUsr = getValueTable("usuario", "USUARIO", "id_usuario", $modIdUsr); $data[maniobra] = $db->f(maniobra); $data[autopista] = $db->f(autopista); $data[clase] = $db->f(clase); $data[ruta] = $db->f(ruta); $data[gastosViaje] = $db->f(gastos_viaje); $data[dollyNum] = $db->f(dolly_num); $data[dollyPla] = $db->f(dolly_pla); } } // Combos if ($data[maniobra] == "M") { $t->set_var("MANI_SEL_M", "selected"); } if ($data[maniobra] == "C") { $t->set_var("MANI_SEL_C", "selected"); } if ($data[autopista] == "S") { $t->set_var("AUTOPISTA_SEL_S", "selected"); } if ($data[autopista] == "N") { $t->set_var("AUTOPISTA_SEL_N", "selected"); } // Combo Bulto if ($data[bulto] == "20-DC") { $t->set_var("20DCSEL", "selected"); } if ($data[bulto] == "40-DC") { $t->set_var("40DCSEL", "selected"); } if ($data[bulto] == "40-HC") { $t->set_var("40HCSEL", "selected"); } if ($data[bulto] == "20-RF") { $t->set_var("20RFSEL", "selected"); } if ($data[bulto] == "40-RF") { $t->set_var("40RFSEL", "selected"); } if ($data[bulto] == "20-OT") { $t->set_var("20OTSEL", "selected"); } if ($data[bulto] == "40-OT") { $t->set_var("40OTSEL", "selected"); } if ($data[bulto] == "20-FL") { $t->set_var("20FLSEL", "selected"); } if ($data[bulto] == "40-FL") { $t->set_var("40FLSEL", "selected"); } if ($data[bulto] == "20-TK") { $t->set_var("20TKSEL", "selected"); } if ($data[bulto] == "40-TK") { $t->set_var("40TKSEL", "selected"); } // Combo Clase de contenedor if ($data[clase] == "A") { $t->set_var("CLASESELA", "selected"); } if ($data[clase] == "B") { $t->set_var("CLASESELB", "selected"); } if ($data[clase] == "C") { $t->set_var("CLASESELC", "selected"); } if ($data[clase] == "D") { $t->set_var("CLASESELD", "selected"); } if ($data[clase] == "FG") { $t->set_var("CLASESELFG", "selected"); } if ($data[clase] == "GC") { $t->set_var("CLASESELGC", "selected"); } $folioX = $data[folio]; $t->set_var(array("FOLIO" => $folioX, "FACTURA_S" => $data[facturaS], "FACTURA" => $data[factura], "REFERENCIA" => $data[referencia], "TONELAJE" => $data[tonelaje], "VALOR_DEC" => $data[valorDec], "CONTENEDOR" => $data[conte], "EQUIPO" => $data[equipo], "SELLO" => $data[sello], "FLETE" => $data[flete], "MANIOBRA" => $data[maniobra], "SEGURO" => $data[seguro], "AUTOPISTA" => $data[autopista], "OTRO_COSTO" => $data[otroCosto], "MERCANCIA" => $data[mercancia], "DICE_CONTENER" => $data[diceContener], "OPERADOR" => $data[operador], "NOTA" => $data[nota], "TRA_UNI" => $data[traUni], "TRA_PLA" => $data[traPla], "CHA_UNI" => $data[chaUni], "CHA_PLA" => $data[chaPla], "TER_LLEGA" => $data[terLlega], "TER_SALE" => $data[terSale], "TER_VAC_LLEGA" => $data[terVacLlega], "TER_VAC_SALE" => $data[terVacSale], "CAPTURO" => "{$capUsr} / {$capFec}", "MODIFICO" => "{$modUsr} / {$modFec}", "RUTA" => $data[ruta], "GASTOS_VIAJE" => $data[gastosViaje], "DOLLY_NUM" => $data[dollyNum], "DOLLY_PLA" => $data[dollyPla])); // ""=>$data[], //$facS = $data[facturaS]; $facX = $data[factura]; if (preg_match("/(.{0,2})(.*)/", $facX, $parts)) { $facS = $parts[1]; $facN = $parts[2]; } if ($idReg > 0 && !empty($facN)) { // ---------------------------------------------- // PROCESO DE EDICION DE FACTURA-PDF // // 1. Comprobar que exista la factura original. // 2. Buscar todas las GE que tengan la misma factura relacionada. // 3. Consultar (Folio_serie,Folio,Contenedor,Tipo,Bkg,Posicionamiento,Ruta,etc. // 4. Generar nuevo PDF. // ---------------------------------------------- $facN2 = str_pad($facN, 7, 0, STR_PAD_LEFT); $filePdfOri = "OPE0606129RAF" . $facS . $facN2 . ".pdf"; $filePdfEdi = "OPE0606129RAF" . $facS . $facN2 . "_.pdf"; // Consultar datos GE con la misma Factura. unset($txtFac); unset($txtFac2); $numConte = 0; $sql = "select folio,id_contenedor "; $sql .= "from GUIA "; //$sql.="where factura_s='$facS' and factura='$facN' and st_reg<>'B' "; $sql .= "where factura='{$facX}' and st_reg<>'B' "; $db->query($sql); while ($db->next_record()) { $numConte++; $folioX = $db->f(folio); $folioS = substr($folioX, 0, 2); $folioN = substr($folioX, 2, 10); $idConte = $db->f(id_contenedor); $conte = getValueTable("numero", "CONTENEDOR", "id_contenedor", $idConte); $idEq = getValueTable("id_equipo", "CONTENEDOR", "id_contenedor", $idConte); $equipo = getValueTable("equipo", "EQUIPO", "id_equipo", $idEq); // Si la cantidad de contenedores es mayor al limite, entonces 2do arreglo. $maxConte = 17; if ($numConte > $maxConte) { $txtFac2[] = "{$folioS} {$folioN} {$conte} {$equipo}"; } else { $txtFac[] = "{$folioS} {$folioN} {$conte} {$equipo}"; } } // --------------------------------------------------- // Editar factura. if (file_exists("../facturas/{$filePdfOri}")) { //$pdf =& new FPDI(); $pdf = new FPDI(); $pdf->AddPage(); //Set the source PDF file $pagecount = $pdf->setSourceFile("../facturas/{$filePdfOri}"); //Import the first page of the file $tpl = $pdf->importPage(1); //Use this page as template $pdf->useTemplate($tpl); $pdf->SetFont('Arial', '', 7); // PAGINA #1 // Inicializa la posición $destinatarioDom = str_replace("\n", "", $destinatarioDom); $destinatarioDom = str_replace("\r", "", $destinatarioDom); $pdf->SetXY(60, 90); $pdf->Cell(45, 5, "BKG : {$bkg} ", 0, 0, 'L'); $pdf->SetXY(60, 93); $pdf->Cell(45, 5, "POSICIONAMIENTO : {$pos} ", 0, 0, 'L'); $pdf->SetXY(60, 96); $pdf->Cell(45, 5, "RUTA : {$ruta}", 0, 0, 'L'); $pdf->SetXY(60, 99); $pdf->Cell(45, 5, "SALIDA DE VACIO : ? ", 0, 0, 'L'); $pdf->SetXY(60, 105); $pdf->Cell(60, 5, $destinatario, 0, 0, 'L'); // Seccionar a varias Cell, el domicilio del destinatario // Direccion de destinatario $s = $destinatarioDom; $s = strtoupper($s); $lenTl = strlen($s); // Conocer el numero de lineas $nlDes = $lenTl / 15; // El total de caracteres entre el ancho de 35 que es el max de caracteres x linea. $posIni = 0; $y = 109; for ($i = 1; $i <= $nlDes; $i++) { $txtX = substr($s, $posIni, 35); $pdf->SetXY(60, $y); $pdf->Cell(60, 4, $txtX, 0, 0, 'L'); $posIni = $posIni + 35; $y = $y + 3; } // --------------------------- $y = 90; foreach ($txtFac as $txt) { $pdf->SetXY(10, $y); $pdf->Cell(45, 5, $txt, 0, 0, 'L'); $y = $y + 3; } if ($numConte > $maxConte) { $pdf->SetXY(60, 130); $pdf->Cell(45, 5, "*** VER ANEXO *** VER ANEXO ***", 0, 0, 'L'); // PAGINA #2 $pdf->AddPage(); $y = 20; foreach ($txtFac2 as $txt2) { $pdf->SetXY(10, $y); $pdf->Cell(45, 5, "{$txt2}", 0, 0, 'L'); $y = $y + 3; if ($y == 266) { $y = 20; $pdf->AddPage(); } } } // Grabar archivo //echo "[$filePdfEdi]"; $pdf->Output("../facturas/{$filePdfEdi}", "F"); //$x = file_exists("../facturas/$filePdfEdi"); if (file_exists("../facturas/{$filePdfEdi}")) { $pdfImg = "<a href=\"javascript:ventanaNueva('../facturas/{$filePdfEdi}',800,600)\"><img src=\"../images/pdf.gif\" width=\"25\" hight=\"20\" border=0></a>"; } else { $pdfImg = ""; } $t->set_var("PDF", "{$pdfImg}"); } else { $t->set_var("PDF", ""); } } // ----------------------------------------------- // Control de mensajes // ------------------------------------------- if (!empty($msg)) { $canMsg = count($msg); if ($canMsg > 0) { foreach ($msg as $val) { $cadMsg .= $val . " <br>"; } $t->set_var(array("MENSAJE" => $cadMsg)); } } $t->pparse("out", "page"); }
} } else { $logo = $dir_fax_temp . '/' . $remote_filename; } } else { unset($logo); } } $display_logo = true; } } if ($display_logo) { $pdf->Image($logo, 0.5, 0.4, 2.5, 0.9, null, null, 'N', true, 300, null, false, false, 0, true); } else { //set position for header text, if enabled $pdf->SetXY($x + 0.5, $y + 0.4); } //header if ($fax_header != '') { $pdf->SetLeftMargin(0.5); $pdf->SetFont($pdf_font, "", 10); $pdf->Write(0.3, $fax_header); } //fax, cover sheet $pdf->SetTextColor(0, 0, 0); $pdf->SetFont($pdf_font, "B", 55); $pdf->SetXY($x + 4.55, $y + 0.25); $pdf->Cell($x + 3.5, $y + 0.4, $text['label-fax-fax'], 0, 0, 'R', false, null, 0, false, 'T', 'T'); $pdf->SetFont($pdf_font, "", 12); $pdf->SetFontSpacing(0.0425); $pdf->SetXY($x + 4.55, $y + 1.0);
function page4($employee_id) { $this->load->helper('settings'); $this->load->library('fpdf'); //define('FPDF_FONTPATH',$this->config->item('fonts_path')); $this->load->library('fpdi'); //print_r($personal_info); // initiate FPDI $pdf = new FPDI('P', 'mm', 'Legal'); // add a page $pdf->AddPage(); // set the sourcefile $pdf->setSourceFile('dtr/template/pds/page4.pdf'); // import page 1 $tplIdx = $pdf->importPage(1); // use the imported page and place it at point 10,10 with a width of 100 mm $pdf->useTemplate($tplIdx, 1, 1, 210); // now write some text above the imported page $pdf->SetFont('Arial'); $pdf->SetTextColor(0, 0, 0); $pdf->SetXY(8, 14); $q = new Question(); $q->order_by('question_no'); $questions = $q->get_by_employee_id($employee_id); foreach ($questions as $question) { if ($question->question_no == 1) { if ($question->answer == 1) { $setx = 138.5; } else { $setx = 164; } $pdf->SetX($setx); $pdf->Write(0, 'X'); } if ($question->question_no == 2) { $pdf->Ln(21); if ($question->answer == 1) { $setx = 138.5; } else { $setx = 164; } $pdf->SetX($setx); $pdf->Write(0, 'X'); } if ($question->question_no == 3) { $pdf->Ln(26); if ($question->answer == 1) { $setx = 138.5; } else { $setx = 164; } $pdf->SetX($setx); $pdf->Write(0, 'X'); } if ($question->question_no == 4) { $pdf->Ln(21); if ($question->answer == 1) { $setx = 138.5; } else { $setx = 164; } $pdf->SetX($setx); $pdf->Write(0, 'X'); } if ($question->question_no == 5) { $pdf->Ln(26); if ($question->answer == 1) { $setx = 138.5; } else { $setx = 164; } $pdf->SetX($setx); $pdf->Write(0, 'X'); } if ($question->question_no == 6) { $pdf->Ln(26); if ($question->answer == 1) { $setx = 138.5; } else { $setx = 164; } $pdf->SetX($setx); $pdf->Write(0, 'X'); } if ($question->question_no == 7) { $pdf->Ln(21); if ($question->answer == 1) { $setx = 138.5; } else { $setx = 164; } $pdf->SetX($setx); $pdf->Write(0, 'X'); } if ($question->question_no == 8) { $pdf->Ln(35); if ($question->answer == 1) { $setx = 138.5; } else { $setx = 164; } $pdf->SetX($setx); $pdf->Write(0, 'X'); } if ($question->question_no == 9) { $pdf->Ln(12); if ($question->answer == 1) { $setx = 138.5; } else { $setx = 164; } $pdf->SetX($setx); $pdf->Write(0, 'X'); } if ($question->question_no == 10) { $pdf->Ln(13); if ($question->answer == 1) { $setx = 138.5; } else { $setx = 164; } $pdf->SetX($setx); $pdf->Write(0, 'X'); } } $pdf->SetXY(8, 233); //$pdf->Write(0, 'X'); $r = new Reference(); $references = $r->get_by_employee_id($employee_id); foreach ($references as $reference) { $pdf->SetX(8); $pdf->Write(0, $reference->name); $pdf->SetX(72); $pdf->Write(0, $reference->address); $pdf->SetX(134); $pdf->Write(0, $reference->tel_no); $pdf->Ln(4); } // CTC NO $pdf->SetXY(15, 275); $pdf->Write(0, $reference->ctc_no); $pdf->Ln(13); $pdf->SetX(15); $pdf->Write(0, $reference->issue_at); $pdf->Ln(13); $pdf->SetX(15); $pdf->Write(0, $reference->issue_on); $pdf->SetX(90); $pdf->Write(0, date('F d, Y')); // Output $pdf->Output('dtr/template/pds/page4_' . $employee_id . '.pdf', 'F'); //header("location:".base_url()."resources/pdfs/archives/page4_".$employee_id.'.pdf'); $this->pds[] = 'dtr/template/pds/page4_' . $employee_id . '.pdf'; }