PX : code

pdfTag by Roy Kaldung
Download this code


<?php
/**
*
* Sample file #1 for pdfTag
*
**/

include("lib/pdfTag.php");

$srcXML 'xml/sample1.xml';
$pdf = new pdfTag();
$pdf->readFromFile$srcXML );
/* decide if only generate or generate and show */
if( !isset($_GET["show"])):
        
$pdf->Debug true;
        
$pdf->pdfProfile true;
        
$pdf->generatePDF();
?>
<center>
<a href="sample1.php?show">click here to display/download</a>
</center>
<?php
else:
        
$pdf->generatePDF();
        
$pdf->dumpPDF();
endif;
?>

Sample XML (extract from sample1.xml)


<?xml version="1.0" encoding="ISO-8859-1"?>
<pdftag:document author="Roy Kaldung" creator="pdfTag/PHP" title="Sample #1" xmlns:pdftag="http://www.kaldung.de/pdftag">
        <page format="A4">
                <outline id="content" text="Sample 1, Overview"/>
                <showxy x="25" y="705" text="Page 1" font="Helvetica-Bold" size="15" encoding="winansi"/>
                <locallink llx="20" lly="700" urx="100" ury="720" page="2" dest="fitpage"/>
                <showxy x="25" y="675" text="Page 2" font="Helvetica-Bold" size="15" encoding="winansi"/>
                <locallink llx="20" lly="670" urx="100" ury="690" page="3" dest="fitpage"/>
        </page>
        <page format="A4" orientation="portrait" font="Courier" size="10.0" encoding="winansi">
                <outline id="page1" parent="content">Sample 1, Page 1</outline>
                <showxy x="50" y="750">This is a sample how to use showxy</showxy>
                <showxy x="50" y="725" color="1,0,0">This is a sample how to use showxy with common attribute (color)</showxy>
                <showxy x="50" y="700">and now we have the default color without any circumstances</showxy>

                <showxy x="50" y="675" text="Some graphic elements"/>
                <showxy x="50" y="630" text="a simple circle"/>
                <circle x="250" y="630" radius="50"/>
                <showxy x="50" y="570" text="a colored circle"/>
                <circle x="450" y="570" radius="50" color="0,0,1"/>
                <showxy x="50" y="510" text="a colored, filled circle"/>
                <circle x="250" y="510" radius="50" color="0,1,0" filled="filled"/>
                <showxy x="10" y="5" font="Helvetica" size="10" encoding="winansi">back to content</showxy>
                <locallink llx="5" lly="2" urx="100" ury="18" page="1" dest="fitpage"/>
        </page>

Comments or questions?
PX is running PHP 5.2.17
Thanks to Miranda Productions for hosting and bandwidth.
Use of any code from PX is at your own risk.