Key Flag Attributes of a Virtual Printer


About this document
Basic virtual key flag attributes
Hypothetical job
More detail

About this document

This document describes the key flag attributes of the virtual printer and the specific actions that will be performed by each.  The attribute names of each of these variables begins with an underbar.  By reading this document you will become more familiar with exactly how a virtual printer works.

This document applies to all levels of AIX.

Basic virtual key flag attributes

A virtual printer is actually a fairly simple interface to a printer. The actions of the virtual printer are keyed by just a handful of FLAG attributes. FLAG attributes are attributes that begin with an underscore. They are called FLAG attributes, because they can be used from the command line as flags to the qprt AIX print command, or by usend lp -o -flag.  These attributes can also be set with the lsvirprt command or in AIX 4 with smitty chpq.

The key FLAG attributes that control all the function of the virtual printer shown in the list below.  There are many other flag attributes that control thinks like pitch and orientation, but if the _j attribute is turned off, these will have no affect.

  1. _j    Determines if Setup Commands are sent to the printer at the front of the print job.
      1. Controls the output of the commands in the ci attribute.
  2. _f Determines filter, if any, that should be run to preprocess the print file before sending to the formatter.
      1. Takes a one character argument like _f=c.  Filter program would be specifed in attribute fc.
  3. _d:     Determines Type of Data Formatting, if any, that should take place.
      1. Takes a one character argument like _d=a.  Formatter would then be in attribute ia.
  4. _X:    Determines Code Page of Input Data.
      1. Determines if Box characters, symbols,  Euro character, and so on will be printed.
  5. _J:    Determines if Printer is Reset to specified settings at the end of the job.
      1. Controls the output of the commands in the cr attribute.
  6. sh:    Non-flag determines header page Programs and templates.
      1. Controlled by header = in /etc/qconfig or the -Ban enq or qprt flag. (-h turns off for lpr)
  7. st:    Non-flag determines trailer page programs and templates
      1. Controlled by trailer = in /etc/qconfig or the  -Bna qprt  or enq flag.
  8. _Z:    Determines if Form Feed Sent at End of Job

Hypothetical job

A hypothetical job that passes through a virtual printer consists of some or all of the following output parts:
  1. Header Page.
    1. The header page goes through the virtual printer as a separate print job.  It is possible to issue separate formatting flags for the header page.  The header page will normally be preceded by a separate set of printer control commands.
    Controlled by:
    1. The header = entry in /etc/qconfig.   At AIX 4, it is possible to change this through the smitty chpq procedure.
    2. The -B flag for enq or qprt.   -Ban or -Bgn will give a header with no trailer.

    3. (No equivalent virtual printer Flag)
    4. The -h flag for lpr turns off the header page,  By default, lpr will always give header pages.

    5. (No equivalent virtual printer Flag)
    6. The _j flag in the virtual printer when set to 1 or + will send control codes for the header and the job.
    7. The ci attribute and included attributes will get prepended to the header page.
    8. The sh attribute in the virtual printer contains the header page.
    9. The uH attribute for some virtual printers and the sH in others supply flags that will be used only for the header page.

    10. Header Pages are printed even in passthrough mode.
  2. Printer Initialization for the Main Job Controlled by:
    1. The _j flag in the virtual printer.  The printer will be initialized if _j is not equal to 0 or !.
    2. The ci attribute and included attributes will be prepended to the print job before sending to the printer.
    3. Printer initialization will occur even in passthrough mode.

  3. The Original Data either unchanged, or formatted and/or filtered Controlled by:
    1. The _f flag in the virtual printer determines filter to use.  If _f is set to nothing, no filter will be called.

    2. Filters also work in passthrough mode.
    3. The _d flag determines data type.

    4. Data is formatted ONLY if _d=a.
    5. The _X flag determines if Code Page Translation occurs.   In code page translation, characters are converted from the input symbol set, to a symbol set that is understood by the particular printer.

    6. Code page translation  happens only when _d=a.
  4. A Form Feed at the end of the Job Controlled by:
    1. The _Z flag in the virtual printer.

    2. _Z=+ sends form feed
      _Z=! does not send form feed
      This occurs even in passthrough mode.
  5. Printer Reset Commands. Controlled by:
    1. The _J flag in the virtual printer
    2. The cr attribute and included attributes are post-pended to the print job.
    3. The st attribute in the virtual printer contains the program string for the trailer program.
    4. The uT attribute for some virtual printers can send flags that are used only for the trailer page.

    5. This occurs even in passthrough mode.

More detail

_j - Printer Initialization

The key virtual printer attributes for the initialize function are the _j flag attribute and the ci command to initialize attribute.

Printer initialization by printer type initialization commands sent by ci vary greatly with data type and printer type.

PostScript: For most PostScript virtual printers, the only initialization commands sent to the printer are:
  1. The command to put the printer into PostScript mode. This is usually done with a PJL (Printer Job Language) command such as ESC%-12345X PJL Enter Language PostScript
  2. The command to set the resolution of the printer begin 300 setresolution end
  3. The command to set the papertray, such as: begin 1 setpapertray end
When ascii data is sent to a PostScript virtual printer with the -da qprt flag or with the a _d attribute set _d=a, then the 'enscript' command is applied to the ascii data to create PostScript. In this case, many of the flags are used to determine equivalent flags for the enscript command. The data is converted to PostScript and sent to the printer in this manner.  For example, if the -z! flag is used, enscript will create PostScript that is rotated to a Landscape page.  The -p flag controls the size of the font, and the -s flag controls the fonts that are used by enscript.

GL: Most GL printers and plotters use the virtual printer very similar to the PostScript virtual printer.

ASCII Laser Printers: The virtual printers for these data streams do all the things the PostScript virtual printer does as well as to set many other starting conditions.

  1. The command to put the printer into PCL mode. This is usually done with a PJL (Printer Job Language) command such as ESC%-12345X PJL Enter Language PCL
  2. The command to set the resolution of the printer

  3. begin 300 set resolution end
  4. The command to set the papertray, such as: ESC&l#H
  5. The commands to set the font pitch, typestyle, weight, and so on
  6. The commands to set the duplex/simplex mode.
  7. The command to set Portrait or Landscape Mode
  8. The command to set the symbol set to start.
  9. The page size command
  10. The line termination more for the printer. (Add or don't add Carriage returns to line feeds).
  11. The spacing between lines.
ASCII Impact Printers The initialization commands for impact printers are usually a little different from Laser printers because you do not usually have paper drawers, duplex mode, or landscape capabilites. Some of the initialization commands are:
  1. A command to set the printer emulation mode.
  2. Quality modes are usually draft, normal, and letter quality.
  3. Pitch or characters per inch.
  4. Double Strike for bold characters.
  5. Condensed mode for 17 cpi (_K flag based)
  6. Double Spacing and Double High Characters.
  7. Lines per inch of 6 or 8.
  8. Page length and width

Allowed Flags from Command Line: The flags that are allowed on the command line are determined by the values inside the square brackets following the %f on the 'ia' attribute for ascii, the 'is' attribute for postscript, 'ic' for pcl. Usually PPDS is considered ASCII.

The following is a list of most of the attributes that are used for some type of ASCII data, and what they do:

Attribute    Description
_E           Double wide printing,  Used most on dot matrix printers, but not laser printers.
_I           Font ID, Used only for a few laser printers.  GFID (Global Font ID)
_K           Set condensed mode for proprinters, and so on. Not lasers.
_O           Archaic, Type of paper handling, manual, sheetfeed, continuous.
_Q           Paper size sent to printer.
_S           High speed printing option, Not really used.
_U           + Unidirectional printing, ! bidirectional (impact only)
_V           Vertical printing, whatever that means, not used.
_W           + Continuous double wide printing. (impact printers)
_Y           + or 1 Duplex, - or 0 simplex, 2 duplex/tumble (laser only)
_e           + emphasized print, - normal print, (mostly impact)
_j           + Send initialization sequence, ! Don't send initialization
_k           Color to print entire document.  Not for spot color (not
             currently used.
_l           Used in this part to send part of page size to printer
             for impact printers.  See also formatting flags.
_p           pitch (character size in 1/72 of inch).  This is very
             restricted.  Proprinters usually can have _p=10 or 12 only.
             Most laser printers will also take _p=17, and it is 
             possible to add more values for some laser printers by
             changing the mU or other attributes accordingly.
_q           Quality mode.  Mostly used for impact printers for NLQ or draft,  For laser
             printers this is usually 300 or 600 for dpi.
_s           Style:  This is used by laser printers to designate some
             of the FIXED point fonts, Usually only courier, italic, and
             lineprinter are allowed.  This can be customized again on
             some virtual printers by changing the mU or associated attribributes.
_u           Source of paper.  This is usually used for laser printers to
             designate the paper drawer.
_v           line density in lines per inch.  Usually this has a fixed
             value of 6 or 8, but for some laser printers the lines per
             inch is determined by the page length if more than 60 lines
             per page.
_w           page width sent to some impact printers.
_z           Orientation - (laser printers only) Portrait, Landscape, and so on
_=           Set the output bin for IBM3130 and HP LaserJet 5 printers.

Provides a hook or interface to filters.

Flag Attributes dealing with the filtering of data
_f           a single character that denotes the filter to be used.
             The filter program can be found at the attribute starting
             with f that contains this letter.  For example if _f=p,
             then fp=/usr/bin/pr, and this filter will be run on the
             data before it is sent to the virtual printer formatter.
             The filter reads from standard in and writes to standard
             out and can modify the program in any way.  One example
             is 'pr' which can add page numbers and provide 2up printing.
             Another is 'fpr' also called 'asa' which interprets column
             one (FORTRAN) carriage control characters.  A third example
             is a filter to add carriage returns to line feeds.

Formats ASCII data

This applies only to ascii data, but if this is turned on, it will also format other data, usually with results that are not what was wanted.

Usually one should NOT use the format option of the virtual printer for PostScript, PCL or PPDS data. Data is formatted if _d=a.

The formatter primarily does the following things:

  1. Determines the values for _w and _l based on the pitch, pagesize, lines per inch, and so on.
  2. Counts characters in a line and adds a line feed after _w characters.
  3. Counts lines and adds a form feed after _l lines.
  4. Adds a formfeed at the end of the job if desired.
  5. Code page translation as described below.

Formatting flags:

_L           + Wrap long lines, ! truncate lines longer than _w
_Q           Paper size, used to calculate with and length.
_X           Codepage of input data.  To print ASCII box characters _X=IBM850
_Z           + make sure Formfeed sent at end of job
_b           Number of lines to skip at bottom margin
_d           Datastream, determined which set of programs is run
     d=s   PostScript Data.  Minimal formatting is done.  This is basically
           a 'transparent or passthrough' formatter.
     d=p   Pass the data through unaltered to the device driver.  This will
           not add a carriage return to line feeds.
     d=c   PCL formatted data handler.
     d=n   troff data filter,  (for example with HP uses 'hplj' filter).
     d=g   Hewlett-Packard GL
     d=k   Kanji
     d=d   Diablo 630 datastream
_g         Page number to restart on printing.  Usefull only for ASCII.
_i         Number of spaces to indent on left column of page.
_l         Lines per page before formfeed is added.
_p         Used in calculating page width.
_t         Top margin in lines.  This count will also be used in when
           adding linefeeds after _l lines.
_v         Used in calculating page length.
_w         Page width is used to add line feeds after this count is
           exceeded.  This can cause problems if you have a graphics
           file that is sent through the formatter.
_x         Convert line feeds to carriage return and line feed, etc.
_z         Orientation - used to calculate page width and length.

Code Page (symbol set) Translation

Translates from the input codepage to the output printer symbol set.

The stage one translator translates characters in the file from the initial code page (also called symbol set) to to an intermediate. The initial code page is determined by the _X variable and determines what the ascii characters between 128 and 257 represent. The stage two translator converts the intermediate table to the output symbol set for the printer. This is determined by searching through a set of symbol translation tables until the particular character is found. Then the command is sent to the printer to change to that code page. This command is only sent once until the character is no longer found in that code page and then it sends the command for the new symbol set.

_X         Input codepage assumed for data.  At AIX 3.2.5 in the U.S.
           this is IBM-850.  At AIX 4.1 this is ISO8859-1.  These can
           give different results with different files. 
           There are no flags for the output symbol sets, but the search
           list is usually given by the t0, t1, t2, .. attributes.
The input code page is also important for printing characters such as the Euro character.

Printer Reset - cr attribute.

Resets the printer to a predefined condition.

Based on the value of the _J attribute, the command to reset the printer, which is the 'cr' attribute can be sent. This usually doesn't matter too much. In general this will send the same commands as the initialization command except that it will always use the virtual printer attribute and not the command line print flags.

_J + Send the reset commands, ! Don't reset after printing.

Header and Trailer Pages

Calls the program to send the header and trailer pages.

There are no flag attributes for the header and trailer pages. These are contained in the /etc/qconfig file, or by command line flags such as -Ban for qprt and enq. The lpr command sends a flag to send headers by default. If an application uses this command and you cannot specify options, headers can be turned off by sh, set sh=[enter], so that it is set to nothing.

Sends a Form Feed at the end of Job

At the end of a job the virtual printer insures that the page will be ejected from the printer by sending a form feed. This is controlled by the _Z attribute, and the form feed will even be sent in passthrough mode. If you are getting an extra page at the end of a formatted job, set _Z=!. This will usually help because the file might already have a form feed, and with the one from the virtual printer there may be two.

[ Doc Ref: 91911217713924     Publish Date: Mar. 29, 2001     4FAX Ref: 6440 ]