-
Notifications
You must be signed in to change notification settings - Fork 18
/
boot.php
executable file
·26 lines (24 loc) · 956 Bytes
/
boot.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
$addon = rex_addon::get('pdfout');
rex_dir::create($addon->getCachePath());
rex_dir::create(rex_path::addonCache('pdfout', 'fonts'));
require_once $addon->getPath('vendor/' . 'autoload.php');
if (rex::isBackend() && rex::getUser() !== null) {
$print_pdftest = rex_request('pdftest', 'int');
if ($print_pdftest === 1) {
$file = '';
$file = rex_file::get(rex_path::addon('pdfout', 'README.md'));
if ($file !== '' && $file !== null) {
$readmeHtml = '<style>body {font-family: DejaVu Sans; }</style>' . rex_markdown::factory()->parse($file);
$pdf = new PdfOut();
$pdf->setName('PDFOut-Readme')
->setFont('DejaVu Sans')
->setHtml($readmeHtml, true)
->setOrientation('portrait')
->setAttachment(false)
->setRemoteFiles(false);
// execute and generate
$pdf->run();
}
}
}