The instructions in this document are specific to AIX 4.1, but can be applied to AIX 3.2.5 systems without the limits fields.
NOTE: The printer you are printing to must support the additional options.
Landscape options for AIX virtual printers are described in the "Portrait and Landscape" section of the technical document AIX Printer Tips: Virtual Printer Overview.
At AIX 4.1, the allowed virtual printer options are determined by a limits field. This field determines two things:
Based on the predef templates, it becomes readily apparent that the PCL printers get their _z attribute from the generic.pcl file. The _z attribute in generic.pcl is:
:618:_z:S[E005]I[1810520]EnR[pioattr1.cat,1,620;portrait,landscape=!,+]:!
This means that the only options that you will see are landscape and portrait.
The man pages on qprt indicate that there are 4 values for orientation:
Yet most of the printer definitions only had '+' and '!' for values. The qprt command would give errors on invalid values for the -z flag using anything other than + or !.
The objective of this document is to describe how to make changes to a virtual printer predef file to support these options. The examples are for a PCL printer.
For example, for the HP LaserJet Family the PCL values are:
Function Parameter Command Decimal Value Hexadecimal
Value
Orientation
Orientat Portrait Ec&0O 027 038 108 048 079 1B 26 6C 30 4F
ion (o) (111) (6F)
Landscape Ec&1O 027 038 108 049 079 1B 26 6C 31 4F
(o) (111) (6F)
Reverse Ec&2O 027 038 108 050 079 1B 26 6C 32 4F
Portrait (o) (111) (6F)
Reverse Ec&3O 027 038 108 051 079 1B 26 6C 33 4F
Landscape (o) (111) (6F)
The messages that are used by the virtual printer program can
be displayed with the dspcat command. An appropriate
message to use would be one with landscape or portrait, so try
the following:
# dspcat pioattr1.cat | grep landscape
1 : 107 Rotate Page Printer Output (!:no - portrait +:yes - landscape)
1 : 620 portrait,landscape
1 : 725 portrait,landscape right,portrait upside-down,landscape left
1 : 751 portrait,landscape left,portrait upside-down,landscape right
1 : 950 Rotate Page Printer Output (0: portrait 1: landscape)
Pick out the one that makes sense, and use that as the number replacing the 620 above. Let's say we wanted to use the 725 value above.
Based on these attributes, it is obvious to the trained eye that:
Those with an untrained eye should use lsvirprt and see the description for each attribute.
You might also notice that eO is included in the ci attribute, and so
it will be sent to the printer during printer initialization. This
means that we will have to change or at least be aware of the effects
of changing _z on these attributes.
At AIX 4, changes that will affect limits need to be made in the predef templates because these are used to build the SMIT screens. The other option is to actually make odm commands to change SMIT, but this is a more dangerous option for the uninitiated.
This example uses the hplj-4.pcl predef file, but it is generally applicable to other PCL drivers.
First, create a virtual printer with the original driver for later comparison.
Follow these steps:
:618:_z:S[E005]I[1810520]EnR[pioattr1.cat,1,725;portrait,landscape right,portrait upside-down,landscape left=0,1,2,3]:0
What does all this mean?
dspcat pioattr1.cat 1 618 Page ORIENTATION
1 : 725 portrait,landscape right,portrait upside-down,landscape left
Use the virtual printer you created from the original.
Determine lines per page based on lines per inch W4 = %?%G_z%t%GwR%e%GwK%;%gv%*%{300}%/%d %? <IF> %G_z PUSH: (Page ORIENTATION) %t <THEN> %GwR PUSH: (Page Length (pels) For Landscape Orientation) %e <ELSE> %GwK PUSH: (Page Length (pels) For Portrait Orientation) %; <END> %gv PUSH: (Internal Variable v) %* PUSH: (pop2 * pop1) %{300} PUSH: (Integer Constant 300) %/ PUSH: (pop2 / pop1) %d POP -> ASCII String -> OUTPUT ~
You need to modify this so it uses Landscape for values 1 and 3, and
portrait for values 0 and 2. This can be done by changing to:
Determine lines per page based on lines per inch
W4 = %?%G_z%t%GwR%e%GwK%;%gv%*%{300}%/%d
%? <IF>
%G_z PUSH: (Page ORIENTATION)
%{1} /* Add constant 1 to check for comparison */
%& /* See if the orientation and with constant 1 */
/* This will hold for both 1 and 3 */
%t <THEN>
%GwR PUSH: (Page Length (pels) For Landscape Orientation)
%e <ELSE>
%GwK PUSH: (Page Length (pels) For Portrait Orientation)
%; <END>
%gv PUSH: (Internal Variable v)
%* PUSH: (pop2 * pop1)
%{300} PUSH: (Integer Constant 300)
%/ PUSH: (pop2 / pop1)
%d POP -> ASCII String -> OUTPUT
~
Save these changes, and then check the value in the custom file, so you can add it to the new predef file.
:679:W4::%?%G_z%{1}%&%t%GwR%e%GwK%;%gv%*%{300}%/%d
This line gives the following pseudo-code interpretation:
If (_z AND 1 )
Use Landscape Settings to determine lines per page increment
else
Use Portrait Settings to determine lines per page increment.
endif
Looking at the wj attribute you see:
The pseudo-code for this is
If (_z AND 1 ) Use Landscape Settings to determine lines per page increment else Use Portrait Settings to determine lines per page increment. endif
This should work fine as is, and no changes are required.
This wk attribute default is:
This again has the same pseudo-code meaning and does not need to be changed.
You probably don't need to change this value because it expands to fit the required command. This command sends out the sequence: ESC&l#O where # = the _z value or the -z flag.
:202:eO::\33&l%G_z%dO
Excerpt from the hplj-4.pcl predef file:
...
:712:_q:S[B045]I[1810554]EnR[=300,600]:300
:618:_z:S[E005]I[1810520]EnR[pioattr1.cat,1,725;portrait,landscape right,
portrait upside-down,landscape left=0,1,2,3]:0
:060:__SYS::
......
:062:__WKV::
:679:W4::%?%G_z%{1}%&%t%GwR%e%GwK%;%gv%*%{300}%/%d
:689:W6::%?%GWu%{3}%<%GWu%{5}%>%|%t%IWP%e%IWE%;
...
portrait landscape right portrait upside-down landscape left