mirror of
https://github.com/wallabag/wallabag.git
synced 2025-08-26 18:21:02 +00:00
add pdf and mobi libraries
This commit is contained in:
parent
2b58426b2d
commit
4188f38ad5
297 changed files with 126557 additions and 7 deletions
48
inc/3rdparty/libraries/mpdf/examples/show_code.php
vendored
Normal file
48
inc/3rdparty/libraries/mpdf/examples/show_code.php
vendored
Normal file
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
|
||||
if ($_REQUEST['filename']) { $filename = $_REQUEST['filename']; }
|
||||
else { die("No file specified"); }
|
||||
|
||||
include("../mpdf.php");
|
||||
|
||||
$mpdf=new mPDF('utf-8-s');
|
||||
$mpdf->debug=true;
|
||||
$mpdf->tabSpaces = 6;
|
||||
|
||||
$mpdf->allow_charset_conversion=true;
|
||||
$mpdf->charset_in='windows-1252';
|
||||
|
||||
//==============================================================
|
||||
preg_match('/example[0]{0,1}(\d+)_(.*?)\.php/',$filename,$m);
|
||||
$num = intval($m[1]);
|
||||
$title = ucfirst(preg_replace('/_/',' ',$m[2]));
|
||||
|
||||
if (!$num || !$title) { die("Invalid file"); }
|
||||
if (preg_match('/\//', $filename) || !preg_match('/\.php$/',$filename)) { die("Hacking attempt"); }
|
||||
|
||||
$html = '
|
||||
<h1>mPDF</h1>
|
||||
<h2>Example '.$num.'. '.$title.'</h2>
|
||||
<div style="border:1px solid #555555; background-color: #DDDDDD; padding: 1em; font-size:8pt; font-family: lucidaconsole, mono;">
|
||||
';
|
||||
$lines = file($filename);
|
||||
|
||||
$html .= '<pre>';
|
||||
foreach($lines AS $line) {
|
||||
$html .= htmlspecialchars($line);
|
||||
}
|
||||
$html .= '</pre>';
|
||||
$html .= '</div>';
|
||||
|
||||
$mpdf->WriteHTML($html,2); // The 2 is important to prevent <style etc. being parsed
|
||||
|
||||
$mpdf->Output();
|
||||
exit;
|
||||
//==============================================================
|
||||
//==============================================================
|
||||
//==============================================================
|
||||
//==============================================================
|
||||
//==============================================================
|
||||
|
||||
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue