2023.1 – AFP input with external resources

Avatar
OL Learn Blog Data

With AFP data streams, it is not uncommon to have resources such as fonts, images, overlays, etc. separate from the print file, in order to reduce the size of print files. To process this kind of AFP with external resources, OL Connect 2023.1 has improvements to make PReS Connect work better with AFP input that does not have all resources embedded. This prevents customers from requiring support to be able to process their input data. This sneak peek explains the improvements and how to use them.

In the past, when a user had AFP input with external resources, they needed help from our support to be able to process that data with OL Connect. They would receive a tool for embedding these external resources into their input file before processing. These customers can now switch to the standard support for external AFP resources that is explained below.

About AFP resources

For those who are not so familiar with AFP, it comes with many different kinds of resources. Formats like PDF or PostScript typically have images and fonts (and a few other things that regular users hardly ever see or hear about), and a Connect template can also have HTML snippets and CSS. With AFP, you can have: overlays, page segments, presentation pages, form definitions, page definitions, coded fonts, character sets, code pages, TrueType fonts, and a few more. Some of these will be familiar, while others are not, but explaining all of these is beyond the scope of this article; when they are needed by an AFP data file, it’s up to the customer to supply them.

These can either be embedded in an AFP data file, or they can be referenced by an AFP data file, and then they need to exist somewhere as files of their own.

When resources are missing, the AFP typically looks bad:

Just an ugly font does not necessarily mean something is wrong, but note the lines of text running into each other and over table cell boundaries. The same content with the external resources available:

AFP external resources in 2023.1

With PReS Connect version 2023.1, the AFP conversion used by the DataMapper can automatically use external AFP resources when they are copied to the server. It is no longer necessary to embed those resources in the AFP data file before DataMapping.

When a customer provides AFP data with external resources, just copy those resources into the folder
C:\ProgramData\Objectif Lune\OL Connect\Resources\AFP
and they will be picked up when needed.

Note: both Connect Server and Connect Designer will cache the results of AFP input processing. To see the result on a previously processed AFP input file, make sure to restart both.

Inside the AFP resources folder, you have some freedom on how to organize your resources. Resources are picked up in that folder itself, but they will also be looked for in the following subfolders:

  • FormDef\
  • PageDef\
  • Overlay\
  • PageSeg\
  • PresentPage\
  • CodedFont\
  • Charset\
  • Codepage\
  • TrueType\

Although those folder names suggest a certain resource type, it actually doesn’t matter in what folder you store a particular resource type.

The filename extensions of resource files also don’t matter. In many cases, resource files will not have any filename extension, and this is fine, but a resource will even be found if it has a made up filename extension. In other words, when customers provide resources, the filename extensions don’t matter.

Pre-processing AFP input – the AFPmerge tool

Even though DataMapper can use external resources with AFP input directly, we are also providing a way to pre-process AFP files. PReS Connect now ships with a command-line tool, AFPmerge, that will embed external resources into an AFP file, but that can also combine multiple AFP input files into a single file.

Combining multiple AFP input files can be more efficient in cases where there are many small AFP files to process, because it allows data mapping all the AFP input at once, which can avoid a lot of overhead.

The AFPmerge tool can be found in the OL Connect installation folder:
C:\Program Files\Objectif Lune\OL Connect\AFPMerge

To run AFPmerge on a single AFP input file, use
"C:\Program Files\Objectif Lune\OL Connect\AFPMerge\bin\AFPMerge.exe" -i <inputfile> -r <resource folder> -o myoutputfile.afp

To run AFPmerge on multiple files, first create a text file that lists all the AFP input files (this text file is also known as a manifest file). And then use that use that file on the command-line with the -l option
"C:\Program Files\Objectif Lune\OL Connect\AFPMerge\bin\AFPMerge.exe" -l <manifest file> -r <resource folder> -o myoutputfile.afp

When multiple AFP files are combined, each is wrapped in a page group, and that page group gets a TLE named GROUP with its value set to the input filename. Since DataMapper can set boundaries using AFP page groups, this makes it effortless to process the combined AFP file and have a record per input file.

Sample manifest file with 8 input files, the combined AFP file will have 8 page groups that easily map to 8 records in DataMapper:

print75X-1.AFP
print75X-12.AFP
print75X-3.AFP
print75X-34.AFP
print75X-5.AFP
print75X-56.AFP
print75X-7.AFP
print75X-78.AFP

If needed, the manifest file can have a second column, separated by a tab from the filename column, with a grouping key that will cause subsequent files with the same key to be in the same page group. The GROUP TLE will then have that grouping key as its value.

Sample manifest file with 8 input files, and 3 groups, the combined AFP file will have 3 page groups that map to 3 records in DataMapper:

print75X-1.AFP	doc1
print75X-12.AFP	doc1
print75X-3.AFP	doc1
print75X-34.AFP	doc2
print75X-5.AFP	doc2
print75X-56.AFP	doc3
print75X-7.AFP	doc3
print75X-78.AFP	doc3

TLEs can be mapped to fields in DataMapper, so it’s also easy to pick up the grouping key and use that in subsequent processing.

The AFPmerge tools has further command-line options to control logging, input file location, and an AFP-specific one to pick what form definition to include in the output AFP, if there are multiple to choose from. To see all command-line options, use
"C:\Program Files\Objectif Lune\OL Connect\AFPMerge\bin\AFPMerge.exe" -h

Tagged in: Inputs, print



Leave a Reply

Your email address will not be published. Required fields are marked *