adds footer to pdf
This commit is contained in:
parent
3e14bdc40c
commit
85e040c449
|
@ -58,10 +58,11 @@ class TechDocument extends AbstractBlockLayout
|
||||||
{
|
{
|
||||||
$data = $block->getData();
|
$data = $block->getData();
|
||||||
$site_title = $block->getPage()->getSite()->getTitle();
|
$site_title = $block->getPage()->getSite()->getTitle();
|
||||||
|
$site_url = null;
|
||||||
|
|
||||||
$parsedown = new Parsedown();
|
$parsedown = new Parsedown();
|
||||||
# logo -> link to site page
|
# 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 .= "\n# ".$site_title." ".$dir."\n";
|
||||||
$text .= "## Technical documentation\n";
|
$text .= "## Technical documentation\n";
|
||||||
$text .= "### Characteristics\n";
|
$text .= "### Characteristics\n";
|
||||||
|
@ -79,6 +80,17 @@ class TechDocument extends AbstractBlockLayout
|
||||||
|
|
||||||
$html = $parsedown->setBreaksEnabled(true)->text($text);
|
$html = $parsedown->setBreaksEnabled(true)->text($text);
|
||||||
$mpdf = new \Mpdf\Mpdf();
|
$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->WriteHTML($html);
|
||||||
$mpdf->Output($this->storage_dir.'/docs/'.$site_title.'.pdf', \Mpdf\Output\Destination::FILE);
|
$mpdf->Output($this->storage_dir.'/docs/'.$site_title.'.pdf', \Mpdf\Output\Destination::FILE);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue