Documents in PDF format

From ISPWiki
Jump to: navigation, search

To enable the PDF format in the billing panel, you need to configure the external XSL-FO processor. In this article we will configure Apache FOP.

Specify parameters to call an external FO-processor. Add the following string into the control panel's configuration file:

 XSLFOProc fop -c /etc/fop.conf.d/userconfig.xml -xml __xml__ -xsl __xsl__ -pdf __pdf__

where parameters between underscores will be automatically changed into paths to the corresponding files.

Example:

 Mar 11 16:19:16 [13396:5] proc EXTINFO Run '/bin/sh -c fop\ -c\ /etc/fop.conf.d/userconfig.xml\ -xml\ tmp/xml.fTqNMx\ 
 -xsl\ skins/common/xsl/report.pdf.xsl\ -pdf\ tmp/pdf.mXEPYN' pid 13408

Create the /etc/fop.conf.d/userconfig.xml file and edit it as follows:

<?xml version="1.0"?>
  <fop>
    <renderers>
      <renderer mime="application/pdf">
        <fonts>
          <font metrics-url="/etc/fop.conf.d/fonts/arial.xml" kerning="yes" embed-url="/etc/fop.conf.d/fonts/arial.ttf">
            <font-triplet name="Arial" style="normal" weight="normal"/>
            <font-triplet name="ArialMT" style="normal" weight="normal"/>
          </font>
        </fonts>
      </renderer>
    </renderers>
  </fop>

Download the Arial file and locate it into the /etc/fop.conf.d/fonts/ directory.

Execute

 fop-ttfreader /etc/fop.conf.d/fonts/arial.ttf /etc/fop.conf.d/fonts/arial.xml

to generate the metric file.

Restart the control panel.