Esempio n. 1
0
 $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'];
     if ($prev_path != $record['path']) {
         $pdf->SetFont('DejaVu', '', 10);
         $pdf->SetFillColor(192, 192, 192);
         error_log('key: ' . $key . ' - paths: ' . $record['path']);
         $pdf->cell(0, 6, $record['path'], 1, 1, "L", 1);
         $pdf->SetFillColor(222, 222, 222);
         $pdf->cell($table_col_width[0], 6, $LANG['label'], 1, 0, "C", 1);
         $pdf->cell($table_col_width[1], 6, $LANG['login'], 1, 0, "C", 1);
         $pdf->cell($table_col_width[2], 6, $LANG['pw'], 1, 0, "C", 1);
Esempio n. 2
0
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;
}
Esempio n. 3
0
 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;
 }
Esempio n. 4
0
 public function Th($w, $h = 0, $txt = '', $border = 0, $ln = 0, $align = '', $fill = false, $link = '', $calculate = true)
 {
     $words = explode("\n", $txt);
     if (empty($words)) {
         return parent::Cell($w, $h, $txt, $border, $ln, $align, $fill, $link, $calculate);
     }
     $x_before = $this->x;
     $y_before = $this->y;
     parent::Cell($w, $h, '', $border, $ln, $align, $fill, $link, $calculate);
     $set_x = $this->x;
     $set_y = $this->y;
     $this->SetXY($x_before, $y_before - 0.25);
     $lMargin = $this->lMargin;
     $rMargin = $this->rMargin;
     $this->SetLeftMargin($this->x);
     $this->SetRightMargin($this->w - ($this->x + $w));
     $y_plus = $h / 2 - 0.5;
     foreach ($words as $word) {
         if ($align == 'C') {
             $this->CenterText($this->y + $y_plus, $word);
         } elseif ($align == 'R') {
             $pos = $x_before + $w - 1 - $this->GetStringWidth($word);
             $this->Text($pos, $this->y + $y_plus, $word);
         } else {
             $this->Text($this->x, $this->y + $y_plus, $word);
         }
         $y_plus += $y_plus;
     }
     $this->SetLeftMargin($lMargin);
     $this->SetRightMargin($rMargin);
     $this->y = $set_y;
     $this->x = $set_x;
 }