JDocumentPDF/render
From Joomla! Documentation
< API15:JDocumentPDFRevision as of 17:19, 22 March 2010 by Doxiki (talk | contribs) (New page: ===Description===
Render the document.
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>Edit Descripton<nowiki>]</nowiki>
</spa...)
Revision as of 17:19, 22 March 2010 by Doxiki (talk | contribs) (New page: ===Description===
Render the document.
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>Edit Descripton<nowiki>]</nowiki>
</spa...)
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
The "API15" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.
Description[edit]
Render the document.
Template:Description:JDocumentPDF/render
Syntax[edit]
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[edit]
The rendered data
Defined in[edit]
libraries/joomla/document/pdf/pdf.php
Importing[edit]
jimport( 'joomla.document.pdf.pdf' );
Source Body[edit]
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] Template:SeeAlso:JDocumentPDF/render
Examples[edit]
<CodeExamplesForm />