Source code for file /joomla/document/pdf/pdf.php
Documentation is available at pdf.php
* @version $Id: pdf.php 10707 2008-08-21 09:52:47Z eddieajau $
* @package Joomla.Framework
* @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
* DocumentPDF class, provides an easy interface to parse and display a pdf document
* @package Joomla.Framework
// Scale ratio for images [number of points in user unit]
* @param array $options Associative array of options
if (isset
($options['margin-header'])) {
if (isset
($options['margin-footer'])) {
if (isset
($options['margin-top'])) {
if (isset
($options['margin-bottom'])) {
if (isset
($options['margin-left'])) {
if (isset
($options['margin-right'])) {
if (isset
($options['image-scale'])) {
$this->_mime =
'application/pdf';
* Setup external configuration options
define('K_TCPDF_EXTERNAL_CONFIG', true);
define("K_PATH_MAIN", JPATH_LIBRARIES.
DS.
"tcpdf");
define("K_PATH_URL", JPATH_BASE);
define("K_PATH_FONTS", JPATH_SITE.
DS.
'language'.
DS.
"pdf_fonts".
DS);
define("K_CELL_HEIGHT_RATIO", 1.25);
// Magnification scale for titles
define("K_TITLE_MAGNIFICATION", 1.3);
// Reduction scale for small font
// Magnication scale for head
define("HEAD_MAGNIFICATION", 1.1);
* Create the pdf document
// Default settings are a portrait layout with an A4 configuration using millimeters as units
* @param string $name Document name
function setName($name =
'joomla') {
* Returns the document name
* Sets the document header string
* @param string $text Document header string
* Returns the document header string
* @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())
// Set PDF Header and Footer fonts
$font =
$lang->getPdfFontName();
$font =
($font) ?
$font :
'freesans';
$pdf->setRTL($lang->isRTL());
$pdf->setHeaderFont(array($font, '', 10));
$pdf->setFooterFont(array($font, '', 8));
// Initialize PDF Document
// Build the PDF Document string from the document buffer
$data =
$pdf->Output('', 'S');
// Set document type headers
//JResponse::setHeader('Content-Length', strlen($data), true);
//Close and output PDF document