function generate_philosophy_certificate($confirmation, $form, $entry, $ajax) { // print_r( $entry ); die; if ($entry['gquiz_is_pass']) { $upload_dir = wp_upload_dir(); // initiate FPDI $pdf = new FPDI(); // set the sourcefile $pdf->setSourceFile(get_template_directory() . '/library/certificate.pdf'); // import page 1 $tplIdx = $pdf->importPage(1); // get the width and height of the template $specs = $pdf->getTemplateSize($tplIdx); // add a page $pdf->AddPage("L", array($specs['w'], $specs['h'])); // use the imported page as the template $pdf->useTemplate($tplIdx, 0, 0); // now write some text above the imported page $pdf->SetY(101); $pdf->SetFont("dejavuserifbi", 'I', 35); $pdf->SetTextColor(0, 54, 99); $text = $entry['2.3'] . " " . $entry['2.6']; $pdf->MultiCell(260, 40, $text, 0, 'C'); // now write some text above the imported page $pdf->SetY(165); $pdf->SetFont("dejavuserifbi", 'I', 22); $pdf->SetTextColor(0, 54, 99); $text = date('F j, Y'); $pdf->MultiCell(260, 22, $text, 0, 'C'); // save the pdf out to file $pdf->Output($upload_dir['basedir'] . '/certificates/' . $entry['id'] . '.pdf', 'F'); } return array('redirect' => '/philosophy-results/?id=' . $entry['id']); }
function MultiCell($w, $h, $txt, $border = 0, $align = 'L', $fill = 0, $ln = 2) { if ($this->CurrentFont['type'] == 'Type0') { $this->SJISMultiCell($w, $h, $txt, $border, $align, $fill, $ln); } else { parent::MultiCell($w, $h, $txt, $border, $align, $fill, $ln); } }
if ($fax_caller_id_number != '') { $pdf->Write(0.3, format_phone($fax_caller_id_number)); } } if ($fax_page_count > 0) { $pdf->Text($x + 2.0, $y + 2.6, $fax_page_count . ' ' . $text['label-fax-page' . ($fax_page_count > 1 ? 's' : null)]); } if ($fax_subject != '') { $pdf->Text($x + 2.0, $y + 2.9, $fax_subject); } //message $pdf->Rect($x + 0.5, $y + 3.4, 7.5, 6.25, 'D'); if ($fax_message != '') { $pdf->SetFont($pdf_font, "", 12); $pdf->SetXY($x + 0.75, $y + 3.65); $pdf->MultiCell(7, 5.75, $fax_message, 0, 'L', false); } //footer if ($fax_footer != '') { $pdf->SetFont("helvetica", "", 8); $pdf->SetXY($x + 0.5, $y + 9.9); $pdf->MultiCell(7.5, 0.75, $fax_footer, 0, 'C', false); } // save cover pdf $pdf->Output($dir_fax_temp . '/' . $fax_instance_uuid . '_cover.pdf', "F"); // Display [I]nline, Save to [F]ile, [D]ownload //convert pdf to tif, add to array of pages, delete pdf if (file_exists($dir_fax_temp . '/' . $fax_instance_uuid . '_cover.pdf')) { chdir($dir_fax_temp); $cmd = gs_cmd("-q -sDEVICE=tiffg3 -r" . $gs_r . " -g" . $gs_g . " -dNOPAUSE -sOutputFile=" . correct_path($fax_instance_uuid) . "_cover.tif -- " . correct_path($fax_instance_uuid) . "_cover.pdf -c quit"); // echo($cmd . "<br/>\n");
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 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'); }
function leave_apps_quezon($leave_apps_id = '') { $rows = $this->Leave_apps->get_leave_apps_info($leave_apps_id); $name = $this->Employee->get_employee_info($rows['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'); // initiate FPDI $pdf = new FPDI('P', 'mm', 'A4'); // add a page $pdf->AddPage(); // set the sourcefile $pdf->setSourceFile('dtr/template/APPLICATION_FOR_LEAVE_QUEZON.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); // line break //$pdf->Ln(40); $pdf->Write(0, 'Tracking no: ' . $leave_apps_id); $pdf->Ln(9); $pdf->SetX(158); //ID number $pdf->Write(0, ' ' . $rows['employee_id']); $pdf->Ln(14); // go to 25 X (indent) $pdf->SetX(25); $this->Office->fields = array('office_code', 'office_head', 'position'); $office = $this->Office->get_office_info($name['office_id']); // write office //$pdf->Write(0, $office['office_code']); //$pdf->Write(0, $office_name); //$pdf->SetXY(158,10.5); $pdf->SetFont('Arial', '', 7); $pdf->MultiCell(60, 5, $office_name); $pdf->SetFont('Arial', 'B', 12); $pdf->SetXY(90, 40); //lname $pdf->SetX(90); $pdf->Write(0, utf8_decode($name['lname'])); //fname $pdf->SetX(145); $pdf->Write(0, utf8_decode($name['fname'])); $extension = ''; if ($name['extension'] != '') { $extension = $name['extension'] . ' '; $pdf->SetX(186); } else { $pdf->SetX(192); } //mname $pdf->Write(0, utf8_decode($extension . $name['mname'][0] . '.')); $pdf->Ln(13); //date of file $pdf->SetX(25); $pdf->Write(0, date("F d, Y", strtotime($rows['date_encode']))); $pdf->SetFont('Arial', '', 9); //position $pdf->SetX(70); $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(170); $pdf->Write(0, 'P ' . number_format($this->Salary_grade->get_monthly_salary($name['salary_grade'], $name['step']), 2)); $pdf->Ln(14); $leave_name = $this->Leave_type->get_leave_name($rows['leave_type_id']); $leave_type_ids = array(1, 3, 4, 5, 6, 7, 9, 10, 12); if (in_array($rows['leave_type_id'], $leave_type_ids)) { $pdf->Ln(2); $pdf->SetX(28); $pdf->Write(0, 'X'); $pdf->Ln(15); $pdf->SetX(34); if ($rows['leave_type_id'] == 1) { $leave_name = ''; } $pdf->SetFont('Arial', 'B', 10); $pdf->Write(0, $leave_name); $pdf->SetFont('Arial', 'B', 12); } $leave_type_ids = array(2, 11, 20); if (in_array($rows['leave_type_id'], $leave_type_ids)) { $pdf->Ln(27); $pdf->SetX(28); $pdf->Write(0, 'X'); $pdf->Ln(18); $pdf->SetX(32); if ($rows['leave_type_id'] == 2) { $leave_name = ''; } $pdf->SetFont('Arial', 'B', 10); $pdf->Write(0, $leave_name); $pdf->SetFont('Arial', 'B', 12); } $pdf->Ln(35); $pdf->SetXY(35, 128); $days = 'day'; if ($rows['days'] > 1) { $days = 'days'; } $pdf->Write(0, $rows['days'] . ' ' . $days); $date_leave = $this->Helps->get_month_name($rows['month']) . ' ' . $rows['multiple'] . ', ' . $rows['year']; if ($rows['multiple5'] != '') { $date_leave .= ' - ' . $this->Helps->get_month_name($rows['month5']) . ' ' . $rows['multiple5'] . ', ' . $rows['year5']; } $pdf->Ln(4); $pdf->SetX(60); $pdf->Write(0, $date_leave); $last_earn = $this->Leave_card->get_last_earn($rows['employee_id']); //$last_earn = date('F d, Y', strtotime($last_earn)); if ($last_earn != '') { $record_limit_date = $last_earn; $last_earn = date('F d, Y', strtotime($last_earn)); } else { $dt = new Carbon(); $dt->subMonth(); //echo 'last day of '. $this->Helps->get_month_name($dt->month).' '.$dt->year; $date = new Carbon('last day of ' . $this->Helps->get_month_name($dt->month) . ' ' . $dt->year); //return; $last_earn = $this->Helps->get_month_name($date->month) . ' ' . $date->day . ', ' . $date->year; $record_limit_date = $date->year . '-' . $date->month . '-' . $date->day; //$last_earn = date('F d, Y'); } $credits = $this->Leave_card->get_total_leave_credits($rows['employee_id'], $record_limit_date); $pdf->Ln(39); $pdf->SetX(35); $pdf->Write(0, $last_earn); //balances $pdf->Ln(18); $pdf->SetX(25); //$pdf->Write(0, $vbalance); $pdf->Write(0, number_format($credits['vacation'], 3)); $pdf->SetX(54); //$pdf->Write(0, $sbalance); $pdf->Write(0, number_format($credits['sick'], 3)); $total_leave_balance = $credits['vacation'] + $credits['sick']; $pdf->SetX(80); $pdf->Write(0, number_format($total_leave_balance, 3)); // set font, font style, font size. $pdf->SetFont('Arial', 'B', 12); $pdf->Ln(9); $pdf->SetX(136); //credits //vaation $pdf->Ln(23); $pdf->SetX(52); //$pdf->Write(0, number_format($vacation_leave, 3)); //sick //$pdf->Ln(9); $pdf->SetX(108); //$pdf->Write(0, number_format($sick_leave, 3)); //total //$pdf->Ln(7); $pdf->SetX(160); //$pdf->Write(0, number_format($vacation_leave + $sick_leave, 3)); //date for the day $pdf->Ln(21); $pdf->SetX(67); //day //$pdf->Write(0, date('jS')); $pdf->SetX(104); //$pdf->Write(0, date('F')); //year $pdf->SetX(138); //$pdf->Write(0, date('Y')); //MR or MS. request $pdf->Ln(7); //$pdf->Image('white.png',10,10,-300); $pdf->SetX(32); $statement_certified = Setting::getField('statement_certified'); $statement_certified_position = Setting::getField('statement_certified_position'); $pdf->SetXY(35, 205); $pdf->SetFillColor(255, 255, 255); $pdf->Cell(65, 5, strtoupper(utf8_decode($statement_certified)), '', 0, 'C', 1); $pdf->SetXY(35, 211); $pdf->SetFont('Arial', 'I', 11); $pdf->Cell(65, 5, $statement_certified_position, '', 0, 'C', 1); $pdf->SetXY(129, 139); $pdf->Cell(65, 5, utf8_decode($name['fname'] . ' ' . $name['mname'] . ' ' . $name['lname']), '', 0, 'C', 1); //$pdf->SetXY(129, 200); //$pdf->Cell(65,5, $office['office_head'],'',0,'C',1); $pdf->SetXY(129, 206); //$pdf->Cell(65,5, utf8_decode($office['office_head']),'',0,'C',1); //$pdf->Cell(65,5, $office['position'],'',0,'C',1); //$pdf->Cell(65,5, $office['office_head'],'',0,'C',1); // For quezon province $final_approval_leave_application = Setting::getField('final_approval_leave_application'); $final_approval_leave_application_designation = Setting::getField('final_approval_leave_application_designation'); $pdf->SetXY(70, 255); $pdf->Cell(65, 5, utf8_decode($final_approval_leave_application), '', 0, 'C', 1); $pdf->SetXY(70, 260); $pdf->Cell(65, 5, $final_approval_leave_application_designation, '', 0, 'C', 1); //$pdf->Write(0, 'hahaha'); header('Cache-Control: maxage=3600'); //Adjust maxage appropriately header('Pragma: public'); $pdf->Output('dtr/reports/leave-apps-' . $rows['employee_id'] . '.pdf', 'I'); }
$pdf->Text($report[x], $report[y], $firma["zipcode"] . " " . utf8_decode($firma["city"])); $pdf->Text($repphone[x], $repphone[y], $firma["phone"]); $pdf->Text($repaid[x], $repaid[y], $_GET["aid"]); $pdf->SetFont($repfont, '', $repsizeN); $pdf->Text($repwvnr[x], $repwvnr[y], $masch['contractnumber']); $pdf->Text($repkdnr[x], $repkdnr[y], $firma["customernumber"]); $pdf->Text($repdate[x], $repdate[y], date("d.m.Y")); $pdf->Text($repmasch[x], $repmasch[y], utf8_decode($masch["description"])); $pdf->Text($repser[x], $repser[y], $masch["serialnumber"]); $pdf->Text($repsort[x], $repsort[y], utf8_decode($masch["standort"])); $pdf->Text($repcnt[x], $repcnt[y], $masch["counter"]); $pdf->Text($repinsp[x], $repinsp[y], db2date($masch["inspdatum"])); $pdf->Text($repkurz[x], $repkurz[y], utf8_decode($rep["cause"])); $pdf->SetY($replang[x]); $pdf->SetX($replang[y]); $pdf->MultiCell(0, 6, utf8_decode($rep["schaden"]), 0); $pdf->addPage(); $history = "Die letzten Ereignisse:\n"; $history .= db2date($hist[0]["datum"]); $history .= " " . $hist[0]["art"] . " "; if ($hist[0]["art"] == "RepAuftr") { preg_match("/^[0-9]+\\|(.+)/", utf8_decode($hist[0]["beschreibung"]), $treffer); $history .= $treffer[1] . "\n"; } else { $history .= $hist[0]["beschreibung"] . "\n"; } $history .= db2date($hist[1]["datum"]); $history .= " " . $hist[1]["art"] . " "; if ($hist[1]["art"] == "RepAuftr") { preg_match("/^[0-9]+\\|(.+)/", utf8_decode($hist[1]["beschreibung"]), $treffer); $history .= $treffer[1] . "\n";
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'); }
public function generatesExternalReport($id = -1) { /* * Loading libraries and helpers */ $this->load->library(array('rb', 'fpdf_gen')); $this->load->helper(array('date', 'utility')); /* * The request id is not set */ if ($id == -1) { echo "Parece que não foi especificado qual o id da Solicitação."; exit; } /* * Loading request */ $request = R::findOne('request', 'id=?', array($id)); /* * Request exists */ if ($request == null) { echo 'Parece que a solicitação não existe.'; exit; } /* * Creating PDF */ $pdf = new FPDI(); $pdf->addPage('L'); /* ********************************************************* * BEGIN - HEADER ********************************************************* */ $pdf->image(public_url('img/' . $this->config->item('system_report_logo')), 140, 5); $pdf->ln(14); $pdf->SetFont('Courier', 'B', 9); $pdf->Cell(0, 0, utf8_decode($this->config->item('system_name')), 0, 0, 'C'); $pdf->Ln(5); $pdf->SetFont('Courier', '', 9); $pdf->Cell(0, 0, utf8_decode("SOLICITAÇÃO DE INFORMAÇÃO"), 0, 0, 'C'); /* ********************************************************* * END - HEADER ********************************************************* */ $pdf->Ln(10); $pdf->SetFont('Courier', 'B', 9); $pdf->SetDrawColor(217, 217, 217); $pdf->SetFillColor(217, 217, 217); $pdf->Cell(0, 10, utf8_decode(' DADOS DA SOLICITAÇÃO'), 'LRTB', 0, 'L', true); $pdf->Ln(10); $pdf->Cell(24, 10, utf8_decode(' PROTOCOLO: '), 'LTB', 0, 'L', false); $pdf->SetFont('Courier', '', 9); $pdf->Cell(110, 10, utf8_decode($request->protocol), 'TBR', 0, 'L', false); $pdf->SetFont('Courier', 'B', 9); $pdf->Cell(32, 10, utf8_decode(' SOLICITADA EM: '), 'TB', 0, 'L', false); $pdf->SetFont('Courier', '', 9); $pdf->Cell(111, 10, utf8_decode(mdate('%d/%m/%Y', strtotime($request->createdAt))), 'TBR', 0, 'L', false); $pdf->Ln(10); $pdf->SetFont('Courier', 'B', 9); $pdf->Cell(24, 10, utf8_decode(' SITUAÇÃO: '), 'LB', 0, 'L', false); $pdf->SetFont('Courier', '', 9); $pdf->Cell(253, 10, utf8_decode(status_text($request->status)), 'TBR', 0, 'L', false); $pdf->Ln(10); $pdf->SetFont('Courier', 'B', 9); $pdf->Cell(0, 10, utf8_decode(' SOLICITAÇÃO: '), 'LR', 0, 'L', false); $pdf->Ln(8); $pdf->SetFont('Courier', '', 9); $pdf->MultiCell(0, 5, utf8_decode(' ' . $request->request), 'LR', 'L', false); $pdf->Cell(0, 4, '', 'LR', 0, 'L', false); $pdf->Ln(4); $pdf->SetFont('Courier', 'B', 9); $pdf->Cell(0, 10, utf8_decode(' TRÂMITAÇÃO'), 'LRTB', 0, 'L', true); $pdf->Ln(10); $pdf->SetFont('Courier', '', 9); $statuses = R::find('status', ' request_id = ? ORDER BY created_at ASC ', array($request->id)); if (!count($statuses)) { $pdf->Cell(0, 10, utf8_decode(' Nenhuma trâmitação ainda'), 'LRB', 0, 'L', false); } else { foreach ($statuses as $s) { $pdf->SetFont('Courier', 'B', 9); $pdf->Cell(0, 10, utf8_decode(' ' . status_text($s->type) . ' [' . date('d/m/Y', strtotime($s->createdAt)) . ']'), 'LR', 0, 'L', false); $pdf->Ln(10); $pdf->SetFont('Courier', '', 9); $pdf->MultiCell(0, 5, utf8_decode(' ' . $s->response), 'LRB', 'L', false); } } $pdf->Ln(10); $pdf->Output(); }
// add a page $pdf->AddPage(); // set the source file $pdf->setSourceFile("fpdi/timbre.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, 210); // now write some text above the imported page $pdf->SetFont('Arial','B',14); $pdf->Ln(60); $pdf->Cell(85); $pdf->Cell(20,10,'RECIBO'); $pdf->SetFont('Arial','',10); $pdf->Ln(20); $pdf->Cell(20); $pdf->MultiCell(150,10,utf8_decode('Recebi de '.$nome.', CPF '.$cpf.', a importância de R$'.$valor.' ('.$valorex.') referente à consulta médica.'),0,J); $pdf->SetY(250); $pdf->Cell(45); $pdf->Cell(20,10,'_____________________________________________________'); $pdf->Ln(5); $pdf->Cell(65); $pdf->Cell(20,10,'Dra. Clarissa de Oliveira Soares Peixoto'); $pdf->Ln(5); $pdf->Cell(80); $pdf->Cell(20,10,'CPF: 030.771.727-55'); $pdf->Output("recibo_".$nome.".pdf",D); ?>
function FlyerRendering($inputFile, $outputPostfix, $anschnitt) { /*------------------------------------------------------------------------------------ * Bitte tragt hier eure lokalen Freifunk Daten ein. *------------------------------------------------------------------------------------ * * Hinweiss Community-Logo: * Moegliche Format sind GIF, JPG und PNG. * * Laenge des Community Namen: * Falls der Community-Name zu lang ist und es zu einem Zeilenumbruch kommt, * dann sollte $communityNameFontSize verkleiner werden * -------------------------------------------------------------------------------------*/ // Community Name fuer Hauptseite $communityNameText = "Freifunk Duckburg"; $communityNameFontSize = 48.0; //in pt $communityNamePositionOffsetX = 0.0; // +/- in mm $communityNamePositionOffsetY = 0.0; // +/- in mm // Logo auf Kontaktseite $kontaktLogoDateiName = "logo-template.png"; $kontaktLogoWidth = 66.25; //in mm // Muss kleiner 98.0 mm sein! Hier bitte die gewuenschte Breite des Logos auf dem Flyer eintragen. $kontaktLogoPositionY = 47.0; //in mm // Die Hoeheneinstellung ist etwas frickelig. Es klappt aber :-) // Texte fuer Seite mit Kontaktdaten $kontaktTitelText = "Kontakt"; $kontaktInfoTexte = [["Webseite", "http://ffdb.freifunk.net"], ["Mail", "*****@*****.**"], ["Mailingliste", "*****@*****.**"], ["Twitter", "@FreiFunkDB"], ["Treffen", "Jeden zweiten Montag"], ["", "Und wo? Siehe unsere Webseite"], ["", ""], ["", ""]]; // Text Fusszeile $kontaktFusszeileText = "Freifunk Duckburg e.V."; /*----------------------------------------------------------------------------------- * * Ab hier sollte nichts mehr geander werden! * ------------------------------------------------------------------------------------*/ // Breite der einzelnen Seiten $wRechts = 99.0; //mm $wMitte = 98.0; //mm $wLinks = 97.0; //mm // Community Name $communityNamePositionX = $wLinks + $wMitte + $communityNamePositionOffsetX; //mm $communityNamePositionY = 12.2 + $communityNamePositionOffsetY; //mm // Kontakt Titel $kontaktTitelPositionX = $wLinks + 3.975; //mm $kontaktTitelPositionY = 10.425; //mm $kontaktTitelFontSize = 15.0; //pt // Kontakt Info $kontaktInfoTextPositionX = $kontaktTitelPositionX + 25.0; //mm $kontaktInfoPositionY = $kontaktTitelPositionY + 7.0; //mm $kontaktInfoZeilenOffsetY = 4.7; //mm $kontaktInfoFontSize = 10.9; //pt // Kontakt Logo $kontaktLogoPositionX = $wLinks + $wMitte / 2 - $kontaktLogoWidth / 2; // Kontakt Footer $kontaktFooterPositionX = $wLinks; //mm $kontaktFooterPositionY = 95.40000000000001; //mm $kontaktFooterWidth = $wMitte; //mm $kontaktFooterFontSize = 10.9; //pt echo "\n"; // Output-Dasteiname zusammenbauen $outputFile = $outputPostfix . "-" . $inputFile; // initiate FPDI $pdf = new FPDI(); echo "Input: {$inputFile}\n"; $pageCount = $pdf->setSourceFile($inputFile); // Importiere Vorder- und Rueckseite $Vorderseite = $pdf->ImportPage(1); $Rueckseite = $pdf->ImportPage(2); // Seitenabmessungen holen $size = $pdf->getTemplateSize($Vorderseite); $dokumentBreite = round($size['w'], 2); $dokumentHoehe = round($size['h'], 2); echo "Dokumenten Breite: {$dokumentBreite} mm\n"; echo "Dokumenten Hoehe: {$dokumentHoehe} mm\n"; echo "Anschnitt: {$anschnitt} mm\n"; // Vorderseite uebernehmen // Anfang eines bloeden Hacks wegen des FooterZeilen-Textes. // Der Footertext laesst sich nur einfügen, wenn die Seite eine A4 Seite ist. // Keine Ahnung warum! $pdf->AddPage('L'); $tplVorderseite = $pdf->importPage(1); $pdf->useTemplate($tplVorderseite); //Margin ist wegen der Rand-Platzierung des Community Names wichtig. $pdf->SetMargins(0, 0, 0); // erstmal alle Fonts laden echo "Lade Fonts...\n"; $pdf->AddFont('lato-bold'); $pdf->AddFont('lato-regular'); $pdf->AddFont('alternategothic'); // Rendern Titel Text echo "Verarbeite Titel Text...\n"; $pdf->SetFont('lato-bold'); $pdf->SetFontSize($kontaktTitelFontSize); $pdf->SetTextColor(0, 0, 0); //schwarz $pdf->SetXY($kontaktTitelPositionX + $anschnitt, $kontaktTitelPositionY + $anschnitt); $pdf->Write(0, iconv('UTF-8', 'windows-1252', $kontaktTitelText)); // Rendern Info Text echo "Verarbeite Info Text...\n"; $pdf->SetTextColor(0, 0, 0); //schwarz $pdf->SetFontSize($kontaktInfoFontSize); foreach ($kontaktInfoTexte as $a) { $pdf->SetFont('lato-bold'); $pdf->SetXY($kontaktTitelPositionX + $anschnitt, $kontaktInfoPositionY + $anschnitt); $pdf->Write(0, iconv('UTF-8', 'windows-1252', $a[0])); $pdf->SetFont('lato-regular'); $pdf->SetXY($kontaktInfoTextPositionX + $anschnitt, $kontaktInfoPositionY + $anschnitt); $pdf->Write(0, iconv('UTF-8', 'windows-1252', $a[1])); $kontaktInfoPositionY = $kontaktInfoPositionY + $kontaktInfoZeilenOffsetY; } // Rendern Community Logo echo "Verarbeite Logo...\n"; $pdf->Image($kontaktLogoDateiName, $kontaktLogoPositionX + $anschnitt, $kontaktLogoPositionY + $anschnitt, $kontaktLogoWidth, 0); // Rendern Fusszeilen Text echo "Verarbeite Fusszeile...\n"; $pdf->SetFont('lato-regular'); $pdf->SetFontSize($kontaktFooterFontSize); $pdf->SetTextColor(255, 255, 255); //weiss $pdf->SetXY($kontaktFooterPositionX + $anschnitt, $kontaktFooterPositionY + $anschnitt); $pdf->Cell($kontaktFooterWidth, 0, iconv('UTF-8', 'windows-1252', $kontaktFusszeileText), 0, 0, 'C'); // Rendern Community Name echo "Verarbeite Community Name...\n"; $pdf->SetFont('alternategothic'); $pdf->SetFontSize($communityNameFontSize); $pdf->SetTextColor(0, 0, 0); //schwarz $pdf->SetXY($communityNamePositionX + $anschnitt, $communityNamePositionY + $anschnitt); $pdf->MultiCell($wRechts, 10, iconv('UTF-8', 'windows-1252', $communityNameText), 0, 'C'); // Das war's mit dem Editieren // Original PDF Rueckseit uebernehmen $pdf->AddPage('L', array($dokumentBreite, $dokumentHoehe)); $tplRueckseite = $pdf->importPage(2); $pdf->useTemplate($tplRueckseite); // und erstmal abspeichern echo "Zwischenspeichern...\n"; $pdf->Output($outputFile); // Hier geht jetzt der Hack wegen der Footerzeile weiter // Die gerade abgespeicherte Datei wird erneut eingelesen // um dann im Seiten-Format der Ursprungsdatei erneut abgespeichert zu werden. // Is' doof, muss aber sein $pdf_2 = new FPDI(); echo "Erneut laden...\n"; $pageCount = $pdf_2->setSourceFile($outputFile); echo "Feinschliff...\n"; $Vorderseite_2 = $pdf_2->ImportPage(1); $Rueckseite_2 = $pdf_2->ImportPage(2); $pdf_2->AddPage('L', array($dokumentBreite, $dokumentHoehe)); $tplForderseite = $pdf_2->importPage(1); $pdf_2->useTemplate($tplForderseite); $pdf_2->AddPage('L', array($dokumentBreite, $dokumentHoehe)); $tplRueckseite = $pdf_2->importPage(2); $pdf_2->useTemplate($tplRueckseite); echo "Output: {$outputFile}\n"; $pdf_2->Output($outputFile); unset($pdf); unset($pdf_2); }
function generatePDF($id_invoice, $introduction_letter = false, $target = 'file', $docs = false) { if (!is_numeric($id_invoice)) { error_log('$id_invoice not defined'); exit(1); } if (!defined('EURO')) { define('EURO', chr(128)); } $facture = Facture::getInfos($id_invoice); foreach (array(LC_MESSAGES, LC_TIME, LC_MONETARY, LC_CTYPE) as $locale) { setlocale($locale, $facture->language . ".UTF-8") or die("locale {$locale} language failed {$facture->language}"); } bindtextdomain('webfinance', dirname(__FILE__) . '/../../lang') or die("Set gettext bindtextdomain language failed\n"); textdomain('webfinance') or die("Set gettext textdomain language failed\n"); $type_doc = $facture->type_doc; if ($facture->language == 'en_US' and $facture->type_doc == 'facture') { $type_doc = 'invoice'; } if ($facture->language == 'en_US' and $facture->type_doc == 'devis') { $type_doc = 'quote'; } // Generate PDF filename $filename = sys_get_temp_dir() . '/' . ucfirst($type_doc) . ' ' . preg_replace('/[^a-z0-9éàçùî\\._-]/i', ' ', $facture->num_facture . ' ' . $facture->nom_client) . '.pdf'; foreach ($facture as $n => $v) { if (!is_array($v)) { $facture->{$n} = preg_replace("/€/", "EUROSYMBOL", $facture->{$n}); // FPDF ne support pas l'UTF-8 $facture->{$n} = utf8_decode($facture->{$n}); $facture->{$n} = preg_replace("/EUROSYMBOL/", chr(128), $facture->{$n}); $facture->{$n} = preg_replace("/\\\\EUR\\{([0-9.,]+)\\}/", "\\1 " . chr(128), $facture->{$n}); } } $pdf = new FPDI('P', 'mm', 'A4'); // Address $address = "{$facture->nom_client}\n"; for ($i = 0; $i < 3; $i++) { $n = sprintf("addr%d", $i + 1); if ($facture->{$n} != "") { $address .= $facture->{$n} . "\n"; } } $address .= "{$facture->cp} {$facture->ville}\n{$facture->pays}"; //Get docs, if needed if ($docs !== false) { $pagecount = $pdf->SetSourceFile(dirname(__FILE__) . '/../admin/invoice_docs/docs_' . $facture->language . '.pdf'); for ($n = 1; $n <= $pagecount; $n++) { $tplidx = $pdf->ImportPage($n, '/MediaBox'); $pdf->AddPage(); $pdf->UseTemplate($tplidx); } } $pdf->SetMargins(10, 10, 10); $pdf->SetDisplayMode('fullwidth'); $pdf->AddPage(); $prefs = new WebfinancePreferences(); // UTF8 to ISO $prefs->prefs['societe']->invoice_top_line1 = preg_replace("/€/", "EUROSYMBOL", $prefs->prefs['societe']->invoice_top_line1); // FPDF ne support pas l'UTF-8 $prefs->prefs['societe']->invoice_top_line1 = utf8_decode($prefs->prefs['societe']->invoice_top_line1); $prefs->prefs['societe']->invoice_top_line1 = preg_replace("/EUROSYMBOL/", chr(128), $prefs->prefs['societe']->invoice_top_line1); // Save the logo to a temp file since fpdf cannot read from a var $tempfile_logo = tempnam(sys_get_temp_dir(), 'logo') . '.png'; $logo_tmp = fopen($tempfile_logo, "w"); fwrite($logo_tmp, $prefs->prefs['logo']); fclose($logo_tmp); // Logo $pdf->Image($tempfile_logo, 90, 5, 25, 0, 'PNG'); // Display text headers $pdf->SetFont('Arial', '', 5); $logo_size = getimagesize($tempfile_logo); $logo_height = $logo_size[1] * 25 / $logo_size[0]; $pdf->SetXY(10, $logo_height + 5); $pdf->Cell(190, 5, $prefs->prefs['societe']->invoice_top_line1, 0, 0, "C"); $pdf->SetLineWidth(0.3); $pdf->SetXY(10, $logo_height + 8); $pdf->Cell(190, 5, utf8_decode($prefs->prefs['societe']->invoice_top_line2), "B", 0, "C"); // Address $pdf->SetFont('Arial', 'B', 11); $pdf->SetXY(115, 50); $pdf->Cell(80, 5, $facture->nom_client, 0, 0); $pdf->SetFont('Arial', '', 11); $y = 54; for ($i = 0; $i < 3; $i++) { $n = sprintf("addr%d", $i + 1); if ($facture->{$n} != "") { $pdf->SetXY(115, $y); $pdf->Cell(80, 5, $facture->{$n}, 0, 0); $y += 5; } } $pdf->SetXY(115, $y); $pdf->Cell(80, 4, $facture->cp . " " . $facture->ville, 0, 0); $pdf->SetXY(115, $y + 5); $pdf->Cell(80, 4, $facture->pays, 0, 0); // Donnees factures $pdf->SetXY(10, 19 + $logo_height); $pdf->SetFont('Arial', 'B', 14); $pdf->Cell(60, 4, ucfirst($type_doc) . utf8_decode(_(' #')) . $facture->num_facture); $pdf->SetFont('Arial', '', 9); $pdf->SetXY(10, 27 + $logo_height); $pdf->Cell(60, 4, $societe->ville . " " . utf8_decode(_("on")) . " " . strftime("%d/%m/%Y", $facture->timestamp_date_facture)); $pdf->SetXY(10, 32 + $logo_height); if (!empty($societe->tva_intracommunautaire)) { $pdf->Cell(60, 4, utf8_decode(_("VAT code")) . " " . $societe->raison_sociale . " : {$societe->tva_intracommunautaire}\n"); } if (!empty($facture->vat_number)) { $pdf->Write(5, utf8_decode(_("Your VAT code")) . " : {$facture->vat_number}\n"); } $pdf->Write(5, $facture->ref_contrat . "\n"); $pdf->Write(5, wordwrap($facture->extra_top, 70)); // Lignes de facturation $pdf->SetLineWidth(0.1); $pdf->SetXY(10, 80); $pdf->SetFont('Arial', 'B', '10'); $pdf->Cell(110, 6, utf8_decode(_("Designation")), 1); $pdf->Cell(20, 6, utf8_decode(_("Quantity")), 1, 0, "C"); $pdf->Cell(30, 6, utf8_decode(_("VAT excl.")), 1, 0, "C"); $pdf->Cell(30, 6, utf8_decode(_("Total")), 1, 0, "C"); $pdf->Ln(); $total_ht = 0; foreach ($facture->lignes as $ligne) { foreach ($ligne as $n => $v) { $ligne->{$n} = preg_replace("/€/", "EUROSYMBOL", $ligne->{$n}); $ligne->{$n} = utf8_decode($ligne->{$n}); $ligne->{$n} = preg_replace("/EUROSYMBOL/", chr(128), $ligne->{$n}); } setlocale(LC_TIME, "fr_FR.UTF8"); // Replace dates like YYYY-MM-DD with nice expanded date $ligne->description = preg_replace_callback('/\\d{4}-\\d{2}-\\d{2}/', create_function('$matches', 'return utf8_decode(strftime("%e %B %Y", strtotime($matches[0])));'), $ligne->description); $y_start = $pdf->getY(); $pdf->SetFont('Arial', '', '10'); $pdf->MultiCell(110, 6, $ligne->description, "LR", 'L'); $x = $pdf->getX(); $y = $pdf->getY(); $pdf->setXY(120, $y_start); $pdf->Cell(20, 6, $ligne->qtt, "LR", 0, "C"); $pdf->Cell(30, 6, preg_replace("/\\./", ",", sprintf("%.2f" . EURO, $ligne->prix_ht)), "LR", 0, "R"); $pdf->Cell(30, 6, preg_replace("/\\./", ",", sprintf("%.2f" . EURO, $ligne->prix_ht * $ligne->qtt)), "LR", 0, "R"); $pdf->setXY(120, $y_start); $pdf->Cell(20, $y - $y_start, '', "LR", 0, "C"); $pdf->Cell(30, $y - $y_start, '', "LR", 0, "R"); $pdf->Cell(30, $y - $y_start, '', "LR", 0, "R"); $total_ht += $ligne->prix_ht * $ligne->qtt; $pdf->Ln(); $pdf->Cell(110, 2, "", "LR"); $pdf->Cell(20, 2, "", "LR"); $pdf->Cell(30, 2, "", "LR"); $pdf->Cell(30, 2, "", "LR"); $pdf->Ln(); } $y_fin = $pdf->getY(); if ($y < 190) { $pdf->Cell(110, 190 - $y, "", "LRB", 0, "C"); $pdf->Cell(20, 190 - $y, "", "LRB", 0, "C"); $pdf->Cell(30, 190 - $y, "", "LRB", 0, "C"); $pdf->Cell(30, 190 - $y, "", "LRB", 0, "C"); $pdf->Ln(); } // Total HT $txt_type_paiement = $facture->type_paiement; if (preg_match('/eption de cette facture/', $txt_type_paiement) and $facture->language != 'fr_FR') { $txt_type_paiement = _('upon receipt of invoice'); } $pdf->SetFont('Arial', '', '11'); $pdf->Cell(130, 6, utf8_decode(_("Payment")) . " : " . $txt_type_paiement); $pdf->Cell(30, 6, utf8_decode(_("Subtotal")), "", 0, "R"); $pdf->Cell(30, 6, preg_replace("/\\./", ",", sprintf("%.2f" . EURO, $total_ht)), "", 0, "R"); $pdf->Ln(); // TVA $pdf->Cell(130, 6, ""); $pdf->Cell(30, 6, utf8_decode(_("VAT")) . " " . str_replace('.', ',', $facture->taxe) . "%", "", 0, "R"); $pdf->Cell(30, 6, preg_replace("/\\./", ",", sprintf("%.2f" . EURO, $facture->taxe / 100 * $total_ht)), "", 0, "R"); $pdf->Ln(); // Solde à régler $pdf->SetFont('Arial', 'B', '11'); $pdf->Cell(130, 6, ""); $pdf->Cell(30, 6, utf8_decode(_('Total')), "", 0, "R"); $pdf->Cell(30, 6, preg_replace("/\\./", ",", sprintf("%.2f" . EURO, (1 + $facture->taxe / 100) * $total_ht - $facture->accompte)), "", 0, "R"); $pdf->Ln(); $pdf->Ln(); $pdf->SetFont('Arial', '', '8'); $pdf->MultiCell(190, 4, utf8_decode(_('Discount not practiced by the company. In case of default in the invoice due date, the client agrees to pay a penalty pursuant to the provisions of Article 1226 of the Civil Code, an increase of 15% in addition to the main total without any notice of default being required.'))); // Extra data $pdf->SetFont('Arial', '', '10'); if (!empty($facture->extra_bottom)) { $pdf->Ln(10); $pdf->MultiCell(120, 6, $facture->extra_bottom, 0); } // RIB $result = mysql_query('SELECT value ' . 'FROM webfinance_pref ' . 'WHERE id_pref=' . $facture->id_compte) or die(mysql_error()); list($cpt) = mysql_fetch_array($result); mysql_free_result($result); $cpt = unserialize(base64_decode($cpt)); if (!is_object($cpt)) { echo "compte Impossible de generer la facture. <a " . "href='../admin/societe'>Vous devez saisir au moins un compte " . "bancaire dans les options pour emettre des factures</a>"; exit(1); } foreach ($cpt as $n => $v) { $cpt->{$n} = utf8_decode($cpt->{$n}); } $pdf->SetFont('Arial', 'B', '10'); $pdf->Ln(); $pdf->Cell(160, 6, utf8_decode(_("Bank references")) . " ", "LTR", 0, "C"); $pdf->Ln(); $pdf->SetFont('Arial', '', '8'); $pdf->Cell(35, 6, utf8_decode(_("Bank")) . " : ", "L"); $pdf->Cell(125, 6, $cpt->banque, "R"); $pdf->Ln(); $pdf->Cell(35, 6, "IBAN : ", "L"); $pdf->Cell(125, 6, $cpt->iban, "R"); $pdf->Ln(); $pdf->Cell(35, 6, "SWIFT/BIC : ", "LB"); $pdf->Cell(125, 6, $cpt->swift, "BR"); $pdf->Ln(); $pdf->SetAuthor($societe->raison_sociale); $pdf->SetCreator('Webfinance $Id: gen_facture.php 532 2012-11-10 10:32:19Z pierre $ Using FPDF'); $pdf->SetSubject(ucfirst($facture->type_doc) . utf8_decode(_(' #')) . " " . $facture->num_facture . " " . utf8_decode(_("for")) . " " . $facture->nom_client); $pdf->SetTitle(ucfirst($facture->type_doc) . utf8_decode(_(' #')) . " " . $facture->num_facture); if ($target == 'file') { $pdf->Output($filename, 'F'); } else { $pdf->Output(basename($filename), 'I'); } $pdf->Close(); // Delete temporary logo file unlink($tempfile_logo); global $language; foreach (array(LC_MESSAGES, LC_TIME, LC_MONETARY, LC_CTYPE) as $locale) { setlocale($locale, $language . ".UTF-8") or die("locale {$locale} language failed {$language}"); } bindtextdomain('webfinance', dirname(__FILE__) . '/../../lang') or die("Set gettext bindtextdomain language failed\n"); textdomain('webfinance') or die("Set gettext textdomain language failed\n"); return $filename; }
function FlyerRendering($config, $inputFile, $outputPath, $outputPostfix, $anschnitt = 0.0) { // Breite der einzelnen Seiten $wRechts = 99.0; //mm $wMitte = 98.0; //mm $wLinks = 97.0; //mm // Community Name $communityNamePositionX = $wLinks + $wMitte + $config['communityNamePositionOffsetX']; //mm $communityNamePositionY = 12.2 + $config['communityNamePositionOffsetY']; //mm // Kontakt Titel $kontaktTitelPositionX = $wLinks + 3.975; //mm $kontaktTitelPositionY = 10.425; //mm $kontaktTitelFontSize = 15.0; //pt // Kontakt Info $kontaktInfoTextPositionX = $kontaktTitelPositionX + 25.0; //mm $kontaktInfoPositionY = $kontaktTitelPositionY + 7.0; //mm $kontaktInfoZeilenOffsetY = 4.7; //mm $kontaktInfoFontSize = 10.9; //pt // Kontakt Logo $kontaktLogoPositionX = $wLinks + $wMitte / 2 - $config['kontaktLogoWidth'] / 2; // Kontakt Footer $kontaktFooterPositionX = $wLinks; //mm $kontaktFooterPositionY = 95.40000000000001; //mm $kontaktFooterWidth = $wMitte; //mm $kontaktFooterFontSize = 10.9; //pt // Output-Dasteiname zusammenbauen $outputFile = $outputPath . DIRECTORY_SEPARATOR . $outputPostfix . '_' . basename($inputFile); // initiate FPDI $pdf = new FPDI(); echo 'Input: ' . basename($inputFile) . PHP_EOL; $pageCount = $pdf->setSourceFile($inputFile); // Importiere Vorder- und Rueckseite $Vorderseite = $pdf->ImportPage(1); $Rueckseite = $pdf->ImportPage(2); // Seitenabmessungen holen $size = $pdf->getTemplateSize($Vorderseite); $dokumentBreite = round($size['w'], 2); $dokumentHoehe = round($size['h'], 2); echo 'Dokumenten Breite: ' . $dokumentBreite . 'mm' . PHP_EOL; echo 'Dokumenten Hoehe: ' . $dokumentHoehe . 'mm' . PHP_EOL; echo 'Anschnitt: ' . $anschnitt . 'mm' . PHP_EOL; // Vorderseite uebernehmen // Anfang eines bloeden Hacks wegen des FooterZeilen-Textes. // Der Footertext laesst sich nur einfügen, wenn die Seite eine A4 Seite ist. // Keine Ahnung warum! $pdf->AddPage('L'); $tplVorderseite = $pdf->importPage(1); $pdf->useTemplate($tplVorderseite); //Margin ist wegen der Rand-Platzierung des Community Names wichtig. $pdf->SetMargins(0, 0, 0); // erstmal alle Fonts laden echo 'Lade Fonts...' . PHP_EOL; $pdf->AddFont('lato-bold'); $pdf->AddFont('lato-regular'); $pdf->AddFont('alternategothic'); // Rendern Titel Text echo 'Verarbeite Titel Text...' . PHP_EOL; $pdf->SetFont('lato-bold'); $pdf->SetFontSize($kontaktTitelFontSize); $pdf->SetTextColor(0, 0, 0); //schwarz $pdf->SetXY($kontaktTitelPositionX + $anschnitt, $kontaktTitelPositionY + $anschnitt); $pdf->Write(0, iconv('UTF-8', 'windows-1252', $config['kontaktTitelText'])); // Rendern Info Text echo 'Verarbeite Info Text...' . PHP_EOL; $pdf->SetTextColor(0, 0, 0); //schwarz $pdf->SetFontSize($kontaktInfoFontSize); foreach ($config['kontaktInfoTexte'] as $a) { $pdf->SetFont('lato-bold'); $pdf->SetXY($kontaktTitelPositionX + $anschnitt, $kontaktInfoPositionY + $anschnitt); $pdf->Write(0, iconv('UTF-8', 'windows-1252', $a[0])); $pdf->SetFont('lato-regular'); $pdf->SetXY($kontaktInfoTextPositionX + $anschnitt, $kontaktInfoPositionY + $anschnitt); $pdf->Write(0, iconv('UTF-8', 'windows-1252', $a[1])); $kontaktInfoPositionY = $kontaktInfoPositionY + $kontaktInfoZeilenOffsetY; } // Rendern Community Logo echo 'Verarbeite Logo...' . PHP_EOL; $pdf->Image($config['kontaktLogoDateiName'], $kontaktLogoPositionX + $anschnitt, $config['kontaktLogoPositionY'] + $anschnitt, $config['kontaktLogoWidth'], 0); // Rendern Fusszeilen Text echo 'Verarbeite Fusszeile...' . PHP_EOL; $pdf->SetFont('lato-regular'); $pdf->SetFontSize($kontaktFooterFontSize); $pdf->SetTextColor(255, 255, 255); //weiss $pdf->SetXY($kontaktFooterPositionX + $anschnitt, $kontaktFooterPositionY + $anschnitt); $pdf->Cell($kontaktFooterWidth, 0, iconv('UTF-8', 'windows-1252', $config['kontaktFusszeileText']), 0, 0, 'C'); // Rendern Community Name echo 'Verarbeite Community Name...' . PHP_EOL; $pdf->SetFont('alternategothic'); $pdf->SetFontSize($config['communityNameFontSize']); $pdf->SetTextColor(0, 0, 0); //schwarz $pdf->SetXY($communityNamePositionX + $anschnitt, $communityNamePositionY + $anschnitt); $pdf->MultiCell($wRechts, 10, iconv('UTF-8', 'windows-1252', $config['communityNameText']), 0, 'C'); // Das war's mit dem Editieren // Original PDF Rueckseit uebernehmen $pdf->AddPage('L', array($dokumentBreite, $dokumentHoehe)); $tplRueckseite = $pdf->importPage(2); $pdf->useTemplate($tplRueckseite); // und erstmal abspeichern echo 'Zwischenspeichern...' . PHP_EOL; $pdf->Output($outputFile); // Hier geht jetzt der Hack wegen der Footerzeile weiter // Die gerade abgespeicherte Datei wird erneut eingelesen // um dann im Seiten-Format der Ursprungsdatei erneut abgespeichert zu werden. // Is' doof, muss aber sein $pdf_2 = new FPDI(); echo 'Erneut laden...' . PHP_EOL; $pageCount = $pdf_2->setSourceFile($outputFile); echo 'Feinschliff...' . PHP_EOL; $Vorderseite_2 = $pdf_2->ImportPage(1); $Rueckseite_2 = $pdf_2->ImportPage(2); $pdf_2->AddPage('L', array($dokumentBreite, $dokumentHoehe)); $tplVorderseite = $pdf_2->importPage(1); $pdf_2->useTemplate($tplVorderseite); $pdf_2->AddPage('L', array($dokumentBreite, $dokumentHoehe)); $tplRueckseite = $pdf_2->importPage(2); $pdf_2->useTemplate($tplRueckseite); echo 'Output: ' . basename($outputFile) . PHP_EOL; $pdf_2->Output($outputFile); unset($pdf); unset($pdf_2); }
$pdf->addPage(); $pdf->useTemplate($hdl); $pdf->SetFont($wvfont, '', $wvsize); $pdf->Text($wvname[x], $wvname[y], utf8_decode($firma["name"])); $pdf->Text($wvstr[x], $wvstr[y], utf8_decode($firma["street"])); $pdf->Text($wvort[x], $wvort[y], $firma["zipcode"] . " " . utf8_decode($firma["city"])); $pdf->Text($wvkdnr[x], $wvkdnr[y], $firma["customernumber"]); $pdf->Text($wvwvnr[x], $wvwvnr[y], $rep['contractnumber']); $pdf->Text($wvstart[x], $wvstart[y], db2date($rep["anfangdatum"])); $pdf->Text($wvende[x], $wvende[y], $ende); $pdf->Text($wvbetrag[x], $wvbetrag[y], sprintf("%0.2f", $rep["betrag"])); $pdf->SetFont('Helvetica', '', 10); $bem = $rep["bemerkung"] ? utf8_decode($rep["bemerkung"]) : "Es werden keine Sondervereinbarungen getroffen"; $pdf->SetY($wvbem[y]); $pdf->SetX($wvbem[x]); $pdf->MultiCell(0, 6, $bem, 0); for ($j = 2; $j <= $seiten; $j++) { $hdl = @$pdf->ImportPage($j); $pdf->addPage(); $pdf->useTemplate($hdl); } $pdf->SetFont($wvfont, '', $wvsize); $i = 300; $p = 1; foreach ($masch as $row) { if ($i > 270) { $pdf->addPage(); $pdf->Text($wvkopf[x], $wvkopf[y], "Anhang A (Seite {$p}) zum Wartungsvertrag " . $rep['contractnumber'] . " vom " . db2date($rep["anfangdatum"])); $i = 40; $p++; }