6
Quote:
jdseymour wrote:
Not a module, but I found a PHP program that I am looking at for perhaps possible use with my XOOPS site.
It is dompdf
I haven't had much time to read through the documentation. It is written for PHP5, but states that it should work with PHP4 versions.
Let me know what you think.
Looks very interesting. So far, we have looked at CPDF, FPDF and PDML, the latter being an HTML-like syntax for PDF files that has its limits and generally not ready for inclusion, I think.
If dompdf does what it says on the box, I am impressed and excited - especially since they practically endorse the use of Smarty or similar template engines. It would be great if it could be tried out.
Something like this, in footer.php (starting at line 43):
else {
// RMV-NOTIFY
include_once XOOPS_ROOT_PATH . '/include/notification_select.php';
if (isset($xoopsOption['template_main'])) {
if (isset($xoopsCachedTemplateId)) {
$xoopsTpl->assign('xoops_contents', $xoopsTpl->fetch('db:'.$xoopsOption['template_main'], $xoopsCachedTemplateId));
} else {
$xoopsTpl->assign('xoops_contents', $xoopsTpl->fetch('db:'.$xoopsOption['template_main']));
}
} else {
if (isset($xoopsCachedTemplate)) {
$xoopsTpl->assign('dummy_content', ob_get_contents());
$xoopsTpl->assign('xoops_contents', $xoopsTpl->fetch($xoopsCachedTemplate, $xoopsCachedTemplateId));
} else {
$xoopsTpl->assign('xoops_contents', ob_get_contents());
}
ob_end_clean();
}
[color=cc0000]if (isset($_GET['pdf']) ) {
$tmpfile = tempnam(XOOPS_UPLOAD_PATH, "dompdf_");
file_put_contents($tmpfile, $xoopsTpl->getTemplateVars('xoops_contents'));
$url = XOOPS_URL."/dompdf.php?input_file=" . rawurlencode($tmpfile) . "&paper=letter&output_file=" . rawurlencode("My Fancy PDF.pdf");
header("Location: ".$url);
exit();
}[/color]
if (!headers_sent()) {
header('Content-Type:text/html; charset='._CHARSET);
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
//header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: private, no-cache');
header('Pragma: no-cache');
}
$xoopsTpl->xoops_setCaching(0);
$xoopsTpl->display($xoopsConfig['theme_set'].'/theme.html');
}
Provided the dompdf file is in the XOOPS root and there is a GET parameter called 'pdf' it should execute that code instead of displaying the page.
Anyone volunteering to try it out?