About pdfTag
Changelog
Download pdfTag
Documentation
License
News
TODO-List
Samples
Valid XHTML 1.0! Valid CSS!     
imprint / Impressum
Menu
Documentation
 


Content



how to use pdfTag

Creating pdfs with pdfTag is quiet easy as creating webpages.

First of all you need a XML source. Here is an example:

Listing 1: xml source 'sample.xml'

<?xml version="1.0" encoding="ISO-8859-1"?>
<document>
  <page format="A4">
    <setfont font="Helvetica" size="12.0"/>
    <showxy x="100" y="100">Test</showxy>
  </page>
</document>

Create a file with the content from listing 1 and name it 'sample.xml'
The next step will be the php script, which creates the pdf.

Listing 2: 'pdf.php'

<?php
include("pdfTag.php");
$pdf = new pdfTag();
$pdf->readFromFile('sample.xml');

if(!$_REQUEST["show"]):
  $pdf->Debug = true;
  $pdf->pdfProfile = true;
  $pdf->generatePDF();
?>
<a href="pdf.php?show">click to view the pdf</a>
<?php
else:
  $pdf->generatePDF();
  $pdf->dumpPDF();
endif;
?>

We use the properties 'Debug' and 'pdfProfile' of the instatiated object for some informational output.
$pdf->generatePDF() parses the xml source and create the pdf, per default memory. With $pdf->dumpPDF() the generated pdf will be passed to the client, i.e. a browser. Be sure that no other output from your script is send to the client before, otherwise the pdf can't be displayed or downloaded by the client without errors.



common elements



document

Syntax: <document [author] [creator] [keywords] [subject] [title] >..<document>

Attributes:

Example:

<document author="Roy Kaldung" creator="pdfTag/PHP">
..
<document>

content  index



page

Syntax: <page (width height)|format [orientation]>..</page>

Attributes:

Example:

<page format="A4" orientation="landscape">..</page>

content  index



miscellaneous elements



addthumbnail

Syntax: <addthumbnail id />

Attributes:

Example:

<addthumbnail id="thumb1"/>

See also:

openimagefile

content  index



annotation

Syntax: <annotation llx lly urx ury title text />

Alternative: <annotation llx lly urx ury title>text</annotation>

Attributes:

Example:

<annotation llx="0" lly="0" urx="100" ury="100" title="Annotation" text="This is my annotation"/>

content  index



border_color

Syntax: <border_color colors/>

Alternative: <border_color>colors</border_color>

Attributes:

Example:

<border_color colors="0,0,1"/>
<-- set the border color to blue -->

content  index



initgraphics

Syntax:
<initgraphics />

Attributes:

Example:

<initgraphics />

content  index



openimagefile

Syntax: <openimagefile id type src />

Attributes:

Example:

<openimagefile id="thumb" type="tiff" src="img/Thumb.tiff"/>

See also:

addthumbnail

content  index



outline

Syntax: <outline [id] text [parent] [open]/>

Alternative: <outline [id] [parent] [open]>text</outline>

Attributes:

Example:

<outline id="chapter1" open="open" parent="content"/>

content  index



placeimage

Syntax: <placeimage id x y [scale] />

Attributes:

Example:

<placeimage x="100" y="100" id="img1" />

See also:

openimagefile

content  index



text elements



graphic lements



arc

Syntax: <arc x y radius start end />

Attributes: Example:

<arc x="200" y="150" radius="30" start="0" end="90" />

content  index



circle

Syntax: <circle x y radius />

Attributes: Example:

<circle x="200" y="150" radius="30" />

content  index



line

Syntax: <line x1 y1 x2 y2/>

Alternative: <line>x1,y1,x2,y2</line>

Attributes: Example:

<line linewidth="0.3">100,75,300,250</line>

content  index



hypertext lements



weblink

Syntax: <weblink llx lly urx ury url />

Attributes: Example:

<weblink llx="50" lly="650" urx="200" ury="670" url="http://www.kaldung.de/pdftag" />

content  index




Index
A B C D F G H I K L M N O P R S T U W



addthumbnail (element)
annotation (element)
arc (element)
author (attribute)
  document


border_color (element)


circle (element)
clip (element)
close (value of attribute)
  outline
closepath (element)
colors (attribute)
  border_color (element)
continue_text (element)
creator (attribute)
  document
curveto (element)


dash (element)
document (element)
dumpPDF() (method)
duration (element)


fill (element)
fill_stroke (element)
format (attribute)
  page


generatePDF() (method)


height (attribute)
  page


id (attribute)
  addthumbnail
  openimagefile
  outline
  placeimage
initgraphics (element)


keywords (attribute)
  document


landscape (value of attribute)
  page
line (element)
lineto (element)
linewidth (element)
linewidth (attribute)
  line
llx (attribute)
  annotation
  weblink
lly (attribute)
  annotation
  weblink


moveto (element)


note (element)


open (attribute)
  outline
open (value of attribute)
  outline
openimagefile (element)
orientation (attribute)
  page
outline (element)


page (element)
parent (attribute)
  outline
path (element)
placeimage (element)
portrait (value of attribute)
  page


readFromFile() (method)
rect (element)
restore (element)
rotate (element)


save (element)
scale (element)
set (element)
set_leading (element)
setfont (element)
setlinewidth (element)
setrgbcolor (element)
settemplate (element)
show (element)
showboxed (element)
showxy (element)
src (attribute)
  openimagefile
subject (attribute)
  document
stroke (element)


template (element)
text (attribute)
  annotation
  outline
title (attribute)
  annotation
  document
translate (element)
type (attribute)
  openimagefile


url (attribute)
  weblink
urx (attribute)
  annotation
  weblink
ury (attribute)
  annotation
  weblink


weblink (element)
width (attribute)
  page