How to use troff to orientate in landscape


   Env: AIX 325
        model 530

   Desc: The customer is trying to run the following:

   troff \ | hplj -landscape | qprt \

   Action: This is not working for the customer and he would like to
  know how to make the -landscape flag work.  This gives an error:

  hplj: -landscape is not valid choice.
 The troff itself does not support landscape.
 Cust's repsonse was yes it does he is looking at the man page right now.
 He said hplj option supports -l for landscape.
 I said the hplj is a postprocessor for troff and yes it does support
 the flag but it needs to be run seperatly, or in other piped to hplj 
 and them piped to a printer command.

 troff -mm -T hplj foo | hplj -landscape | lp -dhp -o -dp

 The hplj command man page shows that there is a -landscape
 flag, but the flag doesn't work.


 troff -mm -T hplj file | hplj | qprt -z+ -dp

 But this didn't work.  Bet that -z+ is inserting the PCL
 sequence for landscape, but perhaps hplj is resetting this
 later in the data stream.

 I don't get the error in my AIX 4 system for
     hplj -landscape

Here is the problem. This was a change that was made for 4.1 and the
documentation for 3.2 accidentally got changed. The original
documentation for 3.2 does not have this -landscape flag in its
documentation. So, use what I showed you above until they go to aix 4.1
 I tested this at AIX 4.1 and it DOES work.

 To find a solution at AIX 3.2.5 I did the following test:
  1.  Disabled the queue
  2.  printed with:
     troff -mm -Thplj sample.txt | hplj  | qprt -Bnn -dp -Ppcl
  3.  Examined the file.  There were NO orientation commands
     such as \\033&0O to designate portrait, however the first
     command in the file was a PCL reset command \\033E.
     which does a reset of the printer and which would put it
     into Portrait mode.

I have something that now works:   (Assuming you use a virtual 
printer).  A different filter would be needed without a virtual printer.

1.  First create a filter - I call this one norset - for no_reset

/* norset.c,  compile 'cc -o norset norset.c'                   */
/* filter to remove ESC E printer reset from data stream        */
\#include        "stdio.h"
int main(void)
{        int c, c1;
        while ( (c = getc(stdin)) != EOF)
                if (c==27)
                  c1 = getc(stdin);
                  if (c1 != 'E')              /* Ignore the reset command */
                  putc(c, stdout);
                  putc(c1, stdout);
                     printf("\\033&1O");        /* Landscape command *//
                  putc(c, stdout);
 Copy the file to /bin - or anywhere with access permissions for all.
 Next I add the filter to the virtual printer
   Select the PCL virtual printer
   fl=/bin/norset (enter)
   (enter) to exit lsvirprt.
 Next print:
  troff -Thplj exmp.1 | hplj | qprt -dp -fl -z+ -Bnn -Ppcl   
  where pcl is the pcl queue name.

This prints in landscape and is formatted per troff.  User must take
care of the length and width of the page.

Is it possible to do this to a PostScript printer.  The answer is
that this is not supported at AIX 3.2 or AIX 4.1  The only possibility
would be to change mediasizes and that does not rotate the
page, and in fact does not really work at all for most options.

For PostScript you can't even do this:
tbl \ | troff -Tpsc -me | psc | qprt -ds -P \ -z 1
because the virtual printer assumes the file will contain orientation.

Support Line: How to use troff to orientate in landscape ITEM: BE6511L
Dated: February 1996 Category: N/A
This HTML file was generated 99/06/24~13:30:22
Comments or suggestions? Contact us