Image/Graphics Printing Hints and Tips
Creating Page Segments
Page segments (*PAGSEG) are OS/400 objects containing image/graphics data for printing using AS/400 Advanced Function Printing (AFP).
Note that IBM distinguishes between images constructed of different coloured pixels (scanned images, PCX files, incoming faxes, Windows bitmaps, Windows icons, etc.) and graphics constructed of coloured lines, polygons, etc., as generated by GDDM and thence by AS/400 applications such as the Business Graphics Utility and Interactive Query. In this hint sheet we are interested only in images.
(Note also that the AS/400 Advanced Printer Function has nothing to do with AFP, being part of the System/36 environment.)
AFP generates a special data stream called AFPDS which can normally be printed only on a twinax-attached printer that is capable of printing IPDS output and whose printer device description is configured with AFP(*YES). Note that PC Support and Client Access cannot make a PC printer such as an HP LaserJet print AFPDS - a genuine twinax attachment is always required, although third-party hardware protocol converters (such as those shipped by i-data) can be used to provide such links. Note also that a special OS/400 licensed program is required, on V3R1 and later only, for run-time AFP.
AFPDS spool files can be produced using OS/400 printer files that have DEV(*AFPDS) specified. There are examples of the necessary specialised DDS in the AS/400 Guide to Programming for Printing. This manual shows how to include a page segment in a printer file, so that you can print a scanned logo, for example: there is a PAGSEG DDS keyword which takes as parameters the vertical and horizontal position of the logo on the page (usually in inches), together with the *PAGSEG object name/library. However the Programming for Printing manual is silent on the rather important matter of how you create the page segment in the first place if you do not have a System/370 handy.
If your image is in a PC file, and a Windows application is available that will print it, IBM supplies a simple method of turning the image into a *PAGSEG.
You will need the AFPDS printer driver (part of PC Support/Client Access). Use the Windows Control Panel to point its output to FILE: and to request generation of a page segment, using these dialogue boxes:
and then, using a suitable Windows application, ensure that you have the AFPDS printer driver selected, and Print your image. You will be prompted for a PC file name. Specify a file on a shared folder, e.g.
i:\shawm\logo.pag
Once the Print operation is complete, the page segment information needs to be transferred from the shared folder to an AS/400 database file which acts as the ‘source file’ for the OS/400 CRTPAGSEG command. This ‘source file’ is not an ordinary OS/400 source file, but may be created using, e.g.,
CRTPF SHAWM/PAGSEGS RCDLEN(1024) MBR(*NONE) MAXMBRS(*NOMAX) TEXT(‘Page segment sources’)
Transfer your page segment information into a member of this ‘source file’, e.g.
CPYFRMPCD FROMDOC(LOGO.PAG) FROMFLR(SHAWM) TOFILE(SHAWM/PAGSEGS) TOMBR(LOGO) TRNTBL(*NONE) TRNFMT(*NOTEXT)
and then create your page segment object:
CRTPAGSEG PAGSEG(SHAWM/LOGO) FILE(SHAWM/PAGSEGS)
The page segment object SHAWM/LOGO is now available for use in DDS as described in the Programming for Printing manual.
Please note that you do need to have PC Support/400 or Client Access/400 loaded on your PC - not a third party alternative - so that shared folders and the AFPDS printer driver are available to you.
© Pacific Associates
HINTTIP/PAGSEG.DOC
Mandy Shaw
07/06/95
Version 1
Page 1 of 2