Difference between revisions of "Pdf"
(→Formatting Special Characters) |
|||
Line 243: | Line 243: | ||
Sometimes you may want to include special characters such as a <nowiki>< or a "</nowiki> | Sometimes you may want to include special characters such as a <nowiki>< or a "</nowiki> | ||
As the document is expecting pure well formatted xml it won't let you do this | As the document is expecting pure well formatted xml it won't let you do this | ||
− | so instead you must escape the characters, for instance putting <nowiki> & | + | so instead you must escape the characters, for instance putting <nowiki> &lt; will result in a <</nowiki> |
− | & | + | &lt; <nowiki><</nowiki> |
− | <nowiki>& | + | <nowiki>&gt; ></nowiki> |
− | <nowiki>& | + | <nowiki>&quot; "</nowiki> |
− | <nowiki>& | + | <nowiki>&amp; &</nowiki> |
<nowiki>\n space</nowiki> | <nowiki>\n space</nowiki> | ||
Line 257: | Line 257: | ||
<nowiki>\t space</nowiki> | <nowiki>\t space</nowiki> | ||
− | <nowiki>& | + | <nowiki>&nbsp; space</nowiki> |
It's also worth noting that several spaces or returns will get replaced with one space as in html. | It's also worth noting that several spaces or returns will get replaced with one space as in html. |
Revision as of 10:12, 18 May 2009
http://www.international-presence.com/images/nodes/dataformatter.png
To create a PDF document create a new custom data formatter in your task. Be sure to select 'PDF Document' as the 'Type of document to produce'.
This will then create the template for your PDF instructions.
http://www.international-presence.com/images/docs/pdf/dataformatterscreen.png
As usual if you enter < then the helper will appear with a list of options and permitteed tags for the PDF.
Note it is actually the saving option that tells presence to send these instructions through the PDF formatter to generate the file.
To create a PDF file you need to set the 'Write Output' option to 'Into PDF File'
If you were to select 'To File' then the instructions themselves will be saved as pure text. This is useful if you need to send the instructions to us for debugging purposes, as we can then put the file into a task and run it through the PDF formatter to see what is happening.
http://www.international-presence.com/images/docs/pdf/dataformattersave.png
To create a PDF file we create a series of instructions similar to html. The language is a well structured html with some extra tags taht are specific to the PDF. Each tag should be terminated with an associated closing tag. eg a <page> should eventually include a </page>
At present only basic formatting is supported, so no style sheets or inline formatting is allowed.
Contents
Acceptable tags
Denotes the start of the PDF
document
Describes the document properties and can have the following optional attributes
userpassword - if added then this is needed to open the pdf file
ownerpassword - if added then this is needed to edit the pdf file
allowprinting - whether the document can be printed (true/false)
allowcopy - whether the document can be copied (true/false)
pagenumbers - whether the document will include automatic page numbers (true/false)
landscape - landscape mode (true/false)
header - image that can appear on every page, aligned at the origin(0,0) eg ".\res\images\ipheader.png"
footer - image that can appear on every page, aligned at the bottom eg ".\res\images\ipfooter.png"
pagesize - eg a1 a2 a3 a4 ledger legal letter note 22,33
marginleft - space for left margin
marginright - space for right margin
margintop - space for top margin
marginbottom - space for bottom margin
page
Denotes a new page, so that at any point in the document we can start a new page. This has similar attributes to the document, but whereas the document attributes cover every page, these can be specific to this page only.
landscape - landscape mode (true/false) header - image that can appear on every page, aligned at the origin(0,0) eg ".\res\images\ipheader.png" footer - image that can appear on every page, aligned at the bottom eg ".\res\images\ipfooter.png" pagesize - eg a1 a2 a3 a4 ledger legal letter note 22,33 marginleft - space for left margin marginright - space for right margin margintop - space for top margin marginbottom - space for bottom margin thispageonly - dictates whether these are attributes are to be used for subsequent pages or not.
p
As in html this describes a new paragraph
table
Similar to html, allows you to create a new table and can have the following attributes
width % cellpadding cellspacing border positionabs align bgcolor title caption
As in html to define a new row in the table use <tr> and to define a new cell <td> or <th> which is a header cell and so will be at the top of each page when the table carries over onto the next page.
Cell attributes
colspan
width %
bgcolor
align
valign - top|middle|bottom|baseline
example <table border="1" cellpadding="4" cellspacing="0" align="center" width="80%"> <tr> <th align="center" colspan="2" bgcolor="blue"><b><font color="white">Results Table</font></b></th> </tr> <tr> <th width="80%">Name</th><th width="20%" align="center" >Standing</th> </tr> <tr> <td><small><font color="black">Graham</font></small></td><td align="center">1</td> </tr> </table>
font
font-weight:
face
type courier helvetica times
align left center right justify
valign top middle bottom baseline
color
size + -
positionabs
bold
font-size
x-small
small
border-width: border-"+strDirection+"-width: border-"+strDirection+"-style: none medium thin px
u strong small big b br
checkbox input
It is possible to include checkboxes in the document
So <input type="checkbox"></input> would reslt in an unchecked check box <input type="checkbox" checked="checked"></input>would result in a checked check box
Miscellaneous
i - switch on itallics
h1 h2 h3 h4 h5 h6 - Put this text in a header, eg <h1>Title</h1>
hr - horizontal line
Lists
ol - ordered list
example <ol> <li>First</li> <li>Second</li> <li>Third</li> </ol>
ul - unordered list
example <ul> <li>Unordered information. </li> <li>Ordered information. </li> <li>Definitions. </li> </ul>
pre preformatted text, so between these tags all spaces and tabs will be obeyed, whereas normally several spces or line breaks will be replaced with one space.
img
src - url for image align - alignment on page (left|center|right|justify) scaleabs - scalefit - image tag watermark positionabs
color
Colors can be defined as one of several labels or by hex as in html if you want more control.
For instance green could be specified as either '#00FF00','green'
Presence recognises the following labels as colors:-
black blue cyan darkgray gray green lightgray magenta orange pink red white yellow
example <font color="#00FF00">I am green text</font> <td color="blue">This cell will have a blue background</td>'''
Formatting Special Characters
Sometimes you may want to include special characters such as a < or a " As the document is expecting pure well formatted xml it won't let you do this so instead you must escape the characters, for instance putting < will result in a <
< <
> >
" "
& &
\n space
\t space
space
It's also worth noting that several spaces or returns will get replaced with one space as in html. For behaviour other than that you can use preformatted text.
nowrap
Absolute positioning
Sometimes you need to be specific when positioning text (for instance if the document is going to be scanned by an ocr reader, or if you wish to position an address so that it appears in the right position in a windowed evelope, or if you want to place text in the border).
<font positionabs="575,822">O</font> <table positionabs="0,0"><tr><td>FF</td></tr></table>
In these instances it can be useful to use absolute positioning.
It's worth noting that an A4 page is 595 units across by 842 units down.
Also depending on the table width the table will be pushed left so that it is not hanging off the right hand side of the page. For instance, if the table width was 50% then the positionabs="500,200" would actually be positioned at 298,200.