How to Produce PDF Output from 40051 Stylesheets

March 15, 2021

Using Antenna House Formatter to Generate PDF Output from 40051 Stylesheets

Antenna House Formatter is the world’s most powerful, feature-rich, and standards compliant formatting and rendering engine for XSL-FO.  This makes Formatter a natural choice for generating PDF documents from the MIL-STD-40051 stylesheets which generate XSL-FO from the data XML.  The 40051 standard encompasses the Department of Defense requirements for paginated technical manuals and supporting documents for use with weapons systems, related equipment, and usage procedures.

One advantage of Formatter is that it can add supporting EPS images as vectors in the output PDF document.  This allows the image text, such as callouts, to be searchable within the PDF viewer.  Since the images remain vectors they retain their details at any zoom level, allowing complex images to be closely examined by the reader.

Formatter is compatible with Windows, Linux, and several other operating systems.  This guide makes the following assumptions:

  1. You are using the Windows operating system
  2. You have the XSLT transformer SAXON installed
  3. You have 40051 data and the matching 40051 stylesheets downloaded to your system
  • Download and install Antenna House Formatter

Antenna House Formatter can be downloaded from the Antenna House website www.antennahouse.com

From the main page click the “trial downloads” button, then click “free trial download” under the Formatter logo, then fill out and submit the evaluation form.

You will receive a download link to the Formatter installer at your supplied email address, usually within a few minutes.

The evaluation version installer will generate a new license key that will allow you to try Formatter for 90 days.

If you have any questions, problems, or don’t receive the download link feel free to contact Antenna House Support at support@antennahouse.com

  • Download and install ghostscript

In order to retain your EPS images as vectors Formatter needs to use an external tool to process the EPS images.  At this time Formatter can use either Ghostscript or Adobe Distiller for this purpose.  This guide will assume you are using Ghostscript.

Download Ghostscript from the following link: https://www.ghostscript.com/download/gsdnld.html

Get the 32 or 64 bit version of Ghostscript matching the version of Formatter you are using.

Install Ghostscript and note where the gswin64c.exe executable is installed because you will need that path later.

  • Create a Formatter Configuration File

Example:

<?xml version="1.0"?>

<formatter-config>

<pdf-settings EPS-processor="ghostscript" 

   ghostscript="C:\Program Files\gs\gs9.53.3\bin\gswin64c.exe" />

<xslt-settings 

   command="java -jar C:\bin\saxon\SaxonHE10-3J\saxon-he-10.3.jar -s:%1 -xsl:%2 -o:%3"    msxml="false" />

</formatter-config>

 

The default configuration of Formatter on Windows is to use MSXML as the XSLT transformer.  To take advantage of SAXON’s features you will need to add a property your AH Formatter configuration file.

A default configuration file can be generated by opening the Formatter GUI and going to the menu option Format-->Export Option Setting File… This will generate an XML file that contains Formatter’s default configuration settings. Open the configuration file in a text editor.

First, in the xslt-settings element set the value of the “mxsml” attribute to “false”.  Then you will need to add your command line invocation for SAXON as the value of the “command” property substituting Formatter’s variables for the input, stylesheet, and output file names.

 

Example: 

<xslt-settings 

  command="java -jar C:\bin\saxon\SaxonHE10-3J\saxon-he-10.3.jar -s:%1 -xsl:%2 -o:%3"    msxml="false" />

 

In command property string the %1 is substituted for the filename of the input data, the %2 is the filename of the stylesheet, and %3 is the output filename.

Next you will add the properties to tell Formatter to use Ghostscript as the external EPS processor.

In the “pdf-settings” element set the value of the property “EPS-processor” to “ghostscript” (all lowercase).  Also in the “pdf-settings” element set the value “ghostscript” to the path and filename of Ghostscript executable.

 

Example:

<pdf-settings EPS-processor="ghostscript" 

  ghostscript="C:\Program Files\gs\gs9.53.3\bin\gswin64c.exe" />

 

Save your configuration file and return to the Formatter GUI.

Note that you don’t need a full set of properties in your configuration file, any unchanged values will keep their defaults.  You can simplify your configuration file by only including the elements and their child properties that you want to change, see the example at the top of this section.

 

  • Generate a PDF document from your 40051 data 

To validate your data with SAXON you will have to first copy the DTD and the directories “boilerplate” and “charent” from your stylesheet directory to your data directory.  

Alternatively you can configure SAXON to use an XML catalog to redirect the relative path to your DTD and entity definitions but that is outside the scope of this guide.

After the files are copied over, open the Formatter GUI and load the configuration file you modified by going to the menu option Format-->Import Option Setting… and select your file.

Then go to the menu option File-->Open.  In the “Document” input field click the file icon and browse to your XML data.  In the “Stylesheet” input field click the file icon and browse to your 40051 stylesheet directory, go to the “cstyle” directory and select the XSL file “xslfo-main”.

Once you hit OK a preview of your document will be generated in the Formatter GUI.  To generate a PDF go to the menu option File-->PDF Output.