Actions

API15

JDocumentPDF/ construct

From Joomla! Documentation

< API15:JDocumentPDF
Revision as of 09:06, 12 May 2013 by JoomlaWikiBot (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

Contents

Description

Class constructore

[<! removed edit link to red link >]

<! removed transcluded page call, red link never existed >

Syntax

__construct($options=array())
Parameter Name Default Value Description
$options array() $options Associative array of options

Defined in

libraries/joomla/document/pdf/pdf.php

Importing

jimport( 'joomla.document.pdf.pdf' );

Source Body

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);
}

[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >

Examples

<CodeExamplesForm />