|
|
|
Xml2Pdf documentation
|
Xml2Pdf documentation
|
Tag pdf
|
Tags Xml2Pdf
Tags Xml2Pdf
Table of Contents
Guillaume Luchet, guillaume@geelweb.org
Copyright © 2006, Guillaume Luchet
BSD License
Tags manual
Create tags
The tags recognize by Xml2Pdf are define using plugins files. To create a new tag, you must just create a new plugin file and put it in the plugins tags directory who is defined in the config file Xml2Pdf.config.php
eg, to create a tag custom, you must create a file named xml2pdf.tag.custom.php with a class named Xml2PdfTag_custom.
The plugin class must have the following methods :
If the constructor take three parameters, the third will be the parent tag of the curent tag.
example :
class Xml2PdfTag_custom {
/**
* parent tag
* @var object
*/
public $parent;
/**
* object Pdf.
* @var object
*/
public $pdf;
/**
* tag content
* @var string
*/
public $content;
/**
* Constructor.
*
* call when the tag custom is open.
*
* @param object $pdf Object Pdf
* @param array $tagProperties tag properties
* @param object $parent tag parent
* @return void
*/
public function __construct($pdf, $tagProperties, $parent) {
// here you can parse the tag properties
}
/**
* add the content
*
* @param string $content tag content
* @return void
*/
public function addContent($content) {
// here you can manage the content
}
/**
* call when the tag is closed
*
* @return void
*/
public function close() {
// here you can maange the actions to do when the tag is closed
}
}
To the following XML :
<parent foo="foovalue">
<custom bar="barvalue">custom tag content.</custom>
</parent>
The PHP code will be :
// <parent foo="foovalue">
require_once('xml2pdf.tag_parent.php');
$parentTag = new Xml2PdfTag_parent($pdfObject, array('FOO'=>'foovalue'));
// <custom bar="barvalue">
require_once('xml2pdf.tag_custom.php');
$customTag = new Xml2PdfTag_custom($pdfObject, array('BAR'=>'barvalue'), $parentTag);
// custom tag content.
// </custom>
// </parent>
Existing tags
The existing tags plugins are :
|
|
|
Xml2Pdf documentation
|
Xml2Pdf documentation
|
Tag pdf
|
Documentation generated on Wed, 11 Oct 2006 22:27:05 +0200 by phpDocumentor 1.3.0