Actions

API15

JDocumentPDF/render

From Joomla! Documentation

< API15:JDocumentPDF
Revision as of 17:19, 22 March 2010 by Doxiki (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

Render the document.

[Edit Descripton]

Description:JDocumentPDF/render

Syntax

render($cache=false, $params=array())
Parameter Name Default Value Description
$cache false $cache If true, cache the output
$params array() $params Associative array of attributes

Returns

The rendered data

Defined in

libraries/joomla/document/pdf/pdf.php

Importing

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

Source Body

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

[Edit See Also] SeeAlso:JDocumentPDF/render

Examples

<CodeExamplesForm />