Using customized fonts on PDF forms

February 27, 2007

An information system has different goals and simplyfing the usually used form creation is one of them. As is known, forms can be simple or complex, depending if they are for internal or external use. A couple of years ago, they were printed on white & black. Nowadays many forms are sent via mail, which requieres a better design.

For this porpouse OpenbravoERP uses FOP. FOP (Formatting Objects Processor) is an XSL-FO processor written in Java, which provides the feature to convert XSL-FO files to PDF or direct-printable-files. It is possible to create very complex forms with colors, tables, headers, footers, different masters on a single document,etc. And even including images, customized fonts, different barcodes, etc.
As one of the most powerfull options, I am going to explain how to add new customized fonts to OpenbravoERP.

We have to:
1-Modify the userconfig.xml configuration file located on AppsOpenbravo/config folder. Include a new entrance for each new font, style and weight.
For example:
<configuration>
<entry>
<key>fontBaseDir</key>
<value>/opt/AppsOpenbravo/fonts</value>
</entry>
<fonts>
<font metrics-file=”LucidaTypewriterRegular.xml” kerning=”yes” embed-file=”LucidaTypewriterRegular.ttf”>
<font-triplet name=”LucidaTypewriter” style=”normal” weight=”normal”/>
</font>
<font metrics-file=”LucidaTypewriterBold.xml” kerning=”yes” embed-file=”LucidaTypewriterBold.ttf”>
<font-triplet name=”LucidaTypewriter” style=”normal” weight=”bold”/>
</font>
</fonts>
</configuration>

2-Copy xml and ttf files to AppsOpenbravo/fonts folder.
If we have the ttf but not the matching xml file we can create it as follows:
java org.apache.fop.fonts.apps.TTFReader example.ttf example.xml

Compile the configuration and copy it to Tomcat:
For example:
compile.development -Dtab=zzzz

And the font is now available to be used on any FOP file.
For example:
<fo:block font-size=”9pt” font-weight=”bold” text-align=”end” font-family=”LucidaTypewriter”>Importe / Amount</fo:block>

Related information: FOP fonts manual (PDF)

Entry Filed under: Openbravo. .

Leave a Comment

Required

Required, hidden

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Trackback this post  |  Subscribe to the comments via RSS Feed


Calendar

February 2007
M T W T F S S
    Mar »
 1234
567891011
12131415161718
19202122232425
262728  

Most Recent Posts