afpsplit utility: extracts pages from a MO:DCA-P file

Syntax

afpsplit [-fpage] [-ppage] [-rranges] [-fextFormdef [-def]] [-cpaths] [-oOutputFile] [InputFile]

Description

Enter the afpsplit command to extract a page or a range of pages from an AFP MO:DCA-P document and create MO:DCA-P output.

You might use the afpsplit command to create a separate file starting at the 25th page and ending at the 50th page of a 200-page document. After you use the afpsplit command to create a file, you can view, store, print, or send that file.

    Note:
  1. afpsplit removes structured index fields from MO:DCA-P files. This does not affect the appearance of printed files, but index entries are no longer available for viewing.
  2. afpsplit writes error messages to STDERR.

Flags

-f page
Specifies the forward space function, where page indicates the number of pages (0-999999999) that you can forward space from the beginning of the input file to start extracting the page or range of pages. To start extracting on page n, forward space n-1 pages.

If you do not specify the -f flag, the extraction starts at the beginning of the file. If you specify more than one -f flag, the last one you specify is used.

-p page
Specifies the page end function, where page indicates the number of pages (0-999999999) to be extracted.

If you do not specify the -p flag, all pages from the forward space point to the end of the input file are included in the output file. If you specify more than one -p flag, the last one you specify is used.

-r ranges
Specifies the page ranges that can be extracted from the input file, where the ranges syntax is -rs1:e1,s2:e2..., si is the start value and ei is the end value of the i interval. Up to 10 intervals can be specified with this parameter.
    Note:
  • If the -fext flag is used, then the start and end interval values might be modified internally by the medium controls. As a result, some pages can appear more than once in the MO:DCA-P output.

The delimitator between start and end value is ‘:’. The delimitator between page ranges is ‘,’. If no start value is specified for an interval, the first page is considered as start value. If no end value is specified for an interval, 999999999 is considered as end value. There must be at least one valid interval for the -r flag to work properly. The intervals are sorted ascending internally. This flag cannot be used in combination with -mm, -f, and -p flags.

-fext Formdef
Specifies an external form definition as a source for the medium controls. In this case, the medium controls are read only from the specified Formdef.
  • Any medium controls invocation in the InputFile need to refer to a medium map defined in the external formdef.
  • Any medium controls defined inline, in the input document inline resource group, are ignored.
    Note:
  • If the external Formdef is not located in the default system resources directory, use the -c flag for defining custom resource paths.
-def
Specifies the external formdef as a default source for the medium controls. In this case, the medium controls are first searched inline, in the input document resource group. If any medium maps are found, they are used in the output document. Any medium map invocation need to refer a medium map defined here. If no medium maps are found in the document resource group, then the search continues in the external formdef.
The -def flag can only be used together with the -fext flag. Otherwise, no medium controls are applied to the output document, even if the input file contains medium maps.
-c paths
Specifies custom paths to search for the external formdef. One or more paths can be specified. Paths format:
Windows:
path;path;path
AIX/Linux:
path:path:path
The -c flag can only be used together with the -fext flag.
    Note:
  • At least one path needs to be defined for afpsplit to search for it. If the -fext flag is not used, then the -c flag has no effect. If no formdef is found in any of the path supplied, an error is triggered.
-o OutputFile
Specifies the name of the file for the page or range of pages produced by afpsplit.

If you do not specify this flag, afpsplit uses standard output (STDOUT).

Argument

The valid argument value for the afpsplit utility is:

InputFile
Specifies the input file.

If you do not specify an input file, afpsplit uses standard input (STDIN).

Example

To extract pages 21-30 from a MO:DCA-P input file called input.afp and use the pdpr command to print those 10 pages on printer serv1-lp, enter:

afpsplit -f 20 -p 10 input.afp | pdpr -p serv1-lp

afpsplit -f 20 -p 10 -fext FDDUP4UP -o output.afp input.afp
This usual example would extract 10 pages, starting from page 20. However, by adding the -fext parameter, the output document could contain more that 10 pages. This is because both the start page, 20 in this case, and end page, 30 in this case, can be on a physical sheet that has more than one page. Depending on the medium maps defined, one physical sheet can have up to 8 pages, when duplex and 4Up are specified. One possible output can be the following:

If the medium control is a simplex 4Up, starting from the beginning of the document, the first sheet will contain pages from 1 to 4, second sheet pages from 5 to 8, ending with the last sheet containing pages from 29 to 32. Therefore, the output document contains pages from 20 to 32, as page 30 is on the eighth sheet.

afpsplit -r5:10,13:20,30:35 -fext DEFFORMD -def -o output.afp input.afp
In this case, page ranges are specified in the afpsplit call. The -def parameter only changes the priority of the medium controls. The medium controls in the input document can format the output document the same way. Depending on how medium controls are defined and invoked, the output pages can overlap. This is done internally, taking into consideration any medium controls that can affect the output result.

If the same simplex 4Up medium map is used, the output intervals will be:

  • 5:10 to 5:12
  • 13:20 to 13:24
  • 30:35 to 28:36
In this case, the intervals do not overlap. When overlapping occurs, some pages will be copied twice in the output document.

Example with -r flag

Consider the input file has 100 pages.

This instance extracts pages 10 to 14, 20 to 30 and 80 to 100 to the output_file.afp:

afpsplit -r10:14,20:30,80: -o output_file.afp input_file.afp 

This instance extracts pages 1 to 10 (from interval “:10”), 30 to 40 and 90 to 100 (from interval “90:112”) to the output_file.afp. The last interval is discarded, since it exceeds the maximum number of pages in the input file:

apfsplit -r30:40,:10,90:112,130:140 -o output_file.afp input_file.afp

These instances generate an error because there is not at least one valid interval or the intervals overlaps:

afpsplit -r101:104,120:140,160: -o output_file.afp input_file.afp
afpsplit -r10:14, 40:,12:20 -o output_file.afp input_file.afp