Resources related to the AFP Renderer
IBMs Advanced Function Presentation (AFP) has been described as “a document architecture, a printer dialog and datastream, and a process for fully system managing printing.” Unfortunately that doesn't tell much and seems to be typical marketing language. When it comes to the FOP AFP Renderer it only deals with creating documents conforming to the AFP document architecture. This architecure is called MO:DCA (Mixed Object Document Content Architecture). The following text is taken from:
Data Stream & Object Architectures: MO:DCA Reference (SC31-6802-06)
A mixed object document is the collection of data objects that comprise the document's content, and the resources and formatting specifications that dictate the processing functions to be performed on the content. The term Mixed in the MO:DCA architecture refers both to the mixture of data objects and the mixture of document constructs that comprise the document's components. A MO:DCA document can contain a mixture of presentation data objects. Each data object type has unique processing requirements. An Object Content Architecture (OCA) has been established for each IBM data object to define its respective syntax and semantics. MO:DCA documents can contain data and data objects governed by the following OCAs:
- Bar Code Object Content Architecture (BCOCA), which is used to describe and generate bar code symbols.
Font Object Content Architecture (FOCA), which is used to support the digital presentation of character shapes by defining their attributes, such as shape definitions, shape dimensions, and positioning information. Unlike the other OCAs, font objects are not carried inside the MO:DCA data stream. However, the MO:DCA architecture does provide and carry references to external font objects.
- Graphics Object Content Architecture (GOCA), which is used to represent pictures generated by a computer, commonly referred to as computer graphics.
- Image Object Content Architecture (IOCA), which is used to represent image information such as scanned pictures.
Presentation Text Object Content Architecture (PTOCA), which is used to define text information. End Quote
To generate MO:DCA documents (datastreams in the AFP language) one needs the relevant specifications. Here is how to get them:
Go to http://www.afpcinc.org
- Click on the Publications tab
The most recent MO:DCA, IPDS and other references are free and downloadable in PDF format.
For those who don't have access to an IBM AFP environment it is very difficult to verify the correctness of any generated MO:DCA document. The AFP Consortium provides a validator tool to Members for AFP Interchange Set 3. Information for joining the AFPC is available on the website.
Some free tools are also available to help.
The AFP Viewer Internet Explorer plug-in allows viewing of .afp in your browser. It can be found by going to http://www.ibm.com and then enter "AFP Viewer" into the Search box at the top. The first returned result should point to a page from where the viewer can be downloaded.
A little better might be to install the InfoPrint AFP Workbench. It basically contains the same processing engine as the viewer plug-in above. It can be downloaded here: http://infoprint.com/internet/dcfdata.nsf/vwWeb/P4000360
The AFP Datastream Analyzer is a command line program that decodes AFP datastreams. It can be found by going to http://www.ibm.com and then enter "afpan" into the Search box at the top. The first returned result should point to a page from where the analyzer can be downloaded. This is really a IBM Mainframe type program and runs best when called from REXX. So you may want to download Open Object REXX from http://www.oorexx.org/.
AFPexplorer - A user interface for analyzing AFP structured fields and listing / editing their values. Contains a build-in hex-editor.
AFPViewer allows navigation between pages, searching and copying text, printing and extracting pages to PDF, TIF, XML, JPG, BMP, PNG, GIF. It can list the included resources and extract them to a file. Opens documents with thousand of pages using less memory compared to other viewers.
Other AFP Tools
WinAFP (commercial) is a great tool to inspect AFP files and to manually modify them. Content folding allows to quickly scan through large files. It runs on Microsoft Windows.
BTB Browser is another AFP viewer which is probably better suited for preview than IBM's tools as it doesn't replace bitmap fonts with platform fonts. It also has a good AFP decoder useful for debugging.
ISIS Papyrus Viewer has recently been made available for free. It is implemented as a browser plug-in.
IBM AFP printer Driver for Windows 2000 and XP. Creates AFP documents, overlays, and page segments from Windows applications. Substitutes any AFP character set for any of the fonts in Windows, supports dither color images, custom paper sizes, color text and graphics, 4 and 32 bit CMYK color images and referencing of TrueType fonts. Can be downloaded from http://www-01.ibm.com/support/docview.wss?uid=psd1P4000187
Tips for developing with AFP
MO:DCA & Co. have grown over time but the specifications usually don't tell if a particular feature is an old or new feature. There are still a lot of AFP/IPDS environments around which only support a very old version and only bi-level printing. Relying on just the AFP Workbench has proven to be insufficient as this viewer supports a lot of features and is quite lenient about what you do in AFP. Furthermore, fonts are painted using operating system outline fonts even if you specify bitmap fonts in your print files. Obviously, the best way to test is having an older IPDS laser printer around but there you have the problem that you get non-helpful error messages if something's wrong. Additional, unfortunately commercial, viewer applications can help further during debugging. AFP dumpers like AFPAN (see above) are also a very important source for information. It is quite sensitive to mistakes. Rule number one: Test in as many environments as possible. No single tool will be able to tell you that the file you produced is correct and works in most environments.
When implementing AFP features it's a very good idea to use the most simple methods available. For example, for bi-level bitmap images, it's best to use the FS10 function set. Or if you want to reduce print file size or improve printing performance, images should not be included as image objects (because Include Object IOB is not available everywhere). Instead, page segments should be used even if that means that you have to embed the same image twice if it needs to be printed in two different sizes (because Include Page Segment IPS doesn't support scaling). But that has another advantage: you can make use of hard page segments which allows to transfer images to the printer separately, thus conserving bandwidth and processing power in the print processor.
In 2009 AFP transitioned to an open standard managed by the AFP Consortium http://www.afpcinc.org. In August 2011 a new "Interchange Set" (IS/3) was defined which excludes some outdated resources which have been replaced by updated technology (e.g. FOCA bit map fonts replaced by TrueType / OpenType). Many shipping components, such as print servers and printers, will continue to receive and handle legacy AFP datastream but generators are encouraged to transition to IS/3 for improved overall interoperability.