PDFApi

Version 19 (Schorsch Leciejewski, 09.12.2008 02:46 pm)

1 9 Schorsch Leciejewski
h1(title). PDF API
2 1
3 1
4 7 Schorsch Leciejewski
The SalesKing uses the pdfLib for creating PDF documents. You can customize any generated pdf files (f.ex. Invoice) by uploading PDF templates into the system.
5 1
6 7 Schorsch Leciejewski
Customizing the pdf templates is not really difficult. Despite your will to read the docs and spending some time trying, you need Adobe“s Acrobat Writer and a Acrobat Writer plugin to edit the data placeholders: the "Block plugin":http://www.pdflib.com/de/download/pdflib-familie/block-plugin/
7 1
8 8 Schorsch Leciejewski
h1. Contents
9 1
10 7 Schorsch Leciejewski
{{toc}}
11 1
12 8 Schorsch Leciejewski
h1. Audience
13 1
14 7 Schorsch Leciejewski
This document is intended for SalesKing users which want to customize the pdf templates. 
15 1
16 19 Schorsch Leciejewski
It assumes that you understand the basics of Adobe Acrobat and the pdfLib-Block plugin. Further you should have some basic knowledge of how to create a pdf file from various resources as well as some graphic design knowledge.
17 1
18 7 Schorsch Leciejewski
For more information about those things, see the Additional resources section at the bottom of this document.
19 7 Schorsch Leciejewski
20 19 Schorsch Leciejewski
If you master the art of pdf customizing you definitely have a sharp knife to cut down on those ugly invoices and official documents ... mostly derived from Word or other non-layout-suited Software.
21 7 Schorsch Leciejewski
22 7 Schorsch Leciejewski
23 8 Schorsch Leciejewski
h1. PDF Templates in General
24 3 Schorsch Leciejewski
25 18 Schorsch Leciejewski
A pdf template can be any pdf file. but first the normal steps you take in customizing:
26 3 Schorsch Leciejewski
27 18 Schorsch Leciejewski
# make a layout in photoshop / indesign / gimp / freehand
28 3 Schorsch Leciejewski
# generate a pdf
29 18 Schorsch Leciejewski
# download one of our default templates (or start from scratch)
30 18 Schorsch Leciejewski
# open acrobat writer and export the blocks from the default template to your new pdf. (Check the Block plugin menu to see all options)
31 4 Schorsch Leciejewski
# customize the blocks on you new pdf (block size/text/font/position/content/..)
32 1
# upload the pdf into SalesKing  
33 3 Schorsch Leciejewski
# check the output 
34 3 Schorsch Leciejewski
35 8 Schorsch Leciejewski
h2. Conventions
36 18 Schorsch Leciejewski
There is a small set of conventions you need to follow:
37 4 Schorsch Leciejewski
38 10 Schorsch Leciejewski
* all fonts used in blocks must be present on the system generating the output pdf (our server)
39 3 Schorsch Leciejewski
* Block names must match a special syntax (also see [[Placeholders]]) 
40 18 Schorsch Leciejewski
* the template size should not exceed 1mb
41 1
42 12 Schorsch Leciejewski
h1. Template Blocks
43 6 Schorsch Leciejewski
44 6 Schorsch Leciejewski
A Block is placeholder which gets substituted with data/text from the system. 
45 14 Schorsch Leciejewski
It is not required to have a standard set of blocks in a template. 
46 6 Schorsch Leciejewski
47 6 Schorsch Leciejewski
48 8 Schorsch Leciejewski
h2. Block name
49 6 Schorsch Leciejewski
50 10 Schorsch Leciejewski
The block name defines the matching data field from the application.
51 10 Schorsch Leciejewski
If no matching data field can be found the block is left empty.
52 1
53 13 Schorsch Leciejewski
Example of blocknames:
54 1
55 10 Schorsch Leciejewski
<pre>
56 15 Schorsch Leciejewski
number
57 10 Schorsch Leciejewski
client.address_field
58 15 Schorsch Leciejewski
page_number
59 10 Schorsch Leciejewski
settings.footer
60 10 Schorsch Leciejewski
</pre>
61 10 Schorsch Leciejewski
62 10 Schorsch Leciejewski
63 6 Schorsch Leciejewski
h2. Block position
64 6 Schorsch Leciejewski
65 15 Schorsch Leciejewski
The data/text is rendered at the position of the block. Depending on the block properties (f.ex. type:textline, textflow, image, align) the actual placement of the text can be influenced. 
66 1
67 1
h2. Block properties
68 1
69 13 Schorsch Leciejewski
The block properties carry information about how to output the data. 
70 10 Schorsch Leciejewski
71 6 Schorsch Leciejewski
The deep details of all block properties can be studied in the pdfLib API and the block manual. 
72 1
Therefore here just a list of options you are likely to use frequently:
73 1
74 13 Schorsch Leciejewski
|_.Property|_.Description|
75 13 Schorsch Leciejewski
|font + fontsize|the font must be present on our system!|
76 1
|textflow |mutiline text blocks must use this option which reveals more settings for the text flow|
77 1
|textflow alignment |text alignment in texflow boxes|
78 1
|custom properties| values defined by the SalesKing - depending on template type|
79 14 Schorsch Leciejewski
80 14 Schorsch Leciejewski
h2. Custom Block properties
81 14 Schorsch Leciejewski
82 14 Schorsch Leciejewski
Some blocks go beyond simple text rendering, f.ex. the invoice items table or page numbers.
83 14 Schorsch Leciejewski
You can influence such output with a set of custom fields. The custom property name and values are described inside the specific template type.
84 14 Schorsch Leciejewski
85 14 Schorsch Leciejewski
*Custom property detection*
86 14 Schorsch Leciejewski
87 14 Schorsch Leciejewski
To make sure a template can be handled, we have a multi-stage fallback mechanism for (most) custom properties.
88 14 Schorsch Leciejewski
89 14 Schorsch Leciejewski
It is important to know the way of property detection, to understand why something comes out like it does.
90 14 Schorsch Leciejewski
91 14 Schorsch Leciejewski
The option stages in their order of detection/use:
92 14 Schorsch Leciejewski
93 14 Schorsch Leciejewski
# settings inside the template“s custom block property
94 14 Schorsch Leciejewski
# user settings inside the SalesKing
95 14 Schorsch Leciejewski
# hardcoded options from the SalesKing core
96 14 Schorsch Leciejewski
97 14 Schorsch Leciejewski
If any setting is empty we go down the line and use the next available.
98 13 Schorsch Leciejewski
99 1
100 16 Schorsch Leciejewski
h3. show_on_page - Show a Block only on some pages
101 16 Schorsch Leciejewski
102 16 Schorsch Leciejewski
This custom property is available to all blocks.
103 16 Schorsch Leciejewski
104 16 Schorsch Leciejewski
|_.Property Name|_.Type|_.Example|_.Description|_.Available Markup|
105 16 Schorsch Leciejewski
|show_on_page|String|last|Show a block only on some of the generated pdf pages.|*last* => only on last page, *first* => show only on first page, *any number* => show on page with this number |
106 16 Schorsch Leciejewski
107 17 Ole Wiemeler
!http://pm.salesking.eu/attachments/download/43! 
108 16 Schorsch Leciejewski
109 16 Schorsch Leciejewski
110 11 Schorsch Leciejewski
h1. Template Types & Details
111 11 Schorsch Leciejewski
112 12 Schorsch Leciejewski
Jump to a template type to read more about the implementation details:
113 11 Schorsch Leciejewski
114 11 Schorsch Leciejewski
* [[PDFApi Invoice Templates|Invoice Templates]]
115 7 Schorsch Leciejewski
116 8 Schorsch Leciejewski
h1. Additional Resources
117 7 Schorsch Leciejewski
118 7 Schorsch Leciejewski
* "pdfLib Block plugin for Acrobat Writer":http://www.pdflib.com/de/download/pdflib-familie/block-plugin/
119 7 Schorsch Leciejewski
* "German pdfLib Manual":http://www.pdflib.com/de/developer/technische-dokumente/handbuecher/