PDF Template Documentation

1) Usage

$mypdf = new PDFTemplate("pdf.xml",$debug);
$mypdf->Assign("NAME","Jon Doe");
$mypdf->Assign("USERNAME","jdoe");
$mypdf->Assign("PASSWORD","54321");
$mypdf->Parse();

$mypdf->Close();

class initialization

The parameters are the name of the file and an optional debug flag. setting debug to 1 will result in a text out of the PDF renderer parsing. Use this to debug erroneous XML files.

Assign

Assigns the variable in parameter one to the value of parameter two.

Parse

The Parse command parses the entire file and renders each page to the client while substituting the variables.

Close

the close command closes the PDF document and finishes sending the document to the client.

2) Fonts

Helvetica

Courier

Times-Roman

3) Elements/Input file format.

Begins with a standard XML tag line.

<?xml version="1.0" encoding="ISO-8859-1"?>

Then the opening PDF tag.

<pdf xmlns:pdf="pdf.dtd">

The file must end with a </PDF>

PAGE

Specifies a page break. All tags contained within the page tag will appear on the same page. (as long as it all fits)

Attributes:

MARGIN: Margin size in inches. Default 0.5 inches

WIDTH: Page width in inches. Default 8.5 inches.

HEIGHT: Page height in inches. Default 11 inches.

PARA

A paragraph marking. Text will be word wrapped and a line feed after the last line of text. All text must be in a paragraph.

Attributes:

INDENT: set to 1 to indent the first line of the paragraph by 1 half inch.

TAB: indent the entire paragraph by x inches.

ALIGN: alignment. Left,center,right,justified.

NOBREAK: set to 1 to prevent the trailing line feed.

BOLD

Changes the font to bold

ITALIC

Changes the font to italics

FONT

Changes the current font.

Attributes:

FONT: the font to change to.

SIZE: the point size.

TAB

Set the TAB attribute to the next point where text is printed to this offset from left edge of page (ignoring margin.)

This tag does not have a closing TAG. use it like <TAB tab="4"/>

BR

Forces a hard break with no linefeed.

This tag does not have a closing TAG. use it like <BR/>