aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc/3rdparty/libraries/mpdf/examples/show_code.php
diff options
context:
space:
mode:
authortcit <tcit@tcit.fr>2014-07-24 15:49:36 +0200
committertcit <tcit@tcit.fr>2014-07-24 15:49:36 +0200
commit4188f38ad56d7ba2ea46e94403f305243514f80c (patch)
treef357ddbd0d846ebae0ecf5d2ab00d6b7dd6eb8d5 /inc/3rdparty/libraries/mpdf/examples/show_code.php
parent2b58426b2d4a7f1585d5d7667c0a4fbea4cd29dd (diff)
downloadwallabag-4188f38ad56d7ba2ea46e94403f305243514f80c.tar.gz
wallabag-4188f38ad56d7ba2ea46e94403f305243514f80c.tar.zst
wallabag-4188f38ad56d7ba2ea46e94403f305243514f80c.zip
add pdf and mobi libraries
Diffstat (limited to 'inc/3rdparty/libraries/mpdf/examples/show_code.php')
-rw-r--r--inc/3rdparty/libraries/mpdf/examples/show_code.php48
1 files changed, 48 insertions, 0 deletions
diff --git a/inc/3rdparty/libraries/mpdf/examples/show_code.php b/inc/3rdparty/libraries/mpdf/examples/show_code.php
new file mode 100644
index 00000000..32bc7625
--- /dev/null
+++ b/inc/3rdparty/libraries/mpdf/examples/show_code.php
@@ -0,0 +1,48 @@
1<?php
2
3if ($_REQUEST['filename']) { $filename = $_REQUEST['filename']; }
4else { die("No file specified"); }
5
6include("../mpdf.php");
7
8$mpdf=new mPDF('utf-8-s');
9$mpdf->debug=true;
10$mpdf->tabSpaces = 6;
11
12$mpdf->allow_charset_conversion=true;
13$mpdf->charset_in='windows-1252';
14
15//==============================================================
16preg_match('/example[0]{0,1}(\d+)_(.*?)\.php/',$filename,$m);
17$num = intval($m[1]);
18$title = ucfirst(preg_replace('/_/',' ',$m[2]));
19
20if (!$num || !$title) { die("Invalid file"); }
21if (preg_match('/\//', $filename) || !preg_match('/\.php$/',$filename)) { die("Hacking attempt"); }
22
23$html = '
24<h1>mPDF</h1>
25<h2>Example '.$num.'. '.$title.'</h2>
26<div style="border:1px solid #555555; background-color: #DDDDDD; padding: 1em; font-size:8pt; font-family: lucidaconsole, mono;">
27';
28$lines = file($filename);
29
30$html .= '<pre>';
31foreach($lines AS $line) {
32 $html .= htmlspecialchars($line);
33}
34$html .= '</pre>';
35$html .= '</div>';
36
37$mpdf->WriteHTML($html,2); // The 2 is important to prevent <style etc. being parsed
38
39$mpdf->Output();
40exit;
41//==============================================================
42//==============================================================
43//==============================================================
44//==============================================================
45//==============================================================
46
47
48?> \ No newline at end of file