API15:JDocumentPDF/render
From Joomla! Documentation
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.
[<! removed edit link to red link >]
<! removed transcluded page call, red link never existed >
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; }
[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >
Examples
<CodeExamplesForm />
