Skip to content

Creating PDF template

You can create PDF template forms using several applications:

Register the Metadata group definition at Administration > Metadata.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE property-groups PUBLIC "-//OpenKM//DTD Property Groups 3.10//EN"
"http://www.openkm.com/dtd/property-groups-3.10.dtd">
<property-groups>
<property-group label="Sample Template" name="okg:tpl">
<input label="Name" name="okp:tpl.name"/>
<input label="Birth Date" name="okp:tpl.birth_date" type="date"/>
<select label="Language" name="okp:tpl.language" type="simple">
<option label="Java" value="java"/>
<option label="Python" value="python"/>
<option label="PHP" value="php" />
</select>
<checkbox label="Important" name="okp:tpl.important"/>
</property-group>
</property-groups>

To establish a relationship between the template form fields and the property group, name them using a naming convention: replace “:” and “.” with “_”. Here you can see the matching between both fields:

Metadata field name Template field name Template field value
okp:tpl.name okp_tpl_name ${okp_tpl_name!}
okp:tpl.birth_date okp_tpl_birth_date ${okp_tpl_birth_date!}
okp:tpl.language okp_tpl_language ${okp_tpl_language!}
okp:tpl.important okp_tpl_important ${okp_tpl_important!}

This is a sample template created with Master PDF Editor:

OpenKM uses FreeMarker internally, so you can take advantage of FreeMarker’s formatting features. For example, you can set the date format in this way:

${okp_tpl_birth_date?string("yyyy-MM-dd")}

Learn more about FreeMarker formatting at Built-in Reference.

  • Upload the tpl.pdf file to /okm:templates/documents
  • Register the metadata definition okg:tpl in Administration > Metadata
  • Enable metadata in profiles at Administration > Profiles
  • Add the metadata group okg:tpl to the tpl.pdf file.