-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpdf.php
More file actions
82 lines (64 loc) · 2.93 KB
/
pdf.php
File metadata and controls
82 lines (64 loc) · 2.93 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
/**
* PDF functions used by the cms module
*
* @copyright (c) by René Sato
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU General Public License (GPL)
* @since 3.0
* @author 佐藤レネー René Sato <rene.sato@gmx.de>
* @package cms
* @version $Id$
*/
include_once 'header.php';
$clean_start_id = isset($_GET['start_id']) ? filter_input(INPUT_GET, 'start_id', FILTER_SANITIZE_NUMBER_INT) : 0;
//$item_page_id = isset($_GET['page']) ? (int)($_GET['page']) : -1;
if ($clean_start_id == 0) {
redirect_header(icms_getPreviousPage(), 3, _MD_CMS_NO_CONTENT);
}
$cms_start_handler = icms_getModuleHandler("start", CMS_DIRNAME, "start");
$startObj = $cms_start_handler->get($clean_start_id);
if (!$startObj || !is_object($startObj) || $startObj->isNew()) {
redirect_header(icms_getPreviousPage(), 3, _MD_CMS_NO_CONTENT);
}
$start = $startObj->toArray();
$content = '<a href="' . ICMS_URL . '/modules/cms/start.php?start_id=' . $clean_start_id . '" title="' . $start['title'] . '">' . $start['title'] . '</a><br />';
$content .= $start['subtitle']. '<br />';
$content .= $start['extended_text'];
//$content .= icms_core_DataFilter::undoHtmlSpecialChars($cmsConfig['cms_print_footer'] . $powered_by . " " . $version);
require_once ICMS_PDF_LIB_PATH.'/tcpdf.php';
icms_loadLanguageFile('core', 'pdf');
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, TRUE, 'UTF-8', FALSE);
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor(PDF_AUTHOR);
$pdf->SetTitle($title);
$pdf->SetSubject($subtitle);
$pdf->SetKeywords($keywords);
$sitename = $icmsConfig['sitename'];
$siteslogan = $icmsConfig['slogan'];
$pdfheader = icms_core_DataFilter::undoHtmlSpecialChars($sitename.' - '.$siteslogan);
$pdf->SetHeaderData($cmsConfig['cms_print_logo'], $sitename, $pdfheader, ICMS_URL);
// set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
//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
//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
$pdf->setLanguageArray($l); //set language items
// set default font subsetting mode
$pdf->setFontSubsetting(TRUE);
// set font
$TextFont = (@_PDF_LOCAL_FONT && file_exists(ICMS_PDF_LIB_PATH.'/fonts/'._PDF_LOCAL_FONT.'.php')) ? _PDF_LOCAL_FONT : 'arialunicid0';
$pdf -> SetFont($TextFont);
//$pdf->SetFont('arialunicid0', '', 14, '', true);
//initialize document
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->writeHTML($content, TRUE, 0);
return $pdf->Output();