$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); $pdf->cell($table_col_width[3], 6, $LANG['description'], 1, 1, "C", 1); } $prev_path = $record['path']; if (!isutf8($record['pw'])) { $record['pw'] = ""; } $record['description'] = html_entity_decode(htmlspecialchars_decode(str_replace("<br />", "\n", $record['description']), ENT_QUOTES)); //row height calculation $nb = 0; $nb = max($nb, nbLines($table_col_width[0], $record['label'])); $nb = max($nb, nbLines($table_col_width[3], $record['description']));
//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); foreach ($full_listing as $key => $val) { $printed_ids[] = $key; $pdf->SetFont('DejaVu', '', 10); $pdf->SetFillColor(192, 192, 192); error_log('key: ' . $key . ' - paths: ' . $paths[$key]); $pdf->cell(0, 6, $paths[$key], 1, 1, "L", 1); $pdf->SetFillColor(222, 222, 222); $pdf->cell(45, 6, $LANG['label'], 1, 0, "C", 1); $pdf->cell(40, 6, $LANG['login'], 1, 0, "C", 1); $pdf->cell(45, 6, $LANG['pw'], 1, 0, "C", 1); $pdf->cell(60, 6, $LANG['description'], 1, 1, "C", 1); foreach ($val as $item) { //row height calculus $nb = 0; for ($i = 0; $i < count($item); $i++) { if ($i == 3) { $item[$i] = html_entity_decode(htmlspecialchars_decode(str_replace("<br />", "\n", $item[$i]), ENT_QUOTES)); } $nb = max($nb, nbLines($table_col_width[$i], $item[$i])); } $h = 5 * $nb;