* @author Sina Asghari (AKA stranger) * @version $Id: makepdf.php 335 2011-12-05 20:24:01Z lusopoemas@gmail.com $ */ error_reporting(0); include_once dirname(__FILE__) . '/header.php'; $itemid = SmartsectionRequest::getInt('itemid'); $item_page_id = SmartsectionRequest::getInt('page', -1); if ($itemid == 0) { redirect_header("javascript:history.go(-1)", 1, _MD_SMARTSECTION_NOITEMSELECTED); exit(); } // Creating the item object for the selected item $itemObj = $smartsection->getHandler('item')->get($itemid); // if the selected item was not found, exit if (!$itemObj) { redirect_header("javascript:history.go(-1)", 1, _MD_SMARTSECTION_NOITEMSELECTED); exit(); } // Creating the category object that holds the selected item $categoryObj = $smartsection->getHandler('category')->get($itemObj->categoryid()); // Check user permissions to access that category of the selected item if (!$itemObj->accessGranted()) { redirect_header("javascript:history.go(-1)", 1, _NOPERM); exit(); } require_once SMARTSECTION_ROOT_PATH . '/tcpdf/tcpdf.php'; xoops_loadLanguage('main', SMARTSECTION_DIRNAME); $dateformat = $itemObj->datesub(); $sender_inform = sprintf(_MD_SMARTSECTION_WHO_WHEN, $itemObj->posterName(), $itemObj->datesub()); $mainImage = $itemObj->getMainImage(); $content = ''; if ($mainImage['image_path'] != '') { $content .= '' . $myts->undoHtmlSpecialChars($mainImage['image_name']) . ''; } $content .= '' . $myts->undoHtmlSpecialChars($itemObj->title()) . ''; $content .= '
'; $content .= '' . _CO_SMARTSECTION_CATEGORY . ' : ' . $myts->undoHtmlSpecialChars($categoryObj->name()) . ''; $content .= '
'; $content .= '' . $sender_inform . ''; $content .= '

'; $content .= $myts->undoHtmlSpecialChars($itemObj->plain_maintext()); $content = smartsection_convertCharset($content); $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $doc_title = smartsection_convertCharset($myts->undoHtmlSpecialChars($itemObj->title())); $doc_keywords = 'XOOPS'; // set document information $pdf->SetCreator(PDF_CREATOR); $pdf->SetAuthor(PDF_AUTHOR); $pdf->SetTitle($doc_title); $pdf->SetSubject($doc_title); $pdf->SetKeywords($doc_keywords); $firstLine = smartsection_convertCharset($xoopsConfig['sitename']); $secondLine = smartsection_convertCharset($xoopsConfig['slogan']); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, $firstLine, $secondLine); //set margins $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); //set auto page breaks $pdf->SetAutoPageBreak(true, PDF_MARGIN_BOTTOM); $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); //set image scale factor $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); $filename = SMARTSECTION_ROOT_PATH . '/tcpdf/config/lang/' . _LANGCODE . '.php'; if (file_exists($filename)) { include_once $filename; } else { include_once SMARTSECTION_ROOT_PATH . '/tcpdf/config/lang/en.php'; } $pdf->setLanguageArray($l); //set language items if (_CHARSET == 'windows-1256') { $pdf->SetFont('almohanad', '', 18); } //initialize document $pdf->AliasNbPages(); $pdf->AddPage(); $pdf->writeHTML($content, true, 0, true, 0); $pdf->Output(); ?>