PDFTools - XML to PDF Guide

Since version 1.1, PDFTools include a XML to PDF conversion utility. This feature allows you to create a PDF document by specifying structure in a XML document. The XML tags in PDFTools is closer to HTML tags, so it is very easy to understand and use.
Take a look at the DTD for PDFTools for list of tags and supported attributes.
Following are the tags supported in PDFTools :

Examples :
1) To understand the PDFTools xml format. Download the following example files : newton.xml, image1 and image2
Copy images to c:\ folder, and run PDFTools's "PDF Creator" option.
You can download the generated PDF newton.pdf also from here.
Note: If you have problem accessing to sheelapps.com then change <!DOCTYPE document SYSTEM "http://sheelapps.com/PDFTools/PDFTools1.1.dtd"> to <!DOCTYPE document SYSTEM "PDFTools1.1.dtd"> and keep xml file and DTD file in same folder.

document

The document tag is the top most tag in PDFTools' XML file. All the other tags should be declared inside this tag. The document tag should contain at least one paragraph("p") or table tag to generate a PDF.
Note: If you have problem accessing to sheelapps.com then change <!DOCTYPE document SYSTEM "http://sheelapps.com/PDFTools/PDFTools1.1.dtd"> to <!DOCTYPE document SYSTEM "PDFTools1.1.dtd"> and keep xml file and dtd file in same folder.
Example:
     <?xml version="1.0" encoding="utf-8"?>
       <!DOCTYPE document SYSTEM "http://sheelapps.com/PDFTools/PDFTools1.1.dtd">
        <document author="Sheel Khanna" title="Isaac Newton" pageSize="A4"
	marginLeft="10" marginRight="10" marginTop="10" marginBottom="10">

	<!-- other tags -->
       </document>

      

Supported attributes :
AttributeDescriptionOptionalSupported valuesDefault Value
authorAdds the author property to the documentYesText-
titleAdds the title property to the documentYesText-
marginTopSets the top margin for the documentYesFloat36
marginBottomSets the bottom margin for the documentYesFloat36
marginLeftSets the left margin for the documentYesFloat36
marginRightSets the right margin for the documentYesFloat36
pageSizeSets the page sizeYesMust be : A0 to A10 or B0 to B5 or ARCH_A to ARCH_E or HALFLETTER or LEDGER or _11X17A4

Following tags are allowed inside document tag:
pheaderfootertablepagebreakbr


Back to Top

header

It is an optional tag. The header tag adds the Header section to every page in document. There should be only one header tag per document.
Example:

	<header align="right">
		This is header text.
	</header>
      

Supported attributes :
AttributeDescriptionOptionalSupported valuesDefault Value
alignAlignment of text in headerYes"left" or "center" or "right""center"

Following tags are allowed inside header tag :
font



Back to Top

footer

It is an optional tag. The footer tag adds the Footer section to every page in document. There should be only one footer tag per document.
Note: Unlike header, you cannot specify a font tag inside a footer tag. Instead you can specify font attributes as footer attribute.
Example:
     	 <footer align="right" size="7" >

	  This is footer text and this is page # <pagenumber/>.
	 </footer>
      

Supported attributes :
AttributeDescriptionOptionalSupported valuesDefault Value
alignAlignment of text in footerYes"left" or "center" or "right""center"
faceFooter Font faceYes See font
sizeFooter Font sizeYes See font
styleFooter Font styleYes See font
colorFooter Font colorYes See font

Following tags are allowed inside footer tag :
pagenumber


Back to Top

p

The "p" (paragraph) tag are the building blocks of document. Each paragraph represents the section of data in document. You can add multiple paragraphs to document.
Example:

	 <p>This is sample paragraph text.
       With a newline at <br/> and more text.
	 Here is a text in <font style="bold underline"> bold and underline </font>.
	 </p>

      

Supported attributes :
None

Following tags are allowed inside paragraph tag :
font apagenumberimgtablebr


Back to Top

font

"font" tag can be used to specify text formatting in a document.
Example:

	<font size="10" style="bold italic">size 10 bold italic</font>
	<font style="bold italic underline line-through">bold italic underline line-through test</font>
	<font size="8" color="blue">normal size 8 color blue text</font>

	<font face="Helvetica">Helvetica</font>

	<font face="Courier" size="8">Courier</font>
	<font face="Times-Roman">Times-Roman</font>
	<font face="Symbol">Symbol</font>

      

Supported attributes :
AttributeDescriptionOptionalSupported valuesDefault Value
faceText faceYesHelvetica or Courier or Times-Roman or Symbol or ZapfDingbats
sizeText sizeYesFloat12
styleText styleYesAny combination of : normal bold italic underline line-throughnormal
colorText colorYesblue or red or green or gray or yellow or lightgray or darkgray or whiteblack

No tags are allowed inside font tag.



Back to Top

a

"a" Anchor tag can be used to specify a hyperlink in a document. The link can be external or internal to another anchor.
Example:
	<a href="http://sheelapps.com" name="link1">link to sheelapps.com</a>

	<a href="#link1" >link to link1 in document</a>

      

Supported attributes :
AttributeDescriptionOptionalSupported valuesDefault Value
nameName of the linkYesText
hrefLink targetYesText

Following tags are allowed inside "a" tag :
font


Back to Top

br

The "br" tag inserts a single line break.
Example:
	<p>This is simple text with <br/> line break.
	</p>

      

Supported attributes :
None
Following tags are allowed inside "br" tag :
None

Back to Top

pagebreak

The "pagebreak" tag inserts a new page in the document.
Example:
<pagebreak/>

Supported attributes :
None
Following tags are allowed inside "pagebreak" tag :
None


Back to Top

img

"img" tag inserts an image in the document.
Example:
	<img src="c:/180px-Newton.jpg" align="left textwrap"
		alt="Engraving after Enoch Seeman 1726 portrait of Newton"
		border="0.1" />
      

Supported attributes :
AttributeDescriptionOptionalSupported valuesDefault Value
srcThe URL of the image to displayNoText
altDefines a short description of the imageYesText
borderDefines a border around an image.YesFloat
widthDefines the width of an imageYesFloat pixels
heightDefines the height of an imageYesFloat pixels
alignSpecifies how to align the image according to surrounding text. Basically this attribute has combination of two values
1) left or middle or right : Location of image
2) textwrap or underlying : Wrap the text or underlay.
Yes

Following tags are allowed inside "img" tag :
None


Back to Top

pagenumber

This tag can be used to insert current page number in document.
Example:
	<pagenumber/>
      

Supported attributes :
None
Following tags are allowed inside "pagenumber" tag :
None


Back to Top

table

"table" tags can be used to define table.
Example:
	<table width="50" align="center" border="0.1" cellspacing="5" cellpadding="5" columns="2"
	backgroundcolor="lightgray" bordercolor="blue">
		<cell>
			Column 1
		</cell>

		<cell>
			Column 2
		</cell>
		<cell>
			Column 11
		</cell>
		<cell>

			Column 22
		</cell>
	</table>
      

Supported attributes :
AttributeDescriptionOptionalSupported valuesDefault Value
alignAligns the table.Yesleft or center or rightleft
columnsNumber of columns in tableYesNumber1
borderSpecifies the border widthYesFloat0
bordercolorBorder colorYesColor nameblack
cellpaddingSpecifies the space between the cell walls and contentsYesFloat0
cellspacingSpecifies the space between cellsYesFloat0
backgroundcolorTable background colorYesColor namewhite
widthSpecifies the table width in percentageYesFloat

Following tags are allowed inside "table" tag :
cell


Back to Top

cell

"cell" tags can be used to define cell inside a table. Cell can span to mutiple columns or rows.
Example:
	<table width="50" align="center" border="0.1" cellspacing="5" cellpadding="5" columns="2"
	backgroundcolor="lightgray" bordercolor="blue">

		<cell halign="top">
			Column 1
		</cell>
		<cell>
			Column 2
		</cell>
		<cell>

			Column 11
		</cell>
		<cell>
			Column 22
		</cell>
	</table>

	<table width="50" columns"2" >

         	<cell width="20" border="0.1">
			Column data
		</cell>
		<cell width="80">
			Column data
		</cell>
		<cell colspan="2" border="0.1" >

			Second row Column data
		</cell>
	</table>
      

Supported attributes :
AttributeDescriptionOptionalSupported valuesDefault Value
halignHorizontal alignment of text in cellYesleft or center or rightleft
valignVertical alignment of text in cellYestop or middle or bottombottom
borderSpecifies the border widthYesFloat0
bordercolorBorder colorYesColor nameblack
colspanSpecifies the number of columns will cell spanYesFloat1
rowspanSpecifies the number of rows will cell spanYesFloat1
backgroundcolorCell background colorYesColor namewhite
widthSpecifies the cell width in percentage. It should be set to cells only in first row.YesNumber

Following tags are allowed inside "cell" tag :
fontabr imgpagenumber


Back to Top