Source code for file /joomla/document/pdf/pdf.php
Documentation is available at pdf.php
* @version $Id: pdf.php 6677 2007-02-19 07:18:06Z louis $
* @package Joomla.Framework
* @copyright Copyright (C) 2005 - 2007 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_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
define("PDF_FONT_NAME_MAIN", 'vera');
define("PDF_FONT_SIZE_MAIN", 10);
define("PDF_FONT_NAME_DATA", 'vera');
define("PDF_FONT_SIZE_DATA", 8);
* @param string $name Document name
* Returns the document name
* Sets the document header string
* @param string $text Document header string
* Returns the document header string
* Get the contents of the document buffer
* @return The contents of the document buffer
* Set the contents of the document buffer
* @param string $content The content to be set in the buffer
* Set the contents of the document buffer
* @param string $content The content to be set in the buffer
$this->_data .=
$content;
* @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
$pdf->setHeaderFont(array('vera', '', 10));
$pdf->setFooterFont(array('vera', '', 8));
// Initialize PDF Document
// Build the PDF Document string from the document buffer
$pdf->WriteHTML($this->getData(), true);
$data =
$pdf->Output('', 'S');
// Set document type headers
//JResponse::setHeader('Content-Length', strlen($data), true);
//Close and output PDF document