Difference between revisions of "Creating PDF templates"
m |
|||
(10 intermediate revisions by 2 users not shown) | |||
Line 4: | Line 4: | ||
* [http://danilop.wordpress.com/2008/07/02/how-to-create-pdf-forms-with-openoffice/ How-to: Create PDF forms with OpenOffice] | * [http://danilop.wordpress.com/2008/07/02/how-to-create-pdf-forms-with-openoffice/ How-to: Create PDF forms with OpenOffice] | ||
* [http://pdfformsdesigne.sourceforge.net/index.html PDF Forms Designer] | * [http://pdfformsdesigne.sourceforge.net/index.html PDF Forms Designer] | ||
+ | |||
+ | {{Note|Starting from OpenKM 5.1.8 you can also use FreeMarker expressions in PDF templates. Just set the expression as field value (default text if you create the PDF templates from OpenOffice).}} | ||
+ | |||
+ | {{Advice|Every PDF form field name need to be unique, so you can't set the same property vale to several form fields. When converting from OpenOffice document to PDF, repeated form fileds are rename to ''original_name_2'', ''original_name_3'', etc. | ||
+ | <br/>If you need to put the same property value in several fields, try [[Creating_OpenOffice_templates|OpenOffice templates]]. | ||
+ | <br/>Since OpenKM 6.2.5 Professional and 6.2.1 Community you can use template expressions to avoid this limitation.}} | ||
In order to make a relation between the template form field and the property group, you have to name them following a naming convention: replace ":" and "." by "_". Here you can see the matching between both fields: | In order to make a relation between the template form field and the property group, you have to name them following a naming convention: replace ":" and "." by "_". Here you can see the matching between both fields: | ||
+ | |||
{| align="center" border="0" cellpadding="5" cellspacing="0" style="width: 600px" | {| align="center" border="0" cellpadding="5" cellspacing="0" style="width: 600px" | ||
− | ! align="left"| PROPERTY GROUP NAME !! align="left"| TEMPLATE FIELD NAME | + | ! align="left"| PROPERTY GROUP NAME !! align="left"| TEMPLATE FIELD NAME !! align="left"| TEMPLATE FIELD VALUE |
|- | |- | ||
− | |okp:tpl.name || okp_tpl_name | + | |okp:tpl.name || okp_tpl_name || ${okp_tpl_name!} |
|- | |- | ||
− | |okp:tpl.bird_date || okp_tpl_bird_date | + | |okp:tpl.bird_date || okp_tpl_bird_date || ${okp_tpl_bird_date!} |
|- | |- | ||
− | |okp:tpl.language || okp_tpl_language | + | |okp:tpl.language || okp_tpl_language || ${okp_tpl_language!} |
|- | |- | ||
|} | |} | ||
+ | |||
To create a template in OpenOffice.org go to '''View''' > '''Toolbars''' > '''Form Controls'''. The a new dialog will appear and you will be able to add form elements to the document. This dialog contains form stuff such as Labels, Text Boxes, Check Boxes, etc. | To create a template in OpenOffice.org go to '''View''' > '''Toolbars''' > '''Form Controls'''. The a new dialog will appear and you will be able to add form elements to the document. This dialog contains form stuff such as Labels, Text Boxes, Check Boxes, etc. | ||
Line 30: | Line 38: | ||
Here you have the generated PDF file [[File:Tpl.pdf]] and this is the ODT source [[File:Tpl pdf.odt]]. | Here you have the generated PDF file [[File:Tpl.pdf]] and this is the ODT source [[File:Tpl pdf.odt]]. | ||
− | + | == Data format == | |
+ | OpenKM uses FreeMarker inside, so you can take advantage of the FreeMarker formatting flexibilities. For example you can set date format by this way: | ||
+ | |||
+ | ${okp_tpl_bird_date?string("yyyy-MM-dd")} | ||
+ | |||
+ | Learn more about FreeMarker formatting at [http://freemarker.sourceforge.net/docs/ref_builtins.html Built-in Reference]. | ||
[[Category: Installation Guide]] | [[Category: Installation Guide]] | ||
− |
Latest revision as of 10:57, 24 December 2012
You can create PDF template forms with several applications:
Starting from OpenKM 5.1.8 you can also use FreeMarker expressions in PDF templates. Just set the expression as field value (default text if you create the PDF templates from OpenOffice). |
Every PDF form field name need to be unique, so you can't set the same property vale to several form fields. When converting from OpenOffice document to PDF, repeated form fileds are rename to original_name_2, original_name_3, etc.
Since OpenKM 6.2.5 Professional and 6.2.1 Community you can use template expressions to avoid this limitation. |
In order to make a relation between the template form field and the property group, you have to name them following a naming convention: replace ":" and "." by "_". Here you can see the matching between both fields:
PROPERTY GROUP NAME | TEMPLATE FIELD NAME | TEMPLATE FIELD VALUE |
---|---|---|
okp:tpl.name | okp_tpl_name | ${okp_tpl_name!} |
okp:tpl.bird_date | okp_tpl_bird_date | ${okp_tpl_bird_date!} |
okp:tpl.language | okp_tpl_language | ${okp_tpl_language!} |
To create a template in OpenOffice.org go to View > Toolbars > Form Controls. The a new dialog will appear and you will be able to add form elements to the document. This dialog contains form stuff such as Labels, Text Boxes, Check Boxes, etc.
Once the form has been created, go to File > Export as PDF to generate a PDF with these form fields. This is the final result:
Here you have the generated PDF file File:Tpl.pdf and this is the ODT source File:Tpl pdf.odt.
Data format
OpenKM uses FreeMarker inside, so you can take advantage of the FreeMarker formatting flexibilities. For example you can set date format by this way:
${okp_tpl_bird_date?string("yyyy-MM-dd")}
Learn more about FreeMarker formatting at Built-in Reference.