Files
@ f43d1a4680a9
Branch filter:
Location: hot67beta/libraries/joomla/document/pdf/pdf.php - annotation
f43d1a4680a9
5.6 KiB
text/x-php
menubar 0 to 10
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 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 c7d7e38b2269 | <?php
/**
* @version $Id: pdf.php 10707 2008-08-21 09:52:47Z eddieajau $
* @package Joomla.Framework
* @subpackage Document
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/
// Check to ensure this file is within the rest of the framework
defined('JPATH_BASE') or die();
/**
* DocumentPDF class, provides an easy interface to parse and display a pdf document
*
* @package Joomla.Framework
* @subpackage Document
* @since 1.5
*/
class JDocumentPDF extends JDocument
{
var $_engine = null;
var $_name = 'joomla';
var $_header = null;
var $_margin_header = 5;
var $_margin_footer = 10;
var $_margin_top = 27;
var $_margin_bottom = 25;
var $_margin_left = 15;
var $_margin_right = 15;
// Scale ratio for images [number of points in user unit]
var $_image_scale = 4;
/**
* Class constructore
*
* @access protected
* @param array $options Associative array of options
*/
function __construct($options = array())
{
parent::__construct($options);
if (isset($options['margin-header'])) {
$this->_margin_header = $options['margin-header'];
}
if (isset($options['margin-footer'])) {
$this->_margin_footer = $options['margin-footer'];
}
if (isset($options['margin-top'])) {
$this->_margin_top = $options['margin-top'];
}
if (isset($options['margin-bottom'])) {
$this->_margin_bottom = $options['margin-bottom'];
}
if (isset($options['margin-left'])) {
$this->_margin_left = $options['margin-left'];
}
if (isset($options['margin-right'])) {
$this->_margin_right = $options['margin-right'];
}
if (isset($options['image-scale'])) {
$this->_image_scale = $options['image-scale'];
}
//set mime type
$this->_mime = 'application/pdf';
//set document type
$this->_type = 'pdf';
/*
* Setup external configuration options
*/
define('K_TCPDF_EXTERNAL_CONFIG', true);
/*
* Path options
*/
// Installation path
define("K_PATH_MAIN", JPATH_LIBRARIES.DS."tcpdf");
// URL path
define("K_PATH_URL", JPATH_BASE);
// Fonts path
define("K_PATH_FONTS", JPATH_SITE.DS.'language'.DS."pdf_fonts".DS);
// Cache directory path
define("K_PATH_CACHE", K_PATH_MAIN.DS."cache");
// Cache URL path
define("K_PATH_URL_CACHE", K_PATH_URL.DS."cache");
// Images path
define("K_PATH_IMAGES", K_PATH_MAIN.DS."images");
// Blank image path
define("K_BLANK_IMAGE", K_PATH_IMAGES.DS."_blank.png");
/*
* Format options
*/
// Cell height ratio
define("K_CELL_HEIGHT_RATIO", 1.25);
// Magnification scale for titles
define("K_TITLE_MAGNIFICATION", 1.3);
// Reduction scale for small font
define("K_SMALL_RATIO", 2/3);
// Magnication scale for head
define("HEAD_MAGNIFICATION", 1.1);
/*
* Create the pdf document
*/
jimport('tcpdf.tcpdf');
// Default settings are a portrait layout with an A4 configuration using millimeters as units
$this->_engine = new TCPDF();
//set margins
$this->_engine->SetMargins($this->_margin_left, $this->_margin_top, $this->_margin_right);
//set auto page breaks
$this->_engine->SetAutoPageBreak(TRUE, $this->_margin_bottom);
$this->_engine->SetHeaderMargin($this->_margin_header);
$this->_engine->SetFooterMargin($this->_margin_footer);
$this->_engine->setImageScale($this->_image_scale);
}
/**
* Sets the document name
*
* @param string $name Document name
* @access public
* @return void
*/
function setName($name = 'joomla') {
$this->_name = $name;
}
/**
* Returns the document name
*
* @access public
* @return string
*/
function getName() {
return $this->_name;
}
/**
* Sets the document header string
*
* @param string $text Document header string
* @access public
* @return void
*/
function setHeader($text) {
$this->_header = $text;
}
/**
* Returns the document header string
*
* @access public
* @return string
*/
function getHeader() {
return $this->_header;
}
/**
* Render the document.
*
* @access public
* @param boolean $cache If true, cache the output
* @param array $params Associative array of attributes
* @return The rendered data
*/
function render( $cache = false, $params = array())
{
$pdf = &$this->_engine;
// Set PDF Metadata
$pdf->SetCreator($this->getGenerator());
$pdf->SetTitle($this->getTitle());
$pdf->SetSubject($this->getDescription());
$pdf->SetKeywords($this->getMetaData('keywords'));
// Set PDF Header data
$pdf->setHeaderData('',0,$this->getTitle(), $this->getHeader());
// Set PDF Header and Footer fonts
$lang = &JFactory::getLanguage();
$font = $lang->getPdfFontName();
$font = ($font) ? $font : 'freesans';
$pdf->setRTL($lang->isRTL());
$pdf->setHeaderFont(array($font, '', 10));
$pdf->setFooterFont(array($font, '', 8));
// Initialize PDF Document
$pdf->AliasNbPages();
$pdf->AddPage();
// Build the PDF Document string from the document buffer
$this->fixLinks();
$pdf->WriteHTML($this->getBuffer(), true);
$data = $pdf->Output('', 'S');
// Set document type headers
parent::render();
//JResponse::setHeader('Content-Length', strlen($data), true);
JResponse::setHeader('Content-disposition', 'inline; filename="'.$this->getName().'.pdf"', true);
//Close and output PDF document
return $data;
}
function fixLinks()
{
}
}
|