-
Notifications
You must be signed in to change notification settings - Fork 18
/
boot.php
executable file
·49 lines (45 loc) · 1.37 KB
/
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
use FriendsOfRedaxo\PDFOut\PdfOut;
$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);
// Setze ein Grundtemplate
$pdf->setBaseTemplate('
<!DOCTYPE html>
<html>
<head>
<title>Mein PDF</title>
<style>
body { font-family: Arial, sans-serif; }
.header { background-color: #f0f0f0; padding: 10px; }
.footer { text-align: center; margin-top: 20px; }
</style>
</head>
<body>
<div class="header">
<h1>PDFOut</h1>
</div>
{{CONTENT}}
</body>
</html>
');
// execute and generate
$pdf->run();
}
}
}