From ad5ef8bca0c0321f348dcf402e0a20791eca3f4d Mon Sep 17 00:00:00 2001 From: Kevin Decherf Date: Mon, 7 Jan 2019 23:36:41 +0100 Subject: [PATCH] EntriesExport/pdf: move notice to the end, add metadata cover Signed-off-by: Kevin Decherf --- .../CoreBundle/Helper/EntriesExport.php | 33 ++++++++++++++----- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/src/Wallabag/CoreBundle/Helper/EntriesExport.php b/src/Wallabag/CoreBundle/Helper/EntriesExport.php index 9cde27c6..1debdf8e 100644 --- a/src/Wallabag/CoreBundle/Helper/EntriesExport.php +++ b/src/Wallabag/CoreBundle/Helper/EntriesExport.php @@ -299,14 +299,6 @@ class EntriesExport $pdf->SetSubject('Articles via wallabag'); $pdf->SetKeywords('wallabag'); - /* - * Front page - */ - $pdf->AddPage(); - $intro = '

' . $this->title . '

' . $this->getExportInformation('tcpdf'); - - $pdf->writeHTMLCell(0, 0, '', '', $intro, 0, 1, 0, true, '', true); - /* * Adding actual entries */ @@ -315,6 +307,23 @@ class EntriesExport $pdf->SetKeywords($tag->getLabel()); } + $publishedBy = $entry->getPublishedBy(); + if (!empty($publishedBy)) { + $authors = implode(',', $publishedBy); + } else { + $authors = $this->translator->trans('export.unknown'); + } + + $pdf->addPage(); + $html = '

' . $entry->getTitle() . '

' . + '
' . + '
' . $this->translator->trans('entry.view.published_by') . '
' . $authors . '
' . + '
' . $this->translator->trans('entry.metadata.reading_time') . '
' . $this->translator->trans('entry.metadata.reading_time_minutes_short', ['%readingTime%' => $entry->getReadingTime()]) . '
' . + '
' . $this->translator->trans('entry.metadata.added_on') . '
' . $entry->getCreatedAt()->format('Y-m-d') . '
' . + '
' . $this->translator->trans('entry.metadata.address') . '
' . $entry->getUrl() . '
' . + '
'; + $pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true); + $pdf->AddPage(); $html = '

' . $entry->getTitle() . '

'; $html .= $entry->getContent(); @@ -322,6 +331,14 @@ class EntriesExport $pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true); } + /* + * Last page + */ + $pdf->AddPage(); + $html = $this->getExportInformation('tcpdf'); + + $pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true); + // set image scale factor $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); -- 2.41.0