Difference between revisions of "Pdf"

From PresenceWiki
Jump to: navigation, search
(Checkbox input)
 
(71 intermediate revisions by 3 users not shown)
Line 1: Line 1:
http://www.international-presence.com/images/nodes/dataformatter.png
+
[[file:dataformatter.png]]
  
 
To create a PDF document create a new custom data formatter in your task.
 
To create a PDF document create a new custom data formatter in your task.
Line 6: Line 6:
 
This will then create the template for your PDF instructions.
 
This will then create the template for your PDF instructions.
  
http://www.international-presence.com/images/docs/pdf/dataformatterscreen.png
+
[[file:dataformatterscreen.png]]
  
As usual if you enter < then the helper will appear with a list of options and permitteed tags for the PDF.
+
As usual if you enter < then the helper will appear with a list of options and permitted tags for the PDF.
  
 
Note it is actually the saving option that tells presence to send these instructions  
 
Note it is actually the saving option that tells presence to send these instructions  
Line 15: Line 15:
 
To create a PDF file you need to set the 'Write Output' option to 'Into PDF 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.
+
Saving as 'To File' will store the instructions 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
+
This is useful if you have a problem and need to send the instructions to us to debug.
 +
 
 +
[[file: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 that are specific to the PDF.
  
A PDF file can be created using a well structured html.
 
 
Each tag should be terminated with an associated closing tag.
 
Each tag should be terminated with an associated closing tag.
 +
 
eg a <page> should eventually include a </page>
 
eg a <page> should eventually include a </page>
  
Line 29: Line 33:
 
==Acceptable tags==
 
==Acceptable tags==
  
====pdf====
+
 
 +
====<pdf>====
  
 
Denotes the start of the PDF
 
Denotes the start of the PDF
  
====document====
+
<hr>
 +
 
 +
====<document>====
  
 
Describes the document properties and can have the following optional attributes
 
Describes the document properties and can have the following optional attributes
  
userpassword if added then this is needed to open the pdf file
+
'''''userpassword''''' - if added then this is needed to open the pdf file
  
ownerpassword if added then this is needed to edit the pdf file
+
'''''ownerpassword''''' - if added then this is needed to edit the pdf file
  
allowprinting whether the document can be printed (true/false)
+
'''''allowprinting''''' - whether the document can be printed (true/false)
  
allowcopy whether the document can be copied (true/false)
+
'''''allowcopy''''' - whether the document can be copied (true/false)
  
pagenumbers whether the document will include automatic page numbers (true/false)
+
'''''pagenumbers''''' - whether the document will include automatic page numbers (true/false)
  
landscape - landscape mode (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"
+
'''''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====
+
'''''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
 +
 
 +
<hr>
 +
 
 +
====<page>====
  
 
Denotes a new page, so that at any point in the document we can start a new 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
+
This has similar attributes to the document.
header
+
 
footer
+
'''''landscape''''' - landscape mode (true/false)
pagesize
+
 
marginleft
+
'''''header''''' - image that can appear on every page, aligned at the origin (0,0) eg ".\res\images\ipheader.png"
marginright
+
 
margintop
+
'''''footer''''' - image that can appear on every page, aligned at the bottom eg ".\res\images\ipfooter.png"
marginbottom
+
 
thispageonly - dictates whether these are attributes are to be used for subsequent pages or not.
+
'''''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
  
====p====
+
'''''thispageonly''''' - dictates whether these are attributes are to be used for subsequent pages or not.
  
As in html this describes a new paragraph
+
<hr>
  
====table====
+
====<nowiki><table></nowiki>====
  
 
Similar to html, allows you to create a new table and can have the following attributes
 
Similar to html, allows you to create a new table and can have the following attributes
  
width %
+
'''''width %''''' The width of the table (as a percentage of the page 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.
+
'''''cellpadding''''' - The spacing between the text and the cell
  
 +
'''''cellspacing''''' - The spacing between cells in the table
  
Cell attributes
+
'''''border''''' - Lined border thickness
colspan
+
width %
+
bgcolor
+
align
+
valign - top|middle|bottom|baseline
+
  
<nowiki>example
+
'''''positionabs''''' - Set if you want to position the table in a specific fixed position
  
<table  border="1" cellpadding="4" cellspacing="0" align="center" width="80%">
+
'''''align - left|center|right|justify'''''
<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>
+
</nowiki>
+
  
====font====
+
'''''bgcolor''''' - The background color of the cell/table
  
font-weight:
+
'''''title''''' - The associated title
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:
+
'''''caption''''' - The associated caption
border-"+strDirection+"-width:
+
border-"+strDirection+"-style:
+
none
+
medium
+
thin
+
px
+
  
u
+
<nowiki>As in html to define a new row in the table use <tr> and to define a new cell.<td></nowiki>
strong
+
small
+
big
+
b
+
br
+
  
====checkbox input====
+
You can also use <nowiki><th> which means that the cell will be at the top of each page when the table carries over.</nowiki>
  
It is possible to include checkboxes in the document
+
Cell attributes (for td or th)
 +
 
 +
'''''colspan''''' - How many columns the cell spans
 +
 
 +
'''''width %''''' - How wide this cell is as a percentage of the table width
 +
 
 +
'''''bgcolor''''' - The background color for the cell
 +
 
 +
'''''align''''' - Alignment of text in the cell (left|center|right|justify)
 +
 
 +
'''''valign''''' - top|middle|bottom|baseline
 +
 
 +
'''''nowrap''''' - Set if you want the text in the cell to be on a single line
 +
 
 +
As in html tables are often used for setting out your content with no borders.
 +
 
 +
Notice how the document is added into the root element along with the table tag and the first rows (headings).
 +
 
 +
[[file:table1.png]]
 +
 
 +
Next we iterate over our unique ID for each row (in this case the task id)
 +
 
 +
[[file:table2.png]]
 +
 
 +
Finally we close the table and the document
 +
 
 +
[[file:table3.png]]
 +
 
 +
Here is the table created
 +
 
 +
[[file:tablepdf.png]]
 +
 
 +
<hr>
 +
 
 +
====<img>====
 +
 
 +
'''''src''''' - url for image
 +
 
 +
'''''align''''' - alignment on page (left|center|right|justify)
 +
 
 +
'''''scaleabs''''' - Image will have these exact proportions (width and height) eg scaleabs="100,100"
 +
 
 +
'''''scalefit''''' - Image will have these sizes but will stay in proportion
 +
 
 +
'''''image tag''''' - Associated tag
 +
 
 +
'''''watermark''''' - set to true, this attribute is the same as an absolute position of 0,0
 +
 
 +
'''''positionabs''''' - Absolute position if you need to precisely position the image
 +
 
 +
<hr>
 +
 
 +
====<nowiki><font></nowiki>====
 +
 
 +
'''''type''''' - Specify the font from one of 3 built in types, courier|helvetica|times
 +
 
 +
'''''face''''' - Specify the font type by giving a path to the file name eg, face="c:\\windows\\fonts\\Bell.ttf"
 +
 
 +
'''''align''''' - left|center|right|justify
 +
 
 +
'''''valign''''' - top|middle|bottom|baseline
 +
 
 +
'''''color''''' - Font color
 +
 
 +
'''''size''''' - Font size in points
 +
 
 +
'''''positionabs''''' - Absolute position of text between font tags
 +
 
 +
example <nowiki><font face="c:\\windows\\fonts\\CURLZ___.TTF" align="right" size="14" color="red">Danger</font></nowiki>
 +
 
 +
<hr>
 +
 
 +
====Checkbox input====
 +
 
 +
It is possible to include checkboxes in the document, these do not have to be within a <form> tag
 +
 
 +
<nowiki>
 +
Example Of UnChecked Checkbox
 +
 
 +
<input type="checkbox"></input>  would result in an unchecked check box
 +
</nowiki>
 +
 
 +
[[file:chkbox.png]]
 +
 
 +
<nowiki>
 +
Example Of Unchecked Checkbox
 +
 
 +
<input type="checkbox" checked="checked"></input>  would result in a checked check box
 +
</nowiki>
 +
 +
[[file:unchkbox.png]]
  
<nowiki>So <input type="checkbox"></input> would reslt in an unchecked check box </nowiki>
+
<hr>
<nowiki><input type="checkbox" checked="checked"></input>would result in a checked check box</nowiki>
+
  
 
====Miscellaneous====
 
====Miscellaneous====
  
i - switch on itallics
+
'''''h1 h2 h3 h4 h5 h6''''' - Put this text in a header, eg <nowiki><h1>Title</h1></nowiki>
  
h1 h2 h3 h4 h5 h6 - Put this text in a header, eg <nowiki><h1>Title</h1></nowiki>
+
'''''br''''' - line break
  
hr - horizontal line
+
'''''hr''''' - horizontal line
 +
 
 +
'''''bold''''' - Set bold on (also accepts b and strong)
 +
 
 +
'''''u''''' - underline
 +
 
 +
'''''i''''' - switch on italics
 +
 
 +
'''''small''''' - reduce text size
 +
 
 +
'''''big''''' - increase text size
 +
 
 +
'''''p''''' - as in html this describes a new paragraph
 +
 
 +
<hr>
 +
 
 +
====Lists====
  
 
ol - ordered list  
 
ol - ordered list  
  
  <nowiki>example
+
  <nowiki>
 +
Example
  
 
<ol>
 
<ol>
Line 172: Line 254:
  
 
  </nowiki>
 
  </nowiki>
 +
[[file:olist.png]]
  
 
ul - unordered list
 
ul - unordered list
  
  <nowiki>example
+
  <nowiki>
 +
Example
  
 
<ul>
 
<ul>
Line 184: Line 268:
  
 
  </nowiki>
 
  </nowiki>
 +
[[file:uolist.png]]
  
pre preformatted text, so between these tags all spaces and tabs will be obeyed,
+
<hr>
whereas normally several spces or line breaks will be replaced with one space.
+
 
+
====img====
+
  
src - url for image
+
====Color====
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.
 
Colors can be defined as one of several labels or by hex as in html if you want more control.
Line 212: Line 284:
 
 
 
 
  
  <nowiki>example
+
  <nowiki>
 +
Example Of Colors
 +
 
 
<font color="#00FF00">I am green text</font>
 
<font color="#00FF00">I am green text</font>
<td color="blue">This cell will have a blue background</td>'''
+
 
 +
<td color="blue">This cell will have a blue background</td>
 
</nowiki>
 
</nowiki>
  
 +
<hr>
  
====Formatting====
+
====Formatting Special Characters====
  
  
 
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
 
so instead you must escape the characters, for instance putting <nowiki>&lt; will result in a <</nowiki>
 
  
&lt;            <nowiki><</nowiki>
+
As the document is expecting pure well formatted xml it won't let you do this
  
<nowiki>&gt;             ></nowiki>
+
so instead you must escape the characters, for instance putting <nowiki> &amp;lt; will result in a <</nowiki>
  
<nowiki>&quot;          "</nowiki>
+
&amp;lt;                                <nowiki><</nowiki>
  
<nowiki>&amp;           &</nowiki>
+
<nowiki>&amp;gt;                                ></nowiki>
  
<nowiki>\n              space</nowiki>
+
<nowiki>&amp;quot;                              "</nowiki>
  
<nowiki>\t              space</nowiki>
+
<nowiki>&amp;amp;                              &amp;</nowiki>
  
<nowiki>&nbsp;           space</nowiki>
+
<nowiki>\n  or \t  or  &amp;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.
 +
 
For behaviour other than that you can use preformatted text.
 
For behaviour other than that you can use preformatted text.
  
&nbsp
+
<nowiki><pre>The&nbsp;&nbsp;spaces&nbsp;&nbsp;&nbsp;between&nbsp;&nbsp;&nbsp;&nbsp;words&nbsp;&nbsp;&nbsp;&nbsp;will&nbsp;&nbsp;&nbsp;be&nbsp;&nbsp;obeyed</pre></nowiki>
nowrap
+
pre preformatted text, so between these tags all spaces and tabs will be obeyed,
 +
 
 +
whereas normally several spaces or line breaks will be replaced with one space.
 +
 
 +
<hr>
  
 
====Absolute positioning====
 
====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).
+
Sometimes you need to be specific when positioning text:-
  
<nowiki><font positionabs="575,822">O</font>
+
If the document is going to be scanned by an ocr reader.
<table positionabs="0,0"><tr><td>FF</td></tr></table>
+
 
</nowiki>
+
If you wish to position an address so that it appears in the right position in a windowed envelope.
 +
 
 +
If you want to place text in the border.
  
 
In these instances it can be useful to use absolute positioning.
 
In these instances it can be useful to use absolute positioning.
 +
 +
<nowiki>
 +
Example Of Absolute positioning
 +
 +
<font positionabs="575,822">Signed:_______________</font>
 +
 +
<table positionabs="0,0" border="0">
 +
  <tr>
 +
  <td>Origin</td>
 +
  </tr>
 +
</table>
 +
</nowiki>
  
 
It's worth noting that an '''A4''' page is '''595''' units across by '''842''' units down.
 
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.
 
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.
 
For instance, if the table width was 50% then the positionabs="500,200" would actually be positioned at 298,200.
 +
 +
=== Printing PDF Documents ===
 +
 +
See [[Printing from Presence]].
 +
 +
=== See Also ===
 +
 +
{{DataFormatters}}

Latest revision as of 14:06, 21 August 2015

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.

Dataformatterscreen.png

As usual if you enter < then the helper will appear with a list of options and permitted 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'

Saving as 'To File' will store the instructions as pure text.

This is useful if you have a problem and need to send the instructions to us to debug.

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 that 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.

Acceptable tags

<pdf>

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.

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.


<table>

Similar to html, allows you to create a new table and can have the following attributes

width % The width of the table (as a percentage of the page width)

cellpadding - The spacing between the text and the cell

cellspacing - The spacing between cells in the table

border - Lined border thickness

positionabs - Set if you want to position the table in a specific fixed position

align - left|center|right|justify

bgcolor - The background color of the cell/table

title - The associated title

caption - The associated caption

As in html to define a new row in the table use <tr> and to define a new cell.<td>

You can also use <th> which means that the cell will be at the top of each page when the table carries over.

Cell attributes (for td or th)

colspan - How many columns the cell spans

width % - How wide this cell is as a percentage of the table width

bgcolor - The background color for the cell

align - Alignment of text in the cell (left|center|right|justify)

valign - top|middle|bottom|baseline

nowrap - Set if you want the text in the cell to be on a single line

As in html tables are often used for setting out your content with no borders.

Notice how the document is added into the root element along with the table tag and the first rows (headings).

Table1.png

Next we iterate over our unique ID for each row (in this case the task id)

Table2.png

Finally we close the table and the document

Table3.png

Here is the table created

Tablepdf.png


<img>

src - url for image

align - alignment on page (left|center|right|justify)

scaleabs - Image will have these exact proportions (width and height) eg scaleabs="100,100"

scalefit - Image will have these sizes but will stay in proportion

image tag - Associated tag

watermark - set to true, this attribute is the same as an absolute position of 0,0

positionabs - Absolute position if you need to precisely position the image


<font>

type - Specify the font from one of 3 built in types, courier|helvetica|times

face - Specify the font type by giving a path to the file name eg, face="c:\\windows\\fonts\\Bell.ttf"

align - left|center|right|justify

valign - top|middle|bottom|baseline

color - Font color

size - Font size in points

positionabs - Absolute position of text between font tags

example <font face="c:\\windows\\fonts\\CURLZ___.TTF" align="right" size="14" color="red">Danger</font>

Checkbox input

It is possible to include checkboxes in the document, these do not have to be within a <form> tag

 Example Of UnChecked Checkbox 

<input type="checkbox"></input>  would result in an unchecked check box
 

Chkbox.png

 Example Of Unchecked Checkbox

<input type="checkbox" checked="checked"></input>  would result in a checked check box
 

Unchkbox.png


Miscellaneous

h1 h2 h3 h4 h5 h6 - Put this text in a header, eg <h1>Title</h1>

br - line break

hr - horizontal line

bold - Set bold on (also accepts b and strong)

u - underline

i - switch on italics

small - reduce text size

big - increase text size

p - as in html this describes a new paragraph


Lists

ol - ordered list

Example

<ol>
<li>First</li> 
<li>Second</li> 
<li>Third</li> 
</ol>

 

Olist.png

ul - unordered list

Example

<ul>
<li>Unordered information. </li> 
<li>Ordered information. </li> 
<li>Definitions. </li> 
</ul>

 
Uolist.png

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 Of Colors

<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 &lt; will result in a <

&lt;                                <
&gt;                                >
&quot;                              "
&amp;                               &
\n  or \t  or  &nbsp;               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.

<pre>The  spaces   between    words    will   be  obeyed</pre> pre preformatted text, so between these tags all spaces and tabs will be obeyed,

whereas normally several spaces or line breaks will be replaced with one space.


Absolute positioning

Sometimes you need to be specific when positioning text:-

If the document is going to be scanned by an ocr reader.

If you wish to position an address so that it appears in the right position in a windowed envelope.

If you want to place text in the border.

In these instances it can be useful to use absolute positioning.

Example Of Absolute positioning

 <font positionabs="575,822">Signed:_______________</font>

 <table positionabs="0,0" border="0">
  <tr>
   <td>Origin</td>
  </tr>
 </table>

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.

Printing PDF Documents

See Printing from Presence.

See Also

Task Elements > Data Format Nodes > Pdf

CSV Writer | HTML Table Writer | Basic XML Writer | XML Document Writer
XSLT Processor | Padded Text Writer | Custom Data Formatter Standard Option | Custom Data Formatter PDF Option
Custom Nodes


Task Elements | Resources