Parsing AFP

UnionStation framework parses MODCA, IOCA, FOCA, PTOCA etc. into live objects and easily creates indices

Some legacy solutions are like state machines — they interpret input such as PostScript and AFP, execute the commands, and modify their internal states as it goes. Before long, the number of states and the interaction among them would go out of control and the system would become rigid and fragile. Modern solutions typically chose to use an object-oriented approach where the focus is centered on creating, sharing, and managing live objects who take care of states and actions by themselves.

AFP was designed as a mixture of control flow and embedded data, and the mindset of the designer was largely procedural. However, with UnionStation the task was tackled with the modern vision. The various “CA” (Content Architecture) specifications iterated the various types of data blocks, so it was upon us to create an integral and ordered blueprint of entities from the large collection of discrete parts.

The objects are further convertible into PDF or HTML or they can be exported to another AFP. Unlike most other solutions, there is no distinction between AFP reading module and AFP writing module — the same AFP module is able to read and write AFP data, converting properties to and from raw data, either generating new data from assigned properties on the fly, or taking existing binary data to ensure maximum fidelity and efficacy.

Features list

Text and fonts
  • Raster fonts of arbitrary resolution or encoding
  • Unicode based text that can contain CJK characters
  • Outline fonts, in Type-1, Open Type, or CID fonts
  • Fonts wrapped in object container or referred via resource access table
Rasters and Images
  • One-bit rasters
  • Patched or tiling rasters
  • Embedded RGB/CMYK and grayscale images
  • JPEG, CCITT, MMR compressions
  • Embedded JPEG, TIFF, or GIF as objects
Vector graphics
  • Various stroke and fill styles
  • Rounded rectangles, dashed lines, patterned brushes
  • Standard and extended colors
Resources
  • Overlays, page segments, form definition
  • Embedded objects including PDF within AFP
  • External resources
Barcodes
  • Common 1-D barcode types
  • QR code
Metadata
  • Page grouping and logical documents
  • Document indices
  • Properties as key / value pairs (TLE)
  • Comments as no-op fields (NOP)

About the Author: Cyphia