function generateUserPDF($userId) { require_once 'FPDF/fpdf_protection.php'; $pdf = new FPDF_Protection(); //create the instance $pdf->AddPage(); $pdf->SetFont('Helvetica', 'B', 18); //set the font style $pdf->Cell(75); //start 7.5 cm from right $pdf->Cell(0, 10, "Tan Numbers"); //name the title $pdf->SetFont('Helvetica', '', 15); $pdf->Ln(15); //linebreak $tans = selectTansByUserId($userId); $i = 0; foreach ($tans as $tan) { $pdf->SetFont('Helvetica', 'B', 15); $pdf->Cell(15, 10, $i + 1 . " - )"); $pdf->SetFont('Helvetica', '', 15); $pdf->Cell(0, 10, " {$tan->TAN_NUMBER}"); $pdf->Ln(10); $i++; } return $pdf; }
$pdf->SetFont('DejaVu', '', 9); for ($i = 0; $i < count($table); $i++) { $w = $table_col_width[$i]; $a = 'L'; //actual position $x = $pdf->GetX(); $y = $pdf->GetY(); //Draw $pdf->Rect($x, $y, $w, $h); //Write $pdf->MultiCell($w, 5, stripslashes($record[$table[$i]]), 0, $a); //go to right $pdf->SetXY($x + $w, $y); } //return to line $pdf->Ln($h); } $pdf_file = "print_out_pdf_" . date("Y-m-d", mktime(0, 0, 0, date('m'), date('d'), date('y'))) . "_" . generateKey() . ".pdf"; //send the file $pdf->Output($_SESSION['settings']['path_to_files_folder'] . "/" . $pdf_file); //log logEvents('pdf_export', "", $_SESSION['user_id'], $_SESSION['login']); //clean table DB::query("TRUNCATE TABLE " . prefix_table("export")); echo '[{"text":"<a href=\'' . $_SESSION['settings']['url_to_files_folder'] . '/' . $pdf_file . '\' target=\'_blank\'>' . $LANG['pdf_download'] . '</a>"}]'; } break; //CASE export in CSV format //CASE export in CSV format case "export_to_csv_format": $full_listing = array();
public function Ln($h = null, $calculate = true) { if ($this->calculation == true and $calculate == true) { // if($h === null) { // $h = $this->lasth; // } $this->calculatedHeight += $h; } return parent::Ln($h); }