PDFApi

Version 1 (Schorsch Leciejewski, 02.03.2008 03:24 am)

1 1
h1. PDF API
2 1
3 1
4 1
The SalesKing uses the pdfLib for rendering PDF´s.
5 1
6 1
To customize the look of a pdf(f.ex. Invoice) one can upload a PDF Template.
7 1
8 1
9 1
10 1
h2. PDF Template Placeholders/Blocks
11 1
12 1
13 1
To customize any pdf output files you need the Acrobat Writer and the "Block plugin":http://www.pdflib.com/de/download/pdflib-familie/block-plugin/
14 1
15 1
16 1
h2. Invoice PDF´s
17 1
18 1
19 1
20 1
h3. Placeholders
21 1
 
22 1
23 1
Each placeholder is made up of a prefix, to specify the realm, followed by the data field divided by a dot:
24 1
25 1
26 1
<pre>
27 1
invoice.number -> realm invoice field number
28 1
client.number -> realm client, field number
29 1
user.organisation -> realm user, the organisation of the current user
30 1
settings.company_info -> realm settings (invoice print settings), field company_info
31 1
</pre>
32 1
33 1
Available Realms:
34 1
35 1
||*Realm*||*Description*||
36 1
||invoice||Data of the invoice||
37 1
||client||the invoice reciever, your client||
38 1
||user||the user creating this invoice||
39 1
||company||the company the user creating this invoice belongs to||
40 1
||settings||the invoice print setting fields||
41 1
42 1
===Invoice items block and table ===
43 1
44 1
Assumptions: Acrobat / Blockplugin / knowledge of block usage
45 1
46 1
The invoice items need some special handling, since it is not possible to define a table in a placeholder block.
47 1
48 1
You must create a block with the name *invoice.items*. 
49 1
50 1
Some of the blocks normal properties are applied to the table and there is a set of custom properties to further format the output.
51 1
52 1
All other block properties are not relevant! 
53 1
54 1
General Properties defined in the block, which will be used:
55 1
56 1
||*Property*||*Description*||
57 1
||Rect||The table will be placed into the rectangle defined by the block outlines.||
58 1
59 1
Text Properties:
60 1
61 1
||*Property*||*Description*||
62 1
||fontname||The font for all text in the table. The font MUST be present as a system font on our server(see debian fonts), if not no text is visible||
63 1
||fontsize||The fontsize for all text in the table||
64 1
65 1
66 1
Custom table block properties (invoice items):
67 1
68 1
We are serving those as defaults from the system, but you can override them.
69 1
If you are redefining those you *MUST* define the following properties:
70 1
* columns (which columns to show)
71 1
* header  (the heading for each column)
72 1
73 1
Optional 
74 1
* align (alignment of the columns contents)
75 1
* width  (width of a column)
76 1
* types   (the column type)
77 1
78 1
All custom properties are divided by comma, where the comma defines the column for which the setting will be applied.
79 1
80 1
Spaces before and after the comma are removed, so you can use them for better readability
81 1
82 1
<pre>
83 1
my property, my property, my property
84 1
85 1
setting for column 1, setting for column 2, setting for column 3
86 1
</pre>
87 1
88 1
*Custom Block Properties*
89 1
90 1
||*Property*||*Type*||*Example*||*Description*||*Available Markup*||
91 1
||columns||string||description,product_name,tax, price_single||The columns(in their order) to show in the items table. If empty a set of default columns will be applied.||position , quantity , quantity_unit , price_single , description , discount , tax , product_name  price_total , price_tax , price_total_with_tax , price_total_without_discount, quantity_with_unit, name_with_description||
92 1
||header||string||Description,Product,Tax, Single Price||The column header texts(in their order). If empty no heading will be shown.||Whatever you like to name them. Just remember that commas define the next column header!||
93 1
||width||string||20,30,250||The columns width. You can define the width for all or just until a column like 1-3. the remaining column will just take the space they need or get||any number||
94 1
||align||string||left,left,right,right||The columns text alignment. You can define the alignment for all or just until a column like 1-3. The default is left alignment||right,left,center||
95 1
||types||string||line,line,text||The columns type. if a columns is of type: text it will be rendered as textflow oposed to a single line output. This should only apply to your product description. You should hardly need this setting because every string longer than 20 chars will be treated as textflow||line: a simple textline, text: a multiline text||