diff options
Diffstat (limited to 'views/list')
| -rw-r--r-- | views/list/export/index.php | 39 | ||||
| -rw-r--r-- | views/list/export/meta.php | 4 |
2 files changed, 43 insertions, 0 deletions
diff --git a/views/list/export/index.php b/views/list/export/index.php new file mode 100644 index 0000000..6e58405 --- /dev/null +++ b/views/list/export/index.php @@ -0,0 +1,39 @@ +<?php + namespace Dompdf; + + require_once(__DIR__ . '/../../../libs/dompdf/autoload.inc.php'); + use Dompdf\Dompdf; + use Dompdf\Options; + + try { + createWithDOMPDF(); + } + catch (Exception $e) {} + + function createWithDOMPDF() { + $url = $_GET['url']; + $title = $_GET['title']; + $wid = $_GET['wid']; + $archive_dir = __DIR__ . '/../../../.archives/' . $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'); + } +?> diff --git a/views/list/export/meta.php b/views/list/export/meta.php new file mode 100644 index 0000000..2546db5 --- /dev/null +++ b/views/list/export/meta.php @@ -0,0 +1,4 @@ +<?php + +$title = 'Export to PDF'; +$controller = 'list'; |
