Chapter 3. Tuning

Q: My printer needs special treatment to reset it, set the codepage, enable LF->CR+LF conversion, add an extra formfeed afterwards etc.
Q: Printing program listings etc. is dog slow.
Q: I want to print the source code of some PostScript, HTML, Sketch, ... file, but it doesn't seem to work.
Q: Wrong print margins when printing ASCII using a2ps.
Q: The margins are completely wrong for all printouts.
Q: My PostScript printer doesn't properly render the page, some bits are missing.
Q: When I print more than one file at a time, the headers for ASCII files are wrong -- they still show the name of the first file!
Q: Why is my dvi-file messed up? It should be in landscape mode, but the right border is chopped off!
Q: My printer/driver can only produce grayscale output. So it doesn't matter what value COLOR has, right?

Q: My printer needs special treatment to reset it, set the codepage, enable LF->CR+LF conversion, add an extra formfeed afterwards etc.

A: Grab your printer documentation to look for the escape sequences needed. Enter these into the configuration variables RAW_PROLOGUE and RAW_EPILOGUE resp. (remember to use octal values).

E.g. for a printer reset that consists of "ESC c":

    RAW_PROLOGUE='\033c'
An extra formfeed at the end would be enabled by:
    RAW_EPILOGUE='\014'


Q: Printing program listings etc. is dog slow.

A: If you use a2ps (default) or mpage to print ASCII text, it first gets translated to PostScript and then rastered by ghostscript; actually you're printing a bitmap in this case.

Edit the appropriate apsfilterrc file to include "ASCII_FILTER=recode" (and be sure to have recode installed). You may also need to set RECODE_OPTS to use the right conversion (default: latin1 to ibmpc).

After that ASCII files will directly be sent to the printer, without any conversion to PostScript. But you also lose all the spiffy features like borders, headers and multiple pages per sheet.

Q: I want to print the source code of some PostScript, HTML, Sketch, ... file, but it doesn't seem to work.

A: Use

    lpr -C ascii filename
to force treatment of filename as ASCII text.

Q: Wrong print margins when printing ASCII using a2ps.

A: Please fix them. :)

If you use FreeBSD, please use one of the a2ps ports (-letter, -a4, -hpdj).

Otherwise you have to edit the Medium definition in the a2ps config file (probably /usr/local/etc/a2ps.cfg). For example:

    #       name     width height   llx    lly     urx    ury
    Medium: A4stylus   595    842    22     45     566    815
           
The numbers are PostScript points (1pt = 1/72"), for width, height, left, bottom, right and top coordinate of the usable part of the page (where (0,0) is lower left).

In this example the margins are about 0.3" left, 0.625" bottom, 0.4" right and 0.375" top.

Q: The margins are completely wrong for all printouts.

A: You have to adjust ghostscript to recognize the proper margins. First of all, print out setup/test.ps -- you'll see a raster around the page. This has a millimeter scale, so beware (1" = 25.4mm).

You should easily see what area you printer can use.

uniprint drivers contain a line '-dupMargins="{ 9.0 39.96 9.0 9.0}" or similar; these are the left, bottom, right, top margins in points (1pt = 1/72"). Other

If not the margins, but the page _offset_ is wrong (the whole page is shifted left/right or up/down), you must measure the distance the inner rectangle of setup/test.ps is shifted to the left/top and get the correction parameter from those values.

The left top corner of the (white) inner rectangle is 20mm from the left/top corner of the page (20mm = 0.7874" = 56.7pt). Let's say the distance of that corner is L from the left edge and T from the top edge; then you get

    X = (20 - L) * 28.35       X = (0.7874 - L) * 72
    Y = (20 - T) * 28.35       Y = (0.7874 - T) * 72
    if units are mm            if units are inches
       
Now add '-dMargins="{X Y}"' to GS_FEATURES in the configuration file.

Q: My PostScript printer doesn't properly render the page, some bits are missing.

A: Pages in higher resolutions needs plenty of RAM to be rendered. For some printers the standard amount of memory that is built in is just not enough. The only solution is to lower the resolution (to probably half the amount).

Q: When I print more than one file at a time, the headers for ASCII files are wrong -- they still show the name of the first file!

A: This ever-annoying problem only occurs with BSD spoolers which just don't give that much information about a print job to the filter.

Install LPRng, or print just one file at a time, or disable headers.

Q: Why is my dvi-file messed up? It should be in landscape mode, but the right border is chopped off!

A: The problem is that dvips doesn't know if the file is in landscape mode or not. You have to explicitely use the ``landscape'' class option to print that file properly:

    lpr -C landscape file.dvi


Q: My printer/driver can only produce grayscale output. So it doesn't matter what value COLOR has, right?

A: Wrong. For examples, a2ps uses colors to render headers, do pretty- printing etc. These colors look different on a grayscale printer than the gray levels used when COLOR=mono is set.

Additionally, some converters use special algorithms when they are told to produce grayscale output; this might improve the result. They usually run faster in this mode, as well.

For questions about Apsfilter, e-mail <apsfilter-help@apsfilter.org>.
For questions about this documentation, e-mail <apsfilter-doc@apsfilter.org>.