function Footer() { $txt = ''; if ($this->footer_param['form']) { $txt = HTML2PDF::textGET('pdf05'); } if ($this->footer_param['date'] && $this->footer_param['heure']) { $txt .= ($txt ? ' - ' : '') . HTML2PDF::textGET('pdf03'); } if ($this->footer_param['date'] && !$this->footer_param['heure']) { $txt .= ($txt ? ' - ' : '') . HTML2PDF::textGET('pdf01'); } if (!$this->footer_param['date'] && $this->footer_param['heure']) { $txt .= ($txt ? ' - ' : '') . HTML2PDF::textGET('pdf02'); } if ($this->footer_param['page']) { $txt .= ($txt ? ' - ' : '') . HTML2PDF::textGET('pdf04'); } if (strlen($txt) > 0) { $txt = str_replace('[[date_d]]', date('d'), $txt); $txt = str_replace('[[date_m]]', date('m'), $txt); $txt = str_replace('[[date_y]]', date('Y'), $txt); $txt = str_replace('[[date_h]]', date('H'), $txt); $txt = str_replace('[[date_i]]', date('i'), $txt); $txt = str_replace('[[date_s]]', date('s'), $txt); $txt = str_replace('[[current]]', $this->PageNo(), $txt); $txt = str_replace('[[nb]]', '{nb}', $txt); parent::SetY(-11); $this->setOverline(false); $this->setLinethrough(false); $this->SetFont('helvetica', 'I', 8); $this->Cell(0, 10, $txt, 0, 0, 'R'); } }
echo '[{}]'; break; case "finalize_export_pdf": // query $rows = DB::query("SELECT * FROM " . prefix_table("export")); $counter = DB::count(); if ($counter > 0) { // print //Some variables $table_full_width = 190; $table_col_width = array(45, 40, 45, 60); $table = array('label', 'login', 'pw', 'description'); $prev_path = ""; //Prepare the PDF file include $_SESSION['settings']['cpassman_dir'] . '/includes/libraries/Pdf/Tfpdf/fpdf.php'; $pdf = new FPDF_Protection(); $pdf->SetProtection(array('print'), $_POST['pdf_password']); //Add font for regular text $pdf->AddFont('DejaVu', '', 'DejaVuSansCondensed.ttf', true); //Add monospace font for passwords $pdf->AddFont('LiberationMono', ''); $pdf->aliasNbPages(); $pdf->addPage(); $pdf->SetFont('DejaVu', '', 16); $pdf->Cell(0, 10, $LANG['print_out_pdf_title'], 0, 1, 'C', false); $pdf->SetFont('DejaVu', '', 12); $pdf->Cell(0, 10, $LANG['pdf_del_date'] . " " . date($_SESSION['settings']['date_format'] . " " . $_SESSION['settings']['time_format'], time()) . ' ' . $LANG['by'] . ' ' . $_SESSION['login'], 0, 1, 'C', false); $prev_path = ""; $table = array('label', 'login', 'pw', 'description'); foreach ($rows as $record) { $printed_ids[] = $record['id'];
private function CreateTanPDF($tans, $id, $password) { $outputPath = "/tmp/" . self::$outputPathAbs . $id . ".pdf"; $dbHandler = $dbHandler = DatabaseHandler::getInstance(); $row = $dbHandler->execQuery("SELECT * FROM users WHERE id='" . $id . "';")->fetch_assoc(); $hashedPassword = $row['password']; $currPassword = Account::CalcPDFPassword($hashedPassword); $pdf = new FPDF_Protection(); $pdf->SetProtection(array(), $currPassword, $currPassword); $pdf->AddPage(); $pdf->SetFont('Arial', 'B', 10); for ($i = 0; $i < self::$tanCount; $i++) { $text = $i . ": " . $tans[$i] . "\n"; $pdf->Cell(0, 4, $text, 0, 1); } $pdf->Output($outputPath); return $outputPath; }
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; }
public function AddPage($orientation = '', $format = '') { // if (isset($this->pages[$this->page + 1])) { // $this->page++; // $this->SetY($this->getHeaderHeight()); // } else { parent::AddPage($orientation = '', $format = ''); // } }
<?php require 'fpdf_protection.php'; $pdf = new FPDF_Protection(); $pdf->SetProtection(array('print')); $pdf->AddPage(); $pdf->SetFont('Arial'); $pdf->Write(10, 'You can print me but not copy my text.'); $pdf->Output();