Bug Reports article 1173288 [ Notify of changes ] [ Edit/Retrieve Marked Documents ] [ Mark Document ] Did the search result in the document you were looking for? Send Feedback ------------------------------------------------------------------------ Bug Id: 1173288 Category: utility Subcategory: printer Release summary: s493 Synopsis: Printing Subsystem should support autosensing PS printers. Integrated in releases: Patch id: Description: Many current laser printers including the worlds favourite the HP LaserJet IV can support standard text (HPGL) and PostScript either as standard or with the addition of a PostScript option ( SIMM ). lp does not support these printers very well. If you configure your printer as a PS printer, lpsched uses postio to communicate to the printer. Postio expects the printer to behave like an Apple Laserwriter and respond to status requests, these printers don't do this. This is because they "autosense" the document by checking the first couple of charcaters for %! - postio on the other hand expects the printer to respond to a DC4 with something like %%[st atus: idle]%% before it starts sending data. You can of course configure lp so that the printer is set up as a "dumb" text printer and turn the banner off it should now print the file if it is text of postscript, but you can't send specific startup strings ( like ESC&K2G to tell the printer to map LF to CRLF ) because this would break the postscript document.. Work around: Write a custom filter and submit with lpfilter: 1) Create a dummy terminfo entry: edit /tmp/ibm_printer #dummy entry that does nothing ibm_printer, use=dumb, compile it: tic -v /tmp/ibm_printer 2) Submit the filter to the lp system: create the filter program: /etc/lp/ibm-filter #!/bin/sh # # An awk filter for an IBM laser that can auto-sense if the file sent is # PostScript or text. The filter decides if the file is PostScript bt checking # the first 2 characters of the first line. If these characters are %! then # the file is assumed to be PostScript. If the file is PostScript then # the standard input is copied unmodified to the standard output. # After all data is sent an EOF character is sent. # If the file is text, the standard input is copied to the standard output # A FF is send after all the data # AWK=/usr/bin/nawk $AWK ' BEGIN {ORS= "\n" ; PS_TRAILER="\004" ; TEXT_TRAILER="\f" } { if(NR==1) { start=substr($0,1,2) structured_ps=substr($0,1,10) if(start == "%!" ){ PS="yes" if(structured_ps == "%!PS-Adobe") { SPS="yes" } } else { PS="no" } # # The PS interpreter wants to see "%!PS-Adobe" but a post script # file need only have "%!" to be a postscript file. This # will let the printer have what it wants ! # if(PS=="yes") { if(SPS=="yes") { print $0 } else { print "%!PS-Adobe" } } # If the file is not postscript at all , then print first line. else print $0 } else { # just print all lines after the first print $0 } } END { ORS= "" ; if(PS== "yes") print PS_TRAILER ; else print TEXT_TRAILER } ' exit 0 Make it executable by lp Create a filter description file. ================================= Here is an example: /etc/lp/fd/ibm.fd ==================== Input types: any Output types: ibmspec Printer types: any Printers: any Filter type: fast Command: /etc/lp/ibm-filter Register the filter with the lp spooler. ======================================== lpfilter -F /etc/lp/fd/ibm.fd -f ibmspec NOTE: The filter name SHOULD be the same as output type defined in the printer definition file. 3) Set up a printer: lpadmin -p -v /dev/term/a -T ibm_printer -I ibmspec enable accept 4) Disable the printer banner. Because the banner is created by the interface file, it will not pass though your new filter. This could give strange results or stop the filter working at all ! To disable the banner, edit /etc/lp/interfaces/ Change: nobanner="no" to: nobanner="yes" If you want a filter AND a banner, rewrite the filter to create the banner rather than letting the interface file create it. History: Submitter: mark.fenwick@uk Date: 07/28/94 Dispatch Operator: bugtraq Date: 07/28/94 Evaluator: jacobs@central Date: 08/09/94 Closeout Operator: jacobs@central Date: 08/09/94 ------------------------------------------------------------------------ Home | Free Services | Contract Services | Account Services | Table of Contents Comments about SunSolve | Help | SunSolve FAQ's | Privacy Policy Questions or comments regarding this service? webmaster Copyright 1994-1998 Sun Microsystems, Inc., 901 San Antonio Road, Palo Alto, CA 94303 USA. All rights reserved.