blob: e38be24e232c3571def29f8839dd252d7d57e2ec (
plain) (
blame)
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
|
<?php
namespace Dompdf;
require_once(__DIR__ . '/../../../libs/dompdf/autoload.inc.php');
use Dompdf\Dompdf;
use Dompdf\Options;
try {
createWithDOMPDF();
}
catch (Exception $e) {}
function createWithDOMPDF() {
global $ARCHIVES_DIR;
$url = $_GET['url'];
$title = $_GET['title'];
$wid = $_GET['wid'];
$archive_dir = $ARCHIVES_DIR . '/' . $wid;
$html = file_get_contents($archive_dir . '/index.php');
$dompdf = new Dompdf();
$options = $dompdf->getOptions();
$options->setDefaultFont('DejaVu Sans');
$options->setIsPhpEnabled(True);
$options->setIsJavascriptEnabled(True);
$options->setIsRemoteEnabled(True);
$options->setChroot($archive_dir . '/../');
$options->setIsHtml5ParserEnabled(True);
$dompdf->setOptions($options);
$dompdf->setBasePath($archive_dir);
$dompdf->loadHTML($html);
$dompdf->setBasePath($archive_dir);
$dompdf->setPaper('A4', 'landscape');
$dompdf->render();
//$dompdf->stream($title . '.pdf', array('Attachment'=>0));
// NOTE: Uncomment this to enable the download
$dompdf->stream($title . '.pdf');
}
?>
|