ITEM: CH4462L
Using"extend" filter in virtual printer
Question:
ENV: model 7011 aix 3.2.5. hplaserjetII attached to native serial port.
desc: is there a way to include the "extend" command into the aix
virtual printer?
act: they are printing pgs of code from various unix boxes. and say,
instead of a request to print 8 spaces for a tap, user wants
to have each tab expanded to only 3 spaces. This can be
done with "expand -3 filename". How do I put this into a
virtual printer.
Response:
Normally tabs are a problem only for ASCII virtual printers
When using an ASCII virtual printer, the wh attribute
controls the tab settings. This can not be done for
PostScript virtual printers.
Since PostScript virtual printers only have filters, fl, fp,
and fn, I would prefer to add a new filter 'fc'.
I had him add the following to the colon file:
:264:fc::/usr/bin/expand -3
right above the fn line.
ran lsvirprt to redigest.
sent job to printer. nothing printed. we are sending ascii job to
ps queue and printer.
I then had him redirect the output to /dev/lpx by changing
the "file = /dev/lp0" to "file = /dev/lpx" so we could
examine the output. This showed that when we added the
filter, "enscript" was now getting a file name of stdin,
and nothing from the original file was in the output.
Normally I would say, to do this in the PCL mode with "wh", but
customer's printer is an HP laserjet series 2. This printer
does not switch gracefully from PS to PCL so we want to keep
the output data in PS (_d=a).
Performed these tests:
Test 1:
Does expand work through enscript
a. Created file with tabs -> tab.test
b. enscript -dps tab.test
c. expand -3 tab.test | enscript -dps
Result: This test showed expanded tabs
printed in fewer columns than the straight enscript.
Test 2:
How does this work with the virtual printer.
qprt -da -Pps tab.test
I tested at AIX 4.1 first to see if this would work.
chvirprt -q ps -d lp0 -a "f2=/usr/bin/expand -3"
qprt -da -f2 -Pps tab.test
Result: This also printed as desired. Tabs 3 spaces.
This works fine at AIX 4.1
Test 3:
AIX 3.2.5
> /dev/lpx
a. Created a new virtual printer - Generic PostScript called expand
Device is lpx, file = /dev/lpx
b. Added line in custom file:
:264:fc::/usr/bin/expand -3
c. lsviprt - to make other changes
d=a (For ascii at postscript queue)
qprt -Pexpand tab.test
cp /dev/lpx > expand.test2
> /dev/lpx
qprt -fc -Pexpand tab.test
cp /dev/lpx > expand.test1
> /dev/lpx
diff expand.test1 expand.test2
\< Represents file with -fc, fc=/usr/bin/expand -3
> Represents file without -fc
3,4c3,4
\< %%Title: stdin
\< %%CreationDate: Mon Nov 11 17:29:16 1996
---
> %%Title: /tmp/tab.test
> %%CreationDate: Mon Nov 11 17:30:40 1996
183a184,201
> %%Page: ? 1
> StartPage
> 0 F
> 900 14900(This )B
> 360(is)X
> 720(a)X
> 840(tab)X
> 600(test)X
> 900 14680(If I put)B
> 960(tabs)X
> 480(in)X
> 720(different places)X
> 900 14460(What)B
> 480(will)X
> 480(happen)X
> 240(to)X
> 720(them)X
> EndPage
This shows that the file looks like it came from stdin,
and all the data is lost. This duplicates the users
problem.
TEST 4:
Tested "expand tab.test" at AIX 3.2.5 and this works ok.
TEST 5:
Try adding expand iside 'ia' attribute pipeline
lsvirprt
ia~v
Changed line from:
' && BFLAG=" -b $PIOTITLE ";/usr/bin/enscript '
to
' && BFLAG=" -b $PIOTITLE ";/usr/bin/expand -3 | /usr/bin/enscript '
This seemed to print, but not change the file at all.
In next case use -A2 flag to get the program order run by the
virtual printer.
Printed with "qprt -A2 -da -Pexpand tab.test" This shows
why the file is not changed. The pipeline shows:
test "$PIOTITLE" != /tmp/tab.test &&
BFLAG="
-b $PIOTITLE ";
/usr/bin/expand
-3 |
/usr/bin/enscript
-XISO8859-1
-p-
-q
-B $BFLAG
-L66
-fCourier10 /tmp/tab.test |
....
This shows that enscript is being passed the original
file name to print, but the output from expand is not
the original program.
Using lsvirprt ia~v (ia tilde v) to look at the attribute
I see with my changes it starts:
'test "$PIOTITLE" != '
%I@1 INCLUDE: (Path Name of File Being Printed)
' && BFLAG=" -b $PIOTITLE ";/usr/bin/expand -3 | /usr/bin/enscript '
%? \
%CX PUSH: (1 If -X Flag on Command Line; Otherwise 0)
%t \
%f[X] For Each Flag x on Command Line: "-xArgument" -> OUTPUT
%e \
' -X'
%I_X INCLUDE: (Code Page Name For Print Data Stream (file with same
name in dir. "d1"))
%; \
The problem is nothing is being passed to expand, and then later
at the bottom of the ia attribute we find:
%? \
%L_f PUSH: (Length of Attribute: Single-Character BSD-type Filter
Name (e.g., "p" for "pr" filter))
%t \
%e \
' '
%I@1 INCLUDE: (Path Name of File Being Printed)
%; \
' | '
%Iis INCLUDE: (Pipeline for Input Data Stream "s" (PostScript))
This shows were enscript gets the filename to print. This
means that when we send data through a filter, it should not
get the file name. What we have seen is that no file name
and no data are sent.
TEST:
Remove:
%? \
%L_f PUSH: (Length of Attribute: Single-Character BSD-type Filter
Name (e.g., "p" for "pr" filter))
%t \
%e \
' '
%I@1 INCLUDE: (Path Name of File Being Printed)
%; \
Change line near the top of the ia~v to say:
' && BFLAG=" -b $PIOTITLE ";/usr/bin/expand -3 %I@1 | /usr/bin/enscript '
Print to file "qprt -A2 -da -Pexpand tab.test"
Diff the output with earlier test:
\< 900 14900(This )B
\< 360(is)X
\< 720(a)X
\< 840(tab)X
\< 600(test)X
\< 900 14680(If I put)B
\< 960(tabs)X
\< 480(in)X
\< 720(different places)X
\< 900 14460(What)B
\< 480(will)X
\< 480(happen)X
\< 240(to)X
\< 720(them)X
---
> 900 14900(This is a tab test)B
> 900 14680(If I put tabs in different places)B
> 900 14460(What will happen to them)B
This shows that expand worked on the file, and the
virtual printer now does what the customer wanted.
Now to tell customer how to do this:
Summary:
lsvirprt
Choose Printer Queue
ia~v
Move down below the top long line to:
'test "$PIOTITLE" != '
%I@1 INCLUDE: (Path Name of File Being Printed)
' && BFLAG=" -b $PIOTITLE ";/usr/bin/enscript '
%? \
%CX PUSH: (1 If -X Flag on Command Line; Otherwise 0)
%t \
Go to the line that shows:
' && BFLAG=" -b $PIOTITLE ";/usr/bin/enscript '
Change this line to now read in 3 lines:
' && BFLAG=" -b $PIOTITLE ";/usr/bin/expand -3 '
%I@1
' | /usr/bin/enscript '
Move to the bottom of the file (/tmp/expand:lpx.ia) still without
leaving the vi session from ia~v
Delete the lines that say:
%? \
%L_f PUSH: (Length of Attribute: Single-Character BSD-type Filter
Name (e.g., "p" for "pr" filter))
%t \
%e \
' '
%I@1 INCLUDE: (Path Name of File Being Printed)
%; \
Save the changes and print.
This now prints fine on my 3.2.5 system.
Talked customer through the modifications.
Customer printed test page, and said that he is QUITE HAPPY.
Support Line: Using"extend" filter in virtual printer ITEM: CH4462L
Dated: November 1996 Category: N/A
This HTML file was generated 99/06/24~13:30:17
Comments or suggestions?
Contact us