Path

ez components / documentation / api reference / 2009.1.2 / document


eZ Components 2009.1.2

Document: ezcDocumentPdf

[ Tutorial ] [ Conversion ] [ Styles ] [ Class tree ] [ Element index ] [ ChangeLog ] [ Credits ]

Class: ezcDocumentPdf

Document handler for PDF documents. [source]
This document handler can load Docbook documents and generate PDF documents from them. It can be configured using its option class ezcDocumentPdfOptions. The example below shows the configuration of a driver.
 1.   // Load the docbook document and create a PDF from it
 2.     $pdf new ezcDocumentPdf();
 3.   $pdf->options->driver new ezcDocumentPdfHaruDriver();
 4.  
 5.   // Load a custom style sheet
 6.     $pdf->loadStyles'custom.css' );
 7.  
 8.   // Add a customized footer
 9.     $pdf->registerPdfPartnew ezcDocumentPdfFooterPdfPart(
10.       new ezcDocumentPdfFooterOptionsarray(
11.           'showDocumentTitle'  => false,
12.           'showDocumentAuthor' => false,
13.           'height'             => '10mm',
14.       ) )
15.   ) );
16.  
17.   // Add a customized header
18.     $pdf->registerPdfPartnew ezcDocumentPdfHeaderPdfPart(
19.       new ezcDocumentPdfFooterOptionsarray(
20.           'showPageNumber'     => false,
21.           'height'             => '10mm',
22.       ) )
23.   ) );
24.  
25.   $pdf->createFromDocbook$docbook );
26.   file_put_contents__FILE__ . '.pdf'$pdf );
Like shown in the example, it is possible to load any amount of custom style definitions and register additional PDF parts, like headers and footers.

Parents

ezcDocument
   |
   --ezcDocumentPdf

Member Variables

protected string $content
The generated PDF
protected array(ezcDocumentPdfPart) $pdfParts = array()
List of PDF parts to append to documents
protected ezcDocumentPdfStyleInferencer $styles
Container for style directives.

Inherited Member Variables

From ezcDocument:
protected  ezcDocument::$errors
protected  ezcDocument::$options
protected  ezcDocument::$path

Method Summary

public void createFromDocbook( $document )
Create document from docbook document
public ezcDocumentDocbook getAsDocbook( )
Return document compiled to the docbook format
public void loadString( $string )
Create document from input string
public void loadStyles( $file )
Load style definition file
public void registerPdfPart( $part )
Append a PDF part
public string save( )
Return document as string

Inherited Methods

From ezcDocument :
public ezcDocument ezcDocument::__construct()
Construct new document
public abstract void ezcDocument::createFromDocbook()
Create document from docbook document
public abstract ezcDocumentDocbook ezcDocument::getAsDocbook()
Return document compiled to the docbook format
public array ezcDocument::getErrors()
Return list of errors occured during visiting the document.
public string ezcDocument::getPath()
Get document base path
public void ezcDocument::loadFile()
Create document from file
public abstract void ezcDocument::loadString()
Create document from input string
public abstract string ezcDocument::save()
Return document as string
public void ezcDocument::setPath()
Set document base path
public void ezcDocument::triggerError()
Trigger visitor error

Methods

createFromDocbook

void createFromDocbook( ezcDocumentDocbook $document )
Create document from docbook document
A document of the docbook format is provided and the internal document structure should be created out of this.
This method is required for all formats to have one central format, so that each format can be compiled into each other format using docbook as an intermediate format.
You may of course just call an existing converter for this conversion.

Parameters

Name Type Description
$document ezcDocumentDocbook  

Redefinition of

Method Description
ezcDocument::createFromDocbook() Create document from docbook document

getAsDocbook

ezcDocumentDocbook getAsDocbook( )
Return document compiled to the docbook format
The internal document structure is compiled to the docbook format and the resulting docbook document is returned.
This method is required for all formats to have one central format, so that each format can be compiled into each other format using docbook as an intermediate format.
You may of course just call an existing converter for this conversion.

Redefinition of

Method Description
ezcDocument::getAsDocbook() Return document compiled to the docbook format

loadString

void loadString( string $string )
Create document from input string
Create a document of the current type handler class and parse it into a usable internal structure.

Parameters

Name Type Description
$string string  

Redefinition of

Method Description
ezcDocument::loadString() Create document from input string

loadStyles

void loadStyles( string $file )
Load style definition file
Parse and load a PCSS file and use the resulting style definitions for rendering.

Parameters

Name Type Description
$file string  

registerPdfPart

void registerPdfPart( ezcDocumentPdfPart $part )
Append a PDF part
Register additional PDF parts to be included in the rendering process, like headers and footers.

Parameters

Name Type Description
$part ezcDocumentPdfPart  

save

string save( )
Return document as string
Serialize the document to a string an return it.

Redefinition of

Method Description
ezcDocument::save() Return document as string

Last updated: Tue, 01 Sep 2009