<?php /** * define database connection configuration */ define('PDF_DIR', $_SERVER['DOCUMENT_ROOT'] . '/pathtosavepdf/'); $dbConfig['host'] = 'localhost'; $dbConfig['database'] = 'mydb'; $dbConfig['username'] = '******'; $dbConfig['password'] = '******'; // convert array to object $dbConfig = (object) $dbConfig; // include pdf file include_once 'tcpdfClass.php'; // create pdf class with database configuration $obj = new PdfGenerator($dbConfig); // call pdf function $obj->CreatePdf(); echo "PDF Created!";
if (isset($_REQUEST['display'])) { // Remove icons and actions that should not be printed $prefs['forum_thread_user_settings'] = 'n'; $smarty->assign('display', $_REQUEST['display']); $smarty->assign('thread_show_comment_footers', 'n'); $smarty->assign('thread_show_pagination', 'n'); $smarty->assign('tiki_p_forum_post', 'n'); $smarty->assign('tiki_p_admin_forum', 'n'); $smarty->assign('tiki_p_forum_edit_own_posts', 'n'); $smarty->assign('tiki_p_notepad', 'n'); // Display the forum messages $smarty->assign('mid', 'tiki-print_forum_thread.tpl'); // Allow PDF export by installing a Mod that define an appropriate function if ($_REQUEST['display'] == 'pdf') { require_once 'lib/pdflib.php'; $generator = new PdfGenerator(); $pdf = $generator->getPdf('tiki-view_forum_thread.php', array('display' => 'print', 'comments_parentId' => $_REQUEST['comments_parentId'], 'forumId' => $_REQUEST['forumId'])); header('Cache-Control: private, must-revalidate'); header('Pragma: private'); header("Content-Description: File Transfer"); header('Content-disposition: attachment; filename="' . $thread_info['title'] . '.pdf"'); header("Content-Type: application/pdf"); header("Content-Transfer-Encoding: binary"); header('Content-Length: ' . strlen($pdf)); echo $pdf; } else { $smarty->display('tiki-print.tpl'); } } else { $smarty->assign('pdf_export', $prefs['print_pdf_from_url'] != 'none' ? 'y' : 'n'); $smarty->assign('display', '');
$crumbs[] = new Breadcrumb($crumbpage, $info["description"], 'tiki-index.php?page=' . urlencode($page), '', ''); ask_ticket('print'); // disallow robots to index page: $smarty->assign('metatag_robots', 'NOINDEX, NOFOLLOW'); // Display the Index Template $creator = $wikilib->get_creator($page); $smarty->assign('creator', $creator); $smarty->assign('print_page', 'y'); $smarty->assign('urlprefix', $base_url); // Obsolete, use base_url instead. This is for compatibility purposes only. $smarty->assign('mid', 'tiki-show_page.tpl'); $smarty->assign('display', isset($_REQUEST['display']) ? $_REQUEST['display'] : ''); // Allow PDF export by installing a Mod that define an appropriate function if (isset($_REQUEST['display']) && $_REQUEST['display'] == 'pdf') { require_once 'lib/pdflib.php'; $generator = new PdfGenerator(); $pdf = $generator->getPdf('tiki-print.php', array('page' => $page)); if (empty($pdf)) { echo "Unable to generate PDF"; } else { $length = strlen($pdf); header('Cache-Control: private, must-revalidate'); header('Pragma: private'); header("Content-Description: File Transfer"); header('Content-disposition: attachment; filename="' . $page . '.pdf"'); header("Content-Type: application/pdf"); header("Content-Transfer-Encoding: binary"); header('Content-Length: ' . $length); echo $pdf; } } else {
--$h; $pages[] = $page_info; } } } $smarty->assign_by_ref('pages', $pages); ask_ticket('multiprint'); // disallow robots to index page: $smarty->assign('metatag_robots', 'NOINDEX, NOFOLLOW'); $smarty->assign('print_page', 'y'); if (isset($_REQUEST['display'])) $smarty->assign('display', $_REQUEST['display']); // Allow PDF export by installing a Mod that define an appropriate function if (isset($_REQUEST['display']) && $_REQUEST['display'] == 'pdf') { require_once 'lib/pdflib.php'; $generator = new PdfGenerator(); $pdf = $pdfname = ''; if (!empty($printpages)) { $pdf = $generator->getPdf('tiki-print_multi_pages.php', array('print' => 'print', 'printpages' => $_REQUEST['printpages'] )); $pdfname = implode(', ', $printpages); } else if (!empty($printstructures)) { $pdf = $generator->getPdf('tiki-print_multi_pages.php', array('print' => 'print', 'printstructures' => $_REQUEST['printstructures'] )); $pdfname = implode(', ', $printstructures); } else { $smarty->display("tiki-print_multi_pages.tpl"); die; }
function wikiplugin_archivebuilder_pagetopdf($file, $pageName) { if (!Perms::get('wiki page', $pageName)->view) { return array(); } require_once 'lib/pdflib.php'; $generator = new PdfGenerator(); $params = array('page' => $pageName); $args = func_get_args(); $args = array_slice($args, 2); foreach ($args as $arg) { list($key, $value) = explode('=', $arg, 2); $params[$key] = $value; } return array($file => $generator->getPdf('tiki-print.php', $params)); }
/** * Initialize CakePdf object * @param array $params * @return boolean */ public function init($params) { if (empty($params)) { return false; } $params = $this->__buildParams($params); $this->config = Configure::read('PdfGenerator.pdf'); $this->generateParams = $params; self::$pageNumber = 0; require_once App::pluginPath('CakePdf') . 'Pdf/CakePdf.php'; $this->CakePdf = new CakePdf(); //$this->CakePdf->theme($pdf['theme']); $this->CakePdf->css($this->config['css']); $this->CakePdf->template($this->config['template'], false); $this->CakePdf->margin(Configure::read('CakePdf.margin')); foreach ($this->config['pages'] as &$page) { $el = explode(DS, $page['element']); if (end($el) == 'documents') { $page['settings']['documents'] = $this->getDataDocumentsByUrl($params['curl']); break; } } $viewVars = array('pdf' => array('pages' => $this->config['pages'], 'date' => $this->getDate(), 'curl' => $this->getDocumentsUrl($params['curl']))); $this->CakePdf->viewVars($viewVars); return true; }