adds footer to pdf

This commit is contained in:
buttle 2021-07-18 14:23:06 +02:00
parent 3e14bdc40c
commit 85e040c449
1 changed files with 13 additions and 1 deletions

View File

@ -58,10 +58,11 @@ class TechDocument extends AbstractBlockLayout
{
$data = $block->getData();
$site_title = $block->getPage()->getSite()->getTitle();
$site_url = null;
$parsedown = new Parsedown();
# logo -> link to site page
$text = "<img src='/themes/archive/asset/img/arc-hive-logo.jpg' />\n";
$text = "<img width='150px' src='/themes/archive/asset/img/arc-hive-logo.jpg' />\n";
$text .= "\n# ".$site_title." ".$dir."\n";
$text .= "## Technical documentation\n";
$text .= "### Characteristics\n";
@ -79,6 +80,17 @@ class TechDocument extends AbstractBlockLayout
$html = $parsedown->setBreaksEnabled(true)->text($text);
$mpdf = new \Mpdf\Mpdf();
$mpdf->SetHTMLFooter('
<table width="100%">
<tr>
<td width="33%">{DATE j-m-Y}</td>
<td width="33%" align="center">{PAGENO}/{nbpg}</td>
<td width="33%" style="text-align: right;">'
.$site_title
.'<a href="'.$site_url.'">'.$site_url.'</a>'
.'</td>
</tr>
</table>');
$mpdf->WriteHTML($html);
$mpdf->Output($this->storage_dir.'/docs/'.$site_title.'.pdf', \Mpdf\Output\Destination::FILE);
}