File: handbook.html.in

package info (click to toggle)
apsfilter 7.2.6-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,356 kB
  • sloc: sh: 452; ansic: 236; perl: 175; makefile: 124
file content (2413 lines) | stat: -rw-r--r-- 103,046 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
<html>
<!-- $ApsCVS: src/apsfilter/doc/handbook.html.in,v 1.13.2.15 2004/01/05 12:04:19 andreas Exp $ -->
<head>
  <title>apsfilter handbook, 2nd ed.</title>
  <meta name=author content="Michael Loin">
  <meta name=copyright content="(c) 2001,2002 -- distributable under the GPL">
</head>

<body>

<h1 align=center>
<a href="#contents"><img src="apsfilter4.png" width=461 height=216 border=0>

<br>apsfilter handbook, 2nd ed.</h1></a>

<p align=center>
Michael Lo&szlig;in<br>
(c) 2001,2002 -- distributable under the GPL</p>

<hr>
<h1 align=center><a name="contents">Table of Contents</a></h1>
<br>
<br><b><a href="#preface">1 Preface</a></b>
<ul>
  <li><a href="#preface_abstract">1.1 Abstract</a>
  <li><a href="#preface_about">1.2 About this document</a>
  <li><a href="#preface_conv">1.3 Conventions</a>
</ul>
<b><a href="#intro">2 Introduction</a></b>
<ul>
  <li><a href="#intro_what">2.1 What is it?</a>
  <li><a href="#intro_whatnot">2.2 What is it not?</a>
  <li><a href="#intro_why">2.3 Why should I use it?</a>
  <li><a href="#intro_whynot">2.4 Why shouldn't I use it?</a>
  <li><a href="#intro_forme">2.5 Is it for me?</a>
</ul>
<b><a href="#install">3 Installation</a></b>
<ul>
  <li><a href="#install_prep">3.1 Preparation</a>
  <li><a href="#install_proc">3.2 Installation procedure</a>
  <li><a href="#install_notes">3.3 System specific notes</a>
  <ul>
    <li><a href="#install_notes_suse">3.3.1 SuSE Linux</a>
    <li><a href="#install_notes_freebsd">3.3.2 FreeBSD</a>
    <li><a href="#install_notes_solaris">3.3.3 Solaris</a>
  </ul>
</ul>
<b><a href="#setup">4 Setup</a></b>
<ul>
  <li><a href="#setup_prep">4.1 Preparation</a>
  <ul>
    <li><a href="#setup_prep_license">4.1.1 License</a>
    <li><a href="#setup_prep_spool">4.1.2 Spool directory</a>
    <li><a href="#setup_prep_printcap">4.1.3 Printcap entries</a>
  </ul>
  <li><a href="#setup_main">4.2 Main menu</a>
  <ul>
    <li><a href="#setup_main_avail">4.2.1 Available drivers</a>
    <li><a href="#setup_main_gsdoc">4.2.2 Ghostscript documentation</a>
    <li><a href="#setup_main_driver">4.2.3 Driver selection</a>
    <li><a href="#setup_main_interface">4.2.4 Interface</a>
    <li><a href="#setup_main_paper">4.2.5 Paper format</a>
    <li><a href="#setup_main_quality">4.2.6 Printing quality</a>
    <li><a href="#setup_main_color">4.2.7 Color mode</a>
    <li><a href="#setup_main_resol">4.2.8 Resolution</a>
    <li><a href="#setup_main_method">4.2.9 Printing method</a>
    <li><a href="#setup_main_test">4.2.10 Test page</a>
    <li><a href="#setup_main_perflog">4.2.11 Performance log</a>
    <li><a href="#setup_main_abort">4.2.12 Abort</a>
    <li><a href="#setup_main_install">4.2.13 Installation</a>
    <li><a href="#setup_main_finish">4.2.14 Finish setup</a>
  </ul>
  <li><a href="#setup_tips">4.3 Tips and tricks</a>
</ul>
<b><a href="#usage">5 Usage</a></b>
<ul>
  <li><a href="#usage_normal">5.1 Normal operation</a>
  <li><a href="#usage_special">5.2 Special features</a>
  <ul>
    <li><a href="#usage_special_duplex">5.2.1 Fake duplex</a>
    <li><a href="#usage_special_copies">5.2.2 Fast copies</a>
  </ul>
  <li><a href="#usage_file">5.3 Printing to a file</a>
  <li><a href="#usage_preview">5.4 Preview before printing</a>
</ul>
<b><a href="#config">6 Configuration</a></b>
<ul>
  <li><a href="#config_files">6.1 Configuration files</a>
  <ul>
    <li><a href="#config_files_rc1">6.1.1 apsfilterrc (global, local)</a>
    <li><a href="#config_files_rc2">6.1.2 apsfilterrc (user specific)</a>
    <li><a href="#config_files_restr">6.1.3 restrictions (global, local)</a>
    <li><a href="#config_files_samba">6.1.4 smbclient.conf (local)</a>
    <li><a href="#config_files_netware">6.1.5 netware.conf (local)</a>
    <li><a href="#config_files_lpr">6.1.6 lpr.conf (local)</a>
    <li><a href="#config_files_apple">6.1.7 pap.conf (local)</a>
  </ul>
  <li><a href="#config_options">6.2 Command line options</a>
  <li><a href="#config_notes">6.3 Configuration notes</a>
  <ul>
    <li><a href="#config_notes_nup">6.3.1 Landscape and N-up printing</a>
    <li><a href="#config_notes_duplex">6.3.2 Page order in fake duplex mode</a>
  </ul>
</ul>
<b><a href="#faq">7 FAQ</a></b>
<ul>
  <li><a href="#faq_error">7.1 Error messages</a>
  <li><a href="#faq_fail">7.2 Printing failures</a>
  <li><a href="#faq_tuning">7.3 Tuning</a>
</ul>
<b><a href="#links">8 Links</a></b>
<ul>
  <li><a href="#links_software">8.1 Third party software</a>
  <li><a href="#links_info">8.2 Further information</a>
</ul>
<b><a href="#help">9 Help</a></b>
<ul>
  <li><a href="#help_us">9.1 You help us</a>
  <li><a href="#help_you">9.2 We help you</a>
  <ul>
    <li><a href="#help_you_bug">9.2.1 Reporting bugs</a>
    <li><a href="#help_you_general">9.2.2 General help</a>
  </ul>
</ul>
<hr>

<h1><a name="preface">1 Preface</a></h1>

<h2><a name="preface_abstract">1.1 Abstract</a></h2>

<p>
This handbook explains how to set up, operate, configure and extend the
<em>apsfilter</em> package while providing a step-by-step installation
guide. It is focused on <em>apsfilter version @VERSION@</em> and compatible.

<h2><a name="preface_about">1.2 About this document</a></h2>

<p>
You are looking at the second edition of the <em>apsfilter handbook</em>.
It was written by <a href="mailto:phallobst@web.de">Michael Lo&szlig;in
&lt;phallobst@web.de&gt;</a> (&copy; 2001,2002) and has been published under
the regulations of the <strong>GPL</strong>.

<p>
It is available as indexed HTML, PostScript, PDF (with links) and plain text.
These editions are generated from a source HTML file by <tt>htmldoc</tt> and
<tt>w3m</tt>.

<p>
The colorful <em>apsfilter</em> logo was created by
<a href="mailto:cjcox@acm.org">Chris Cox &lt;cjcox@acm.org&gt;</a>.

<p>
If you feel something important is missing, if you find blatant
typos or obsolete information, please contact the mailing-list at
<a href="mailto:apsfilter-doc@apsfilter.org">&lt;apsfilter-doc@apsfilter.org&gt;</a>.

<h2><a name="preface_conv">1.3 Conventions</a></h2>

<p>
Throughout this document we'll use the following typographical conventions:

<dl>
  <dt><tt>foobar</tt>
    <dd>1. absolute or relative path names
    <br>2. computer input and output
  <dt><em>foobar</em>
    <dd>1. emphasis
    <br>2. software package names (as opposed to <tt>executables</tt>)
  <dt><tt>#</tt>
    <dd>the root prompt
  <dt><tt>$</tt>
    <dd>the user prompt
  <dt><tt>$FOOBAR</tt>
    <dd>environment variables
  <dt><tt>FOOBAR</tt>
    <dd>configuration variables
</dl>

<h1><a name="intro">2 Introduction</a></h1>

<h2><a name="intro_what">2.1 What is it?</a></h2>

<p>
<em>Apsfilter</em> is an input filter suitable for most of the printer spoolers
found on many UNIX-like operating systems. It is used all over the world in
many different environments, from single user desktop computers to large-scale
university networks.

<p>
The goal of <em>apsfilter</em> is to provide the user <strong>and</strong> the
system administrator with a simple way to maintain, configure and use the
printing services of the UNIX system. It's not targeted at one particular
flavour or distribution of UNIX -- <em>apsfilter</em> tries to behave as
friendly as possible in any environment.

<p>
The latest major version of <em>apsfilter</em> is 7.0.0 which was released in
December 2001. There are also development snapshots and a CVS repository
available. Point your web browser to the <em>Apsfilter Homepage</em> at
<a href="http://www.apsfilter.org/">http://www.apsfilter.org/</a> for a better
overview of the latest releases.

<p>
The maintainer and copyright owner of <em>apsfilter</em> is
<a href="mailto:andreas@apsfilter.org">Andreas Klemm &lt;andreas@apsfilter.org&gt;</a>;
he coordinates releases, merges patches from contributors and does stuff. Do
<strong>not</strong> send <a href="#help_you_bug">bug reports</a> or
<a href="#help_you_general">help requests</a> to this email address -- there
are mailing-lists that will save you (and us) the hassle of long fights with
<em>apsfilter</em>.

<h2><a name="intro_whatnot">2.2 What is it not?</a></h2>

<p>
<em>Apsfilter</em> is not a printer driver collection. It completely relies on
<em>ghostscript</em> to provide a driver, since it only prepares the input
data, primarily by converting it to PostScript.

<p>
It also does not provide a printer spooler system, but instead it utilizes
services offered by the <em>BSD</em> spooler or its successor <em>LPRng</em>.

<h2><a name="intro_why">2.3 Why should I use it?</a></h2>

<p>
<ul>
  <li>it's free: the <em>GPL</em> ensures that it will always be
  <li>it's flexible: you can print almost any kind of file (with the help of
    various conversion tools):
    <blockquote>
    ASCII (more precisely: all sorts of text), BMP, DVI, FBM, FIG, FITS, GIF,
    Group 3 fax, HTML, IFF ILBM, JPEG, Kodak Photo CD, MGR, MIFF, PDF, PNG,
    PNM, PostScript, RLE, SGI, Sketch, Sun raster, Targa, TGIF, TIFF, troff,
    WMF, WordPerfect graphics, XCF, X pixmap, X window dump
    </blockquote>
  <li>it works: more precisely, it works right out of the box -- no compilation
    necessary
  <li>it's extendable: new file formats, new drivers, new converters have
    always been integrated without much hassle
  <li>it's simple: a couple of printer-independent command line options allow
    you to control certain aspects of file formatting, visual appearance etc.
    without having to know which printer or driver you are using
  <li>it uses free components: other programmers already have invented the
    wheel, so we use their work and do some plumbing to produce <em>The
    Right Thing</em>
  <li>it's a script: using shell programming tools allows anyone to inspect
    the source, produce verbose debugging information, test changes quickly
    and fiddle around to adjust <em>apsfilter</em> to their system
</ul>

<p>
So you see: <em>apsfilter</em> is the best sliced bread since... uhm... no,
wait... <!-- I'm so funny -->

<h2><a name="intro_whynot">2.4 Why shouldn't I use it?</a></h2>

<p>
<ul>
  <li>it's simple: restricting the <strong>dynamic</strong> options to a
    manageable size automatically leads to driver features being inaccessible
    (however, we try to offer at least a reasonable selection, and you can
    always adjust the default options to your needs)
  <li>it's not GUI'd: beginners might be deterred by having to use the command
    line instead of a visually appealing configuration dialog (anybody willing
    to write <tt>kapsprint</tt>?)
  <li>it uses external components: you have to install at least a couple of
    other packages to get a working printing system; these may come with their
    own bugs, which could make <em>apsfilter</em> look buggy itself -- what a
    silly idea :)
  <li>it's limited: you can't make coffee with <em>apsfilter</em>, but we're
    working on it
</ul>

<h2><a name="intro_forme">2.5 Is it for me?</a></h2>

<p>
Yes, it is.

<p>
Maybe.

<h1><a name="install">3 Installation</a></h1>

<h2><a name="install_prep">3.1 Preparation</a></h2>

<p>
Since <em>apsfilter</em> is by no means a self-contained system, you'll have to
make sure you have some third-party packages installed. (The
<a href="#links">links</a> section will refer you to the web pages.)

<p>
Your printer spooler must be either the plain BSD-type <em>lpd</em> (which is
not only part of the *BSD systems, but also of many Linux distributions) or
(highly recommended) the &quot;next generation&quot; spooler called
<em>LPRng</em> (which is also compatible to the BSD version). Other spooler
types may work, but those are not officially supported by <em>apsfilter</em>.

<p>
A very important program is the shell (usually <tt>/bin/sh</tt>), which has to
support a couple of <em>POSIX</em> features. If you already have it,
<em>bash</em> is a good choice, but recent versions of <em>zsh</em>,
<em>pdksh</em> or <em>ash</em> are reported to work as well. You may need to
supply the path to a capable shell during installation.

<p>
We need <em>awk</em> in a couple of places, so a decent version should be
accessible (e.g. <em>GNU awk</em>). The <tt>configure</tt> script has an
option for this as well.

<p>
If you are not operating a PostScript capable printer, you'll need the free
PostScript interpreter <em>ghostscript</em> which has the correct driver for
your printer compiled into it. Both the <em>GNU</em> and the <em>AFPL</em>
(a.k.a. <em>Aladdin</em>) versions work, although you probably better install
the latest version to get full driver support.

<p>
The <em>psutils</em> collection is highly recommended to perform non-trivial
PostScript processing. Another tool we need is <tt>psset</tt> from the
<em>a2ps</em> package; so even if you prefer a different text-to-PostScript
converter, you'll have to install it anyway.

<p>
For any file format you want to be handled automagically, you'll need a
converter, e.g.

<ul>
  <li>for bitmap images: <tt>convert</tt> (from <em>ImageMagick</em>),
    <tt>nconvert</tt> (from <em>XnView</em>) or	the <em>netpbm</em> tools
    (a.k.a. <em>pbmplus</em>)
  <li>for text files: <tt>a2ps</tt>, <tt>mpage</tt>, <tt>enscript</tt> or
    (without fancy formatting features) <tt>recode</tt>
  <li>miscellaneous: <tt>dvips</tt>, <tt>fig2dev</tt> (from <em>transfig</em>),
    <tt>groff</tt>, <tt>htmldoc</tt>, <tt>html2ps</tt>, <tt>acroread</tt>,
    <tt>pdftops</tt>, <tt>sk2ps</tt>
</ul>

<p>
Transparent handling of compressed files is supported for the <em>gzip</em>,
<em>bzip2</em>, <em>compress</em>, <em>freeze</em>, <em>pack</em> and
<em>lzop</em> compression styles.

<p>
Error reporting and notification messages need a working <em>sendmail</em>
installation, although it is possible to do without it. However, you won't be
able to use &quot;fake duplex mode&quot;.

<p>
And most importantly: if you don't just want to use the &quot;print to
file&quot; feature, you'll need a working printer (<em>don't laugh</em>) --
<em>apsfilter</em> can't fix hardware problems. Please have a look at your
system documentation (e.g.
<a href="http://www.linuxprinting.org/howto/">Printing-HOWTO</a>, Linux
documentation of the <em>parport</em> device, man pages to <em>stty</em> and
<em>setserial</em> in case of a serial printer etc.) to ensure your printer
reacts properly on data sent directly to the interface.

<h2><a name="install_proc">3.2 Installation procedure</a></h2>

<p>
If your OS vendor is able to provide you with an <em>apsfilter</em> package of
some kind, get that and install it the usual way. Please bear in mind that
support for those packages is only available from the package maintainers.

<p>
Otherwise follow these steps:

<blockquote><pre>
$ gzip -cd <em>/path/to/</em>apsfilter-<em>X.Y.Z</em>.tar.gz | tar xf -
        (if you downloaded the gzip'ped version)
$ bzip2 -cd <em>/path/to/</em>apsfilter-<em>X.Y.Z</em>.tar.bz2 | tar xf -
        (if you downloaded the bzip'ped version)
$ cd apsfilter
$ ./configure
	(you might want to give options; see &quot;./configure --help&quot;)
$ su -
Password:
# make install
</pre></blockquote>

<p>
You can optionally copy the contributed uniprint profiles into your
<em>ghostscript</em> &quot;lib&quot; directory -- if you don't intend to
use the uniprint driver, or use a different printer, these won't help you.
Recent packages of <em>ghostscript</em> may already contain them.

<blockquote><pre>
# cp uniprint/*.upp <em>/path/to/</em>ghostscript/<em>version</em>/lib
</pre></blockquote>

<h2><a name="install_notes">3.3 System specific notes</a></h2>

<p>
Here's a list of known limitations, bugs and incompatibilities of various
UNIX systems. If you happen to know problems with these or other system types
which are not addressed here, please contact us at
<a href="mailto:apsfilter-hackers@apsfilter.org">&lt;apsfilter-hackers@apsfilter.org&gt;</a>.

<h3><a name="install_notes_suse">3.3.1 SuSE Linux</a></h3>

<p>
<em>SuSE</em> ships with a modified version of <em>apsfilter</em> which is
derived from an earlier release (of the 4.x series). These are incompatible
in installation and usage, and support for their version is only available
from <em>SuSE</em>.

<p>
However, you can uninstall the <em>SuSE</em> package and install the original
tarball without any problems. In this case, installing printers is only
possible with the <tt>SETUP</tt> script, not via <tt>yast</tt> or other
<em>SuSE</em> configuration tools.

<h3><a name="install_notes_freebsd">3.3.2 FreeBSD</a></h3>

<p>
Users of older FreeBSD systems (3.4 and earlier) need to apply
the following patch to the plain <em>BSD-lpr</em> program (<strong>not</strong>
the LPRng version) to use the advanced features of <em>apsfilter</em>:

<p>
<pre>
Index: lpr.c
===================================================================
RCS file: /home/ncvs/src/usr.sbin/lpr/lpr/lpr.c,v
retrieving revision 1.32
diff -u -r1.32 lpr.c
--- lpr.c	2000/01/19 14:25:08	1.32
+++ lpr.c	2000/04/05 09:36:01
@@ -320,7 +320,7 @@
 	seteuid(uid);
 	card('H', host);
 	card('P', person);
-	if (hdr &amp;&amp; !pp-&gt;no_header) {
+	if (hdr) {
 		if (jobname == NULL) {
 			if (argc == 0)
 				jobname = &quot;stdin&quot;;
</pre>

<p>
This patch may have already been applied to newer versions of <tt>lpr</tt>.

<h3><a name="install_notes_solaris">3.3.3 Solaris</a></h3>

<p>
Using <em>apsfilter</em> under Solaris will not work with the bundled printer
spooler system (<tt>lpadmin</tt>, <tt>lpsched</tt> et al.), so you'll have to
install <em>LPRng</em> instead.

<p>
The default Solaris shell <tt>/bin/sh</tt> is an old release of the Korn shell
which unfortunately doesn't work with <em>apsfilter</em>. Please call the
<tt>configure</tt> script with the &quot;--with-shell=...&quot; option if
a <em>POSIX</em> compliant shell can't be detected.

<p>
The same applies to <tt>awk</tt>. If a suitable version can't be found, you
can pass the path via the &quot;--with-awk=...&quot; option.

<p>
Solaris' own <tt>file</tt> command might not be able to recognize all supported
file types correctly. In case of problems, get the free implementation.

<h1><a name="setup">4 Setup</a></h1>

<p>
If you are of the paranoid kind, you might want to disable the currently
running <tt>lpd</tt> before you change your spooler setup. Please consult the
appropriate system documentation to see what steps are required to do this.

<p>
The <tt>SETUP</tt> is a shell script which resides in the top-level
<em>apsfilter</em> installation directory. To start, please execute the
script via the (absolute or relative) path name:

<blockquote><pre>
# @datadir@/apsfilter/SETUP
</pre></blockquote>

<p>
No graphics-intensive magic is needed -- a 80x25 text console should suffice
to proceed through the setup.

<p>
For listings that are likely to need more screen estate, the environment
variable <tt>$PAGER</tt> will supply the default pager program -- if it is
unset or empty, <tt>more</tt> will be used.

<h2><a name="setup_prep">4.1 Preparation</a></h2>

<p>
In the first couple of screens, various information is gathered in order to
adapt <tt>SETUP</tt> to your system environment.

<h3><a name="setup_prep_license">4.1.1 License</a></h3>

<p>
The current <em>apsfilter</em> license requires you to send a postcard to
<em>Andreas Klemm</em>. You can get his snail-mail address by sending an
e-mail to <a href="mailto:apsfilter-snailmail@apsfilter.org"
>apsfilter-snailmail@apsfilter.org</a>, which you can do directly during the
<em>SETUP</em> process, or later (e.g. if <tt>sendmail</tt> is not available).

<h3><a name="setup_prep_spool">4.1.2 Spool directory</a></h3>

<p>
The printer spooler daemon uses an additional directory (one for each printer)
to buffer the files which are about to be printed, along with various
administration data (e.g. log files). It is important that the owner, group
and permission settings of this <em>spool</em> directory match the requirements
of the spooler -- if in doubt, consult the documentation.

<p>
Do <strong>not</strong> use a directory on a shared or networked filesystem
for this purpose!

<p>
<em>LPRng</em> users can simply accept all settings, since the <tt>checkpc</tt>
program will be called later to ensure everything is correct.

<h3><a name="setup_prep_printcap">4.1.3 Printcap entries</a></h3>

<p>
Before you can do harm to your <tt>@printcap@</tt>, a backup copy will be saved
to <tt>@printcap@.old</tt> and (if it doesn't already exist) to
<tt>@printcap@.orig</tt>.

<p>
If you want to overwrite the previous entries in <tt>@printcap@</tt>,
<tt>SETUP</tt> will delete all <em>apsfilter</em>-related items, but won't
touch anything else. It is not (yet) possible to overwrite just one entry.

<p>
Normally you'd want to choose to add another printer, so this is also the
default.

<h2><a name="setup_main">4.2 Main menu</a></h2>

The main menu is the central screen during the setup -- here you can see the
current settings (in square brackets), adjust them, install printers, print
test pages etc. Enter one of the keys displayed in parentheses to change
certain values or perform actions.

<h3><a name="setup_main_avail">4.2.1 Available drivers</a></h3>

<p>
Any printer driver (with the single exception of a true PostScript printer)
needs to be included in the <em>ghostscript</em> binary <tt>gs</tt> in order to
be usable. Some drivers are part of the <em>ghostscript</em> distribution, but
are not compiled into <tt>gs</tt> by default, while others produce raster
images (e.g. JPEG, TIFF, PNG, PNM) which are not suitable for direct printer
input. You can also use a number of third-party drivers.

<p>
To see which drivers are known to <tt>gs</tt>, and also which version you are
using, enter <tt>d</tt> at the prompt. The list is alphabetically sorted.

<h3><a name="setup_main_gsdoc">4.2.2 Ghostscript documentation</a></h3>

<p>
In case you haven't already read the <em>ghostscript</em> documentation, a
text-only rendering of <tt>Devices.htm</tt> suitable for your <tt>gs</tt>
release can be viewed. Select <tt>r</tt> to read it.

<h3><a name="setup_main_driver">4.2.3 Driver selection</a></h3>

<p>
This is the most important part of <tt>SETUP</tt>, since the correct driver is
the key component to ensure smooth interaction of <em>apsfilter</em> and your
printer. Choosing a driver which is not supported by <tt>gs</tt> will be
intercepted by <tt>SETUP</tt>.

<p>
Usually, you will be presented a list of printer models, preceded by a number.
Just enter this number at the prompt, or <tt>0</tt> to select a different type
of driver, or just press <tt>RETURN</tt> to see the list again.

<p>
If you see a comment in the list of the form <tt>{foo+bar}</tt> it means that
the <em>ghostscript</em> driver named <em>foo</em> is used to create an
intermediate data stream which the external tool <em>bar</em> converts into
a format suitable for the printer.

<h4>4.2.3.1 PostScript printer (generic)</h4>

<p>
This is the only &quot;driver&quot; that will actually bypass
<em>ghostscript</em>, so we assume the printer is able to understand
<strong>PostScript Level 2</strong> (which is what most applications and
converters produce).

<p>
This kind of queue is also useful if you want to post-process the output from
<em>apsfilter</em> with a third-party printer driver. These packages usually
expect PostScript files to arrive at their own printer filter, so that they can
call <tt>gs</tt> and/or their driver.

<h4>4.2.3.2 PostScript printer (with ghostscript drivers)</h4>

<p>
This is similar to the &quot;generic&quot; driver, but the input will be passed
through <em>ghostscript</em>'s special &quot;pswrite&quot;, &quot;psgray&quot;
or &quot;psmono&quot; devices. This allows you to set options for <tt>gs</tt>,
use disk based fonts etc.

<h4>4.2.3.3 printer driver natively supported by ghostscript</h4>

<p>
Here you can see a list of drivers that are part of the original
<em>ghostscript</em> package (matching the version on your system).

<p>
<strong>Note</strong>: Not all drivers are compiled into <tt>gs</tt> by
default; you might have to adjust the <em>ghostscript</em> <tt>Makefile</tt> to
get full support for all drivers, then re-compile.

<h4>4.2.3.4 gimp-print (stp or ijs driver)</h4>

<p>
This high-quality driver supports many inkjet printers and is especially
targeted at photo printers.

<p>
You have two choices for <em>gimp-print</em>: the classic <em>ghostscript</em>
interface via the &quot;stp&quot; driver or the client for the new
&quot;ijs&quot;</em> server within <em>ghostscript</em>. The features are the
same for these two, but the interfaces need different parameters internally.

<h4>4.2.3.5 hpdj</h4>

<p>
As the name might give away, this driver mostly supports DeskJet printers by
HP. You might succeed to operate compatible printers as well.

<p>
This driver has been superseded by <em>pcl3</em>, written by the same author.

<h4>4.2.3.6 pcl3 (successor to hpdj)</h4>

<p>
Since the <em>hpdj</em> driver has been discontinued, you should try its
successor. The <em>pcl3</em> driver knows a wider range of HP models, and other
PCL-aware printers may also work.

<h4>4.2.3.7 IBM Omni</h4>

<p>
This driver collection emerged from the <em>OS/2</em> driver support and covers
a very wide range of inkjet and dot matrix printers.

<h4>4.2.3.8 various HP Deskjet drivers</h4>

<p>
A collection of drivers for a number of HP printers.

<h4>4.2.3.9 PPA printer</h4>

<p>
<em>PPA</em> is a closed source printing protocol used under <em>some
other</em> operating system. It had to be reverse-engineered to provide
support for these HP printers. You'll need <tt>pnm2ppa</tt> to automatically
convert the data stream into a usable format for them.

<h4>4.2.3.10 HP DeskJet printer (official drivers)</h4>

<p>
These drivers, based on the &quot;Inkjet Server&quot; technology, are already
part of the latest <em>ghostscript</em> releases, but can be built into older
versions manually.

<p>
There's one list for the older <em>ghostscript</em> interface
(&quot;hpijs&quot;, version 0.97 and earlier) and one for its successor
(&quot;ijs&quot;, version 1.0 and later).

<h4>4.2.3.11 Epson printer (official drivers)</h4>

<p>
The Epson laser printer drivers are available as an add-on to
<em>ghostscript</em>, while the <em>pips</em> driver collection consists of
tools that convert PNG data into the printer language.

<h4>4.2.3.12 Lexmark inkjet printer</h4>

<p>
Some programmers (<strong>not</strong> at Lexmark, of course) have created
drivers for Lexmark inkjets.

<h4>4.2.3.13 miscellaneous other drivers</h4>

<p>
Those drivers which don't really fit into the other categories are assembled
in this list.

<h4>4.2.3.14 non-printer devices</h4>

<p>
<strong>Caution!</strong> These devices do not produce data which is suitable
for any printer (unless you have a <em>really</em> special kind). They are
only useful in a printer queue which is exclusively used by &quot;printing to
file&quot; (<tt>aps2file</tt>), since the output file will be either PDF or an
image format.

<p>
If you want to use one of these drivers, it's <strong>highly</strong>
recommended that you install the queue as a normal local printer (with a
parallel interface connection), but set the device node to <tt>/dev/null</tt>
to avoid unpleasant surprises if some user accidentally wants to print to this
queue in the usual way. Note that using <tt>/dev/null</tt> has no impact on the
functionality of <tt>aps2file</tt>.

<p>
Another way of restricting the use of the printer queue is to disable it on
the spooler level -- <tt>aps2file</tt> bypasses the spooler mechanism and only
needs access to the configuration files. In this case the user will get an
error message for any print attempt to that queue. However, it's necessary to
make sure that the queue is not re-enabled (e.g. at system reboot).

<h3><a name="setup_main_interface">4.2.4 Interface</a></h3>

<p>
The physical connection to the printer can either be local (via the parallel,
USB or serial cable) or through the network. In the latter case, you can choose
between normal UNIX-style connections (<em>lpd</em> on the remote host),
SAMBA to talk to Windows-served printers (<em>SMB</em> protocol), AppleTalk
for Mac-based printers (via <em>netatalk/pap</em>) or Novell NetWare printer
servers (with <em>ncprint</em> or <em>nprint</em>).

<h4>4.2.4.1 Parallel or USB connection</h4>

<p>
You only need to enter the full path to the device node -- that's it.

<h4>4.2.4.2 Serial connection</h4>

<p>
Besides the device node name, we also need a couple of protocol specifications
here: baud rate, handshaking (flow control) and the data word format.

<h4>4.2.4.3 Unix network printer</h4>

<p>
The remote printer name (FQDN or IP address) and the remote queue name are
needed for <tt>lpd</tt>-type network printers, including printer servers
built into (or attached to) the printer itself.

<p>
Users of JetDirect interface cards must use &quot;raw&quot; as the queue name;
other queues (such as &quot;text&quot; or &quot;ascii&quot;) are not useful.

<h4>4.2.4.4 Windows / Samba</h4>

<p>
Your Windows administrator should be able to provide you with the various
SMB/samba settings. If you choose to use a real user name (plus password),
the configuration file will not be world-readable (to protect the innocent).

<h4>4.2.4.5 AppleTalk</h4>

<p>
This connection only requires the name of the printer as provided by the
Apple server.

<h4>4.2.4.6 Novell NetWare</h4>

<p>
Contact your local NetWare guru to get the correct connection parameters for
the server, queue and user name. If you don't need a password, just leave it
empty.

<p>
<strong>Note:</strong> Both <tt>ncprint</tt> (for BSD) and <tt>nprint</tt>
(for Linux) are supported for NetWare connections.

<h3><a name="setup_main_paper">4.2.5 Paper format</a></h3>

The default paper size can be overridden by the user on the command line, but
you definitely should set it to the paper format which is most likely to be
used. There are far more paper formats known to mankind, but <em>A4</em>,
<em>A3</em>, <em>Letter</em>, <em>Legal</em>, <em>Tabloid</em> and
<em>Ledger</em> are the ones that are supported by the majority of conversion
tools used by <em>apsfilter</em>.

<p>
<strong>Note</strong>: There seems to be quite some confusion about the correct
handling of &quot;ledger&quot; vs. &quot;tabloid&quot; vs. &quot;11x17&quot;.
The most common usage seems to be that <em>ledger</em> is 17''x11'' and
<em>tabloid</em> is 11''x17'' (some tools, including <em>ghostscript</em>, even
call it <em>11x17</em>). So we use <em>ledger</em> as the landscape mode of
<em>tabloid</em> (and vice versa).

<h3><a name="setup_main_quality">4.2.6 Printing quality</a></h3>

<p>
This is another setting which merely provides a default value for the user;
a different printing quality can be passed on the command line. However,
&quot;medium&quot; should be suitable for most printing tasks.

<p>
Please bear in mind that those categories don't represent absolute values --
they are driver specific, and relative to its abilities. So &quot;photo&quot;
quality on a cheap dot matrix printer might still be worse than
&quot;draft&quot; on a high-class laser printer.

<h3><a name="setup_main_color">4.2.7 Color mode</a></h3>

<p>
Selecting the correct color mode does not only influence the dithering of
color in the output, but has also an impact on the processing speed: many
converters run faster if they are told to produce monochrome or grayscale
output.

<p>
Since this default setting can also be overridden by the user, it's probably
best to set it to &quot;full color&quot;, just to be sure. Only if your printer
has no color ability, it makes sense to use &quot;gray&quot; or
&quot;mono&quot;.

<h3><a name="setup_main_resol">4.2.8 Resolution</a></h3>

<p>
The printing resolution (in <em>dots per inch</em>) is only needed to provide
a default for drivers that don't derive it from the <em>quality</em> setting.
Currently this includes PostScript printers (with or without the use of
<em>ghostscript</em>) and <em>uniprint</em> profiles, besides others.

<p>
However, it is recommended to set it to a reasonable value anyway, since this
setting will also appear (as a comment) in the <tt>@printcap@</tt> database and
in listings produced by <tt>lpq</tt>.

<h3><a name="setup_main_method">4.2.9 Printing method</a></h3>

<p>
For most cases, the <em>printing method</em> will be set to the default value
&quot;auto&quot;; this will cause <em>apsfilter</em> to check the type of any
input file and convert it to the correct printer language automagically.

<p>
However, if you want data to be passed unmodified (e.g. if you get printing
requests over the network), you must set it to &quot;raw&quot;; you can also
set it to &quot;ascii&quot; to trick <em>apsfilter</em> into thinking that
everything is a text file.

<p>
The default printing method can be overwritten with a command line option.

<h3><a name="setup_main_test">4.2.10 Test page</a></h3>

<p>
To test the current settings, you can send a test page to the printer. This
will <strong>not</strong> use the <tt>lpd</tt> mechanism, but rather contact
the printer directly (unless you print to a UNIX-style network printer).

<p>
If your current driver selection requires an additional external filter to be
used (e.g. <tt>pnm2ppa</tt>), it must be accessible in the <tt>PATH</tt>.
In case of an error, please install the appropriate filter program or adjust
the <tt>PATH</tt> setting at the top of the <tt>SETUP</tt> script.

<p>
<strong>Note:</strong> You need to set up your printer type, interface and
paper size to be able to print a test page.

<h3><a name="setup_main_perflog">4.2.11 Performance log</a></h3>

<p>
After you have printed at least one test page, you can check how long it took
to (a) create and (b) actually print the data. Thus you can adjust the default
quality and color settings to decent values, and even use a different driver.

<p>
<strong>Note:</strong> You need to set up your printer type, interface and
paper size to be able to print a test page and view the performance log.

<h3><a name="setup_main_abort">4.2.12 Abort</a></h3>

<p>
In case of a panic attack, just leave <tt>SETUP</tt> with no further changes to
your system. This is basically the same as pressing <tt>Ctrl-c</tt>.

<h3><a name="setup_main_install">4.2.13 Installation</a></h3>

<p>
If you think all settings are correct, you can install the printer; this will
create an entry in <tt>@printcap@</tt>, add the spool directories and put one
or more configuration files into the queue configuration directory.

<p>
But first you are prompted for a queue name; this will be used to select the
correct printer queue, if you happen to have more than one. The default name
is <tt>lp</tt> (if possible) or <tt>apsN</tt> (where <tt>N</tt> is a number).
This is guaranteed to be free to use.

<p>
If you are using the <em>LPRng</em> spooler, a system cleanup will be performed
by calling <tt>checkpc</tt>, which will ensure that all permissions are correct
and all necessary files are in place.

<p>
<strong>Note:</strong> You need to set up your printer type, interface and
paper size to be able to install the printer entry.

<h3><a name="setup_main_finish">4.2.14 Finish setup</a></h3>

<p>
After your printers are installed, all parameter settings from <tt>SETUP</tt>
are saved to <tt>@sysconfdir@/apsfilter/SETUP.cfg</tt>; these will be re-read
the next time you want to install a printer.

<p><a name="setup_item_restart"></a>
At this point <tt>@printcap@</tt> has changed, so you have to tell your spooler
daemon to use the new values. Please use the command corresponding to your
spooler type:

<dl>
  <dt>LPRng
    <dd><tt>lpc reread</tt>
  <dt>BSD-lpd
    <dd><tt>lpc restart all</tt>
  <dt>others
    <dd><tt>/etc/rc.d/init.d/lpd restart</tt><br>
      (adjust this to your OS)
</dl>

<h2><a name="setup_tips">4.3 Tips and tricks</a></h2>

<p>
There's only little magic attached to the printer driver name. If you need some
other driver which isn't listed, simply install a different driver and change
the setting in <tt>@sysconfdir@/apsfilter/QUEUE/apsfilterrc</tt> manually.
However, it is necessary to provide a driver script if you want to use advanced
features of your driver.

<p>
The <em>stcolor</em> driver is the only one that causes <tt>SETUP</tt> to write
an additional configuration variable into the local file:
<blockquote><pre>
PS_INIT='stcolor.ps'
</pre></blockquote>
This setting won't be used for all other drivers (although it is harmless in
those cases).

<p>
<tt>SETUP</tt> creates a comment for all entries in <tt>@printcap@</tt> which
will be displayed by <tt>lpq</tt>. It shows the default settings for quality,
resolution etc., but you can change it to whatever fits you. For non-printer
devices, it might be useful to explicitly state that the printer queue is
primarily targeted at &quot;print-to-file&quot; mode.

<h1><a name="usage">5 Usage</a></h1>

<h2><a name="usage_normal">5.1 Normal operation</a></h2>

<p>
As every input filter for printer spoolers, <em>apsfilter</em> is not really
designed to be called directly on the command line, but it rather links itself
into the <em>lpd</em> mechanism for print job processing via the
<tt>@printcap@</tt> database. For every print job, the printer daemon
prepares the data, gathers some additional information and calls the filter
with a couple of parameters. Then <em>apsfilter</em> processes the input data
stream according to the configuration settings and basically spews the printer
data out (but there's lots of magic in between).

<p>
So the user doesn't actually get in touch with <em>apsfilter</em>, but rather
tells the printer daemon via <tt>lpr</tt> (or sometimes via <tt>lp</tt>) that
he wants to print something. To influence the visual appearance or printer
dependent processing features, there must be a way to pass parameters to
<em>apsfilter</em>: either via configuration files or on the command line.

<p>
Passing command line options depends on the spooler type which is installed on
the system:

<ul>
  <li>BSD-type spoolers don't provide a direct interface for additional filter
    options, so the so-called &quot;class&quot; attribute for print jobs had to
    be misused for this purpose:
<blockquote><pre>
lpr -C border:duplex:4pps somefile.txt
</pre></blockquote>
    This has lead to the term &quot;class options&quot;, although it's not very
    accurate, since the <em>class</em> attribute is actually used for priority
    matters.

  <li>LPRng is compatible to the BSD variants, so &quot;-C&quot; can be used as
    well; however, the use of the correct option &quot;-Z&quot; is preferred:
<blockquote><pre>
foobar | lpr -Z noheader,enscript,letter
</pre></blockquote>

  <li>LPRng also provides an interface called <tt>lp</tt> which resembles the
    SysV print tool; this one uses &quot;-o&quot; for options:
<blockquote><pre>
lp -o recode -o ascii source.ps
</pre></blockquote>
</ul>

<p>
<em>Apsfilter</em> options can be separated by &quot;:&quot; or &quot;,&quot;;
<em>LPRng</em> can also take more than one &quot;-Z&quot; or &quot;-o&quot;
block (and will effectively concatenate them). See below for a listing of
known <a href="#config_options">command line options</a> for
<em>apsfilter</em>.

<h2><a name="usage_special">5.2 Special features</a></h2>

<p>
A couple of features that are not very common, but provide some comfort to the 
user, are available with <em>apsfilter</em>.

<h3><a name="usage_special_duplex">5.2.1 Fake duplex</a></h3>

<p>
If your printer is not able to handle duplex printing by itself (most inkjets
can't do it), <em>apsfilter</em> can &quot;fake&quot; it for you. When you use
the command line option &quot;duplex&quot;, your file will be printed this way:

<ol>
  <li>all necessary pre-processing, conversion etc. will be performed as usual
  <li>the even pages of the resulting PostScript code are extracted and printed
    (a blank page is inserted if needed)
  <li><em>apsfilter</em> sends you an email which tells you to flip the sheets
    and put them back in
  <li>you also get some more-or-less secret key (&quot;password&quot;) with the
    email which you should echo into an internal communication file (a
    &quot;named pipe&quot; for the experts) when the paper and the printer is
    ready
  <li>the odd pages are printed on the backsides of the even pages
</ol>

<p>
The <tt>DUPLEX_ODD_FIRST</tt> variable can be set so that the odd pages are
printed first. There are also two variables called <tt>DUPLEX_REVERSE_EVEN</tt>
and <tt>DUPLEX_REVERSE_ODD</tt> which can be used to have those pages printed
in reverse order. (Read the <a href="#config_notes_duplex">notes</a> for
details.)

<p>
<strong>Please note</strong>:

<ul>
  <li>fake duplex printing does not work if you directly print to a network
    printer server, since the named pipe must be on the same host as the user
    who started the print job; but you can set up your printer spooler so that
    all pre-processing is done on the local host and the resulting printer data
    is sent via the network
  <li>after the even pages are printed, <em>apsfilter</em> waits for the
    password, thus effectively blocking the printer spooler; however, print
    jobs of other users should not be delayed longer than necessary, so please
    don't be nasty
  <li><tt>sendmail</tt> must be present for notification delivery (you can also
    create a wrapper script which translates the options for your mailer
    application)
</ul>

<p>
Duplex printing (real or fake) can be disabled by setting the
<tt>DISABLE_DUPLEX</tt> variable to a non-empty value.

<h3><a name="usage_special_copies">5.2.2 Fast copies</a></h3>

<p>
Almost all printer spoolers offer the possibility to print multiple copies of
a document without having to enter the print command multiple times. However,
from <em>apsfilter</em>'s point of view, there is no difference -- it simply
gets the same request over and over again.

<p>
With the &quot;copies=<em>N</em>&quot; option you can print <em>N</em> copies
of the same document, but much faster (or rather: much less CPU-intensive).
Instead of performing all the pre-processing and rendering stages again for
each request, <em>apsfilter</em> does the hard work once, then prints the
resulting &quot;raw&quot; printer data <em>N</em> times. (This also works with
the fake duplex mode.)

<p>
In case your printer already knows how to handle multiple copies, the driver
can be adjusted in the driver script to use that feature. You should set
<tt>HARDWARE_COPIES</tt> to a non-empty value to enable this behaviour.

<p>
If this conflicts with other services on your system (e.g. accounting), you
can disable it by setting <tt>MAXCOPIES=1</tt> in one of the configuration
files.

<h2><a name="usage_file">5.3 Printing to a file</a></h2>

<p>
Besides feeding data to the printer via the spooler, sometimes it might also be
necessary or desired to direct <em>apsfilter</em>'s output to a file.

<p>
This is not possible by directly calling <em>apsfilter</em> on the command
line, since it makes some presumptions about its parameters and environment.
But there is a script called <tt>aps2file</tt> which sets up the environment
so that <em>apsfilter</em> thinks it's running under <em>LPRng</em>.

<p>
Enter <tt>aps2file -h</tt> on the command line to see what options are
available. You'll mostly need &quot;-P&quot; to specify the printer queue
and &quot;-Z&quot; for parameters. If you want to debug <em>apsfilter</em>,
the &quot;-D&quot; option creates a log on <em>stderr</em>.

<p>
Using <tt>aps2file</tt> has the additional advantage to enable user supplied
configuration files, since we don't have to care about security issues here.

<p>
<strong>Note</strong>: The output will <em>always</em> be directed to a file,
even if you configured the queue to use the network.

<h2><a name="usage_preview">5.4 Preview before printing</a></h2>

<p>
If you are of the paranoid kind, you might want to preview the output before
it's sent to your printer. Now this is easily possible with <em>apsfilter</em>.

<p>
The script <tt>apspreview</tt> internally creates a PostScript file with the
help of <tt>aps2file</tt> and sends it to your PostScript viewer program
(<tt>gv</tt>, <tt>kghostview</tt> or <tt>ghostview</tt>). If you are satisfied
with the result, you can simply print that file from the viewer (or even
specific pages, if your application supports it).

<p>
To control the output, <tt>apspreview</tt> accepts basically the same options
as <tt>aps2file</tt>; entering <tt>apspreview -h</tt> will give you a short
overview.

<p>
<strong>Note</strong>: Command line options related to duplex printing
(<em>duplex</em>, <em>simplex</em>, <em>shortbind</em>, <em>longbind</em>)
should be used when actually printing the file -- they don't make sense for
previewing. Also be careful if you convert the stuff with &quot;multiple pages
per sheet&quot; as a default option -- while printing it must not be done
again, so use the &quot;1pps&quot; option there.

<h1><a name="config">6 Configuration</a></h1>

<p>
Configuring <em>apsfilter</em> can be done in two separate ways: either the
administrator supplies specific values to configuration variables, or the user
provides options to the <tt>lpr</tt> or <tt>lp</tt> program. Command line
options usually have greater priority, unless some service has been disabled
entirely (e.g. duplex printing).

<h2><a name="config_files">6.1 Configuration files</a></h2>

<p>
The following configuration files are listed in the same order as they are
used by <em>apsfilter</em>; these are all ordinary shell scripts.

<p>
A <em>global</em> configuration file resides in the global directory
<tt>@sysconfdir@/apsfilter/</tt>, while a <em>local</em> file is located in
the printer queue specific directory <tt>@sysconfdir@/apsfilter/QUEUE/</tt>.

<p>
<ol>
  <li><tt>@sysconfdir@/apsfilter/apsfilterrc</tt>
  <li><tt>@sysconfdir@/apsfilter/QUEUE/apsfilterrc</tt> (mandatory)
  <li><tt>~/.apsfilter/apsfilterrc.QUEUE</tt> (disabled by default due to
    security issues)
  <li><tt>@sysconfdir@/apsfilter/QUEUE/apsfilterrc.USER</tt>
  <li><tt>@sysconfdir@/apsfilter/restrictions</tt>
  <li><tt>@sysconfdir@/apsfilter/QUEUE/restrictions</tt>
  <li><tt>@sysconfdir@/apsfilter/QUEUE/smbclient.conf</tt>
  <li><tt>@sysconfdir@/apsfilter/QUEUE/netware.conf</tt>
  <li><tt>@sysconfdir@/apsfilter/QUEUE/lpr.conf</tt>
  <li><tt>@sysconfdir@/apsfilter/QUEUE/pap.conf</tt>
</ol>

<h3><a name="config_files_rc1">6.1.1 <tt>apsfilterrc</tt> (global, local)</h3></a>

<p>
These two are the most important source of information for <em>apsfilter</em>,
since they define the basic options.

<p>
Typical settings you want to change in the global file include:

<table border=1>
  <tr><td><tt>PATH</tt>
      <td>shell search path; should be as restrictive as possible
  <tr><td><tt>AWK</tt>
      <td>properly working &quot;awk&quot; executable (e.g. <em>GNU awk</em>)
  <tr><td><tt>NOTIFY</tt>
      <td>user name of the person in charge for printer errors
  <tr><td><tt>TMPDIR</tt>
      <td>directory for temporary files; <em>apsfilter</em> actually creates a
          subdirectory of its own for better security
  <tr><td><tt>USE_USER_CODE</tt>
      <td>if set, enables the user specific file
          <tt>$HOME/.apsfilter/apsfilterrc.QUEUE</tt> as a configuration source
	  <br><strong>DANGEROUS!</strong> -- you probably don't want to set it
	  (it is unset by default)
  <tr><td><tt>TEXINPUTS</tt>
      <td>search path for <em>dvips</em> (PostScript pictures etc.)
  <tr><td><tt>HAVE_MAKETEXPK</tt>
      <td>if set, enables <em>dvips</em> to create fonts on the fly (this
          functionality is broken on more systems than you would imagine)
  <tr><td><tt>DVIPS_RES_DorP</tt>
      <td><em>dvips</em> resolution switch; should be &quot;-D&quot; or
          &quot;-P&quot; (consult your <em>dvips</em> man page)
  <tr><td><tt>GS_FONTPATH</tt><br><tt>GS_LIB</tt>
      <td>environment variables for <tt>gs</tt>, used to find fonts and support
          PostScript files (the <em>ghostscript</em> documentation has more
	  information on this)
  <tr><td><tt>IGNORE_LPD_RAW</tt>
      <td>set this if your print jobs (most likely from remote machines) are
          sent in &quot;raw&quot; mode, causing them to be passed through
	  <em>apsfilter</em> with no filtering whatsoever
  <tr><td><tt>MAXCOPIES</tt>
      <td>maximum numbers of copies created with <em>apsfilter</em>'s internal
          copying mechanism
  <tr><td><tt>ASCII_FILTER</tt>
      <td>filter to convert text files to PostScript (one of &quot;a2ps&quot;,
          &quot;mpage&quot;, &quot;enscript&quot;), or to directly print text
	  files with possible charset and end-of-line conversion
	  (&quot;recode&quot;)
  <tr><td><tt>ASCII_HEADER</tt>
      <td>set this if you want header lines in the formatted text output (no
          effect with &quot;recode&quot;)
  <tr><td><tt>ASCII_BORDER</tt>
      <td>set this if you want borders in the formatted text output (no effect
          with &quot;recode&quot;)
  <tr><td><tt>PS_NUP</tt>
      <td>multiple pages per sheet (must be one of 1, 2, 4, 8)
  <tr><td><tt>ASCII_PPS</tt>
      <td>the same, but just for text (no effect with &quot;recode&quot;)
  <tr><td><tt>LANDSCAPE</tt>
      <td>set this if you want landscape orientation
  <tr><td><tt>ASCII_LANDSCAPE</tt>
      <td>the same, but just for text (no effect with &quot;recode&quot;)
  <tr><td><tt>PS_BOOK<tt>
      <td>if set: output pages in &quot;book&quot; format (i.e. 2pps, duplex,
          special printing order)
  <tr><td><tt>PS_UTILS</tt>
      <td>additional PostScript->PostScript filter
</table>

<p>
Unlike others, the <em>local</em> configuration file (which overrides any
global options) is required by <em>apsfilter</em> and thus is created during
<tt>SETUP</tt>. Initial values (which should not be deleted) are given for
these variables:

<table border=1>
  <tr><td><tt>PRINTER</tt>
      <td>specifies the driver (and for some drivers the printer model as well)
  <tr><td><tt>PAPERSIZE</tt>
      <td>the paper size used for practically every program that needs to
          handle PostScript code; currently possible values are &quot;a4&quot;,
	  &quot;a3&quot;, &quot;letter&quot;, &quot;legal&quot;,
	  &quot;tabloid&quot; and &quot;ledger&quot;
  <tr><td><tt>METHOD</tt>
      <td>either &quot;auto&quot; (automatic file conversion),
          &quot;ascii&quot; (treat everything as text) or &quot;raw&quot;
	  (pass-through mode)
  <tr><td><tt>QUALITY</tt>
      <td>the printing quality (one of &quot;draft&quot;, &quot;low&quot;,
          &quot;medium&quot;, &quot;high&quot;, &quot;photo&quot;); the driver
	  script will translate this into a decent resolution value
  <tr><td><tt>COLOR</tt>
      <td>control color or b/w printing, should be &quot;color&quot;,
          &quot;gray&quot; or &quot;mono&quot; (may not work with all
	  printer/driver combinations)
  <tr><td><tt>RESOLUTION</tt>
      <td>the printing resolution default (will most likely be overwritten by
          the <tt>QUALITY</tt> setting)
</table>

<p>
Parameters that are usually only valid for one printer should also go into the
local file:

<table border=1>
  <tr><td><tt>MEDIA</tt>
      <td>paper type; one of &quot;plain&quot; (normal paper; default),
          &quot;coated&quot; (inkjet quality), &quot;glossy&quot; (photo
	  quality paper), &quot;premium&quot; (very high quality) and
	  &quot;trans&quot; (transparencies)
  <tr><td><tt>SWEEP</tt>
      <td>whether printing should be unidirectional (&quot;uni&quot;) or
          bidirectional (&quot;bi&quot;)
  <tr><td><tt>PRINT_DVI</tt>
      <td>custom &quot;DVI to printer language&quot; filter (stdin->stdout);
          if empty, <em>dvips</em> (with possible rendering by
	  <em>ghostscript</em>) will be used
  <tr><td><tt>RAW_PROLOGUE</tt><br><tt>RAW_EPILOGUE</tt>
      <td><em>printf</em> style escape sequences to be used before/after a
          &quot;raw&quot; print job
  <tr><td><tt>RECODE_PROLOGUE</tt><br><tt>RECODE_EPILOGUE</tt>
      <td><em>printf</em> style escape sequences to be used before/after
          text printed with <em>recode</em>
  <tr><td><tt>BLANK_PAGE</tt>
      <td>printer codes to be sent if a single blank page is needed (for
          &quot;fake duplex&quot; mode)
  <tr><td><tt>GS_FEATURES</tt>
      <td>basic features for <em>ghostscript</em>; this variable can be
          extended with command line options
  <tr><td><tt>PS_INIT</tt>
      <td><em>ghostscript</em> initialisation file
  <tr><td><tt>PS_EXIT</tt>
      <td><em>ghostscript</em> &quot;cleanup&quot; file
  <tr><td><tt>POST_FILTER_OPTS</tt>
      <td>basic features for the (optional) post-<em>ghostscript</em> filter
          <tt>POST_FILTER</tt> (which itself should only be set in the driver
          script)
  <tr><td><tt>HARDWARE_COPIES</tt>
      <td>set this if your printer <strong>and</strong> the driver can handle
          multiple copies by themselves (otherwise the copies will be sent
	  manually)
  <tr><td><tt>REMOTE_COPIES</tt>
      <td>set this if multiple copies should be done at the remote printer
          server rather than locally (enabled by default; used by <em>lpd</em>
	  and <em>NetWare</em> connections)
  <tr><td><tt>HARDWARE_DUPLEX</tt>
      <td>set this if your printer <strong>and</strong> the driver can handle
          duplex printing by themselves (otherwise it can be &quot;faked&quot;)
  <tr><td><tt>DISABLE_DUPLEX</tt>
      <td>set this to completely forbid duplex printing; must be set on a
          network print server that operates printers which would need
	  &quot;fake&quot; duplexing
  <tr><td><tt>DUPLEX_REVERSE_EVEN</tt><br><tt>DUPLEX_REVERSE_ODD</tt><br>
          <tt>DUPLEX_ODD_FIRST</tt>
      <td>these control the page order for &quot;fake duplex&quot; printing;
          read the <a href="#config_notes_duplex">notes</a> for details
  <tr><td><tt>DUPLEX</tt>
      <td>set this if you always want duplex prints
  <tr><td><tt>BINDING</tt>
      <td>which edge of the paper the binding should be (one of
          &quot;short&quot;, &quot;long&quot;)
  <tr><td><tt>PAPERTRAY</tt>
      <td>integer value to select the correct paper feed tray
  <tr><td><tt>A2PS_BASIC</tt>
      <td>basic features for <em>a2ps</em>
  <tr><td><tt>A2PS_PAPERSIZE</tt>
      <td>override the paper size for use with <em>a2ps</em>
  <tr><td><tt>A2PS_OPTS</tt>
      <td>override the complete <em>a2ps</em> command line
  <tr><td><tt>MPAGE_BASIC</tt><br>
          <tt>MPAGE_PAPERSIZE</tt><br>
	  <tt>MPAGE_OPTS</tt>
      <td>the same for <em>mpage</em>
  <tr><td><tt>ENSCRIPT_BASIC</tt><br>
          <tt>ENSCRIPT_PAPERSIZE</tt><br>
	  <tt>ENSCRIPT_OPTS</tt>
      <td>the same for <em>enscript</em>
  <tr><td><tt>PRETTY_PRINTING</tt>
      <td>highlight level used for pretty-printing (0=none, 1=normal, 2=heavy)
  <tr><td><tt>RECODE_OPTS</tt>
      <td>override the complete <em>recode</em> command line
  <tr><td><tt>HTMLDOC_OPTS</tt>
      <td>override the complete <em>htmldoc</em> command line
  <tr><td><tt>HTML2PS_OPTS</tt>
      <td>override the complete <em>html2ps</em> command line
</table>

<p>
The template <tt>apsfilterrc</tt> file is the definite source for these
configuration possibilities, and shows the default value as well.

<h3><a name="config_files_rc2">6.1.2 <tt>apsfilterrc</tt> (user specific)</h3></a>

<p>
These are two files that should be considered relics of the times when there
were no command line options to <em>apsfilter</em> and printing to a file via
a locally installed <em>apsfilter</em> was impossible.

<p>
The user can provide arbitrary settings in a file in his home directory,
specifically <tt>~/.apsfilter/apsfilterrc.QUEUE</tt> for the printer named
<tt>QUEUE</tt>. However, since <em>apsfilter</em> might run under a privileged
account (e.g. <em>daemon</em> or even <em>root</em>), this is considered
harmful (far worse than a <tt>goto</tt> statement) and needs to be activated
by the administrator by explicitly setting <tt>USE_USER_CODE</tt>. You don't
want to do that.

<p>
A secure, but less flexible way to have users supply their favourite options
is the file <tt>@sysconfdir@/apsfilter/QUEUE/apsfilterrc.USER</tt> which is
read when user <tt>USER</tt> prints on <tt>QUEUE</tt>. The downside is that the
admin is supposed to change the file according to the user's wishes, which is
probably not useful in practice. Do <strong>not</strong> let users edit their
files -- this would open the same security hole as mentioned above.

<p>
However, if you use <em>apsfilter</em> via the <tt>aps2file</tt> or
<tt>apspreview</tt> scripts, user-supplied configuration files are always used,
since they can't do any harm to the system in this case (<em>apsfilter</em>
will not run under a privileged account).

<h3><a name="config_files_restr">6.1.3 <tt>restrictions</tt> (global, local)</h3></a>

<p>
If the administrator wants to restrict certain options for all printer queues
and/or for just a single queue, the global and local <tt>restrictions</tt>
scripts will enable him to do that.

<p>
For example, if only <em>a2ps</em> and <em>recode</em> are installed, but
<em>mpage</em> and <em>enscript</em> are missing, a simple line like
<blockquote><pre>
[ &quot;$ASCII_FILTER&quot; = recode ] || ASCII_FILTER=a2ps
</pre></blockquote>
will ensure text files are printed via <em>a2ps</em>, unless <em>recode</em>
has been requested. This way users won't be annoyed by an error mail if they
accidentally chose &quot;mpage&quot; or &quot;enscript&quot;.

<p>
If you just want to set certain options if <em>apsfilter</em> is called via
<tt>aps2file</tt>, you can test <tt>APS2FILE_CONTEXT</tt> for a non-empty
value; e.g.
<blockquote><pre>
if [ &quot;$APS2FILE_CONTEXT&quot; ]; then
    unset DUPLEX; COPIES=1
fi
</pre></blockquote>

<p>
Let's say your PostScript printer knows duplex, but fscks up the paper
orientation -- it's tumbled where it shouldn't have been, and vice versa.
The solution is to simply switch the <tt>BINDING</tt> values:
<blockquote><pre>
if [ &quot;$BINDING&quot; = short ]; then
    BINDING=long
else
    BINDING=short
fi
</pre></blockquote>

<p>
Here's an example which sets some attributes, e.g. for the <em>stp</em> driver:
low-quality printing modes should use less ink.
<blockquote><pre>
case &quot;$QUALITY&quot; in
    draft)  GS_FEATURES=&quot;$GS_FEATURES -dDensity=0.5&quot; ;;
    low)    GS_FEATURES=&quot;$GS_FEATURES -dDensity=0.8&quot; ;;
esac
</pre></blockquote>

<p>
Or maybe you want to ensure the pages-per-sheet and paper orientation values
are in sync for printing text files:
<blockquote><pre>
case &quot;$ASCII_PPS&quot; in
    1|4)    unset ASCII_LANDSCAPE ;;
    2|8)    ASCII_LANDSCAPE=set ;;
esac
</pre></blockquote>

<h3><a name="config_files_samba">6.1.4 <tt>smbclient.conf</tt> (local)</h3></a>

<p>
<tt>SETUP</tt> will create this file for you if you are using a remote printer
on a Windows host via <tt>smbclient</tt>.

<p>
The variables in here are <tt>SMB_SERVER</tt>, <tt>SMB_IP</tt>,
<tt>SMB_PRINTER</tt>, <tt>SMB_WORKGROUP</tt> and (optionally) <tt>SMB_USER</tt>
and <tt>SMB_PASSWD</tt>. The values have the same meaning as shown in the
<tt>SETUP</tt> dialog. Additional variables are <tt>SMB_BUFFER</tt> (default:
1400) and <tt>SMB_FLAGS</tt> (default: &quot;-N&quot;).

<p>
If the file contains a user (other than <em>guest</em>) and password, it will
be read protected, so only the account used for printing by <tt>lpd</tt> is
granted access to it.

<h3><a name="config_files_netware">6.1.5 <tt>netware.conf</tt> (local)</h3></a>

<p>
<tt>SETUP</tt> will create this file for you if you are using a remote printer
on a Novell NetWare printer server via <tt>ncprint</tt> or <tt>nprint</tt>.

<p>
The variables in this file are the same that <tt>SETUP</tt> allows you to
change: <tt>NCP_SERVER</tt>, <tt>NCP_PRINTER</tt>, <tt>NCP_USER</tt> and
<tt>NCP_PASSWD</tt>.

<p>
Similar to <tt>smbclient.conf</tt>, if you entered a password, read access to
<tt>netware.conf</tt> will be limited.

<h3><a name="config_files_lpr">6.1.6 <tt>lpr.conf</tt> (local)</h3></a>

<p>
If your printer spooler does not allow input filters for remote printer queues,
you'll have to create this file manually. The only useful variable in there is
<tt>REMOTE_NAME</tt>, which contains the remote queue name in the form
<tt>printername</tt> (local queue), <tt>printername@hostname</tt> (queue on
remote host) or <tt>printername@hostname%port</tt> (socket connection on remote
host). Consult your spooler documentation about possible values.

<p>
This configuration file is <strong>not</strong> created by <tt>SETUP</tt>.

<h3><a name="config_files_apple">6.1.7 <tt>pap.conf</tt> (local)</h3></a>

<p>
For <em>AppleTalk</em> printers, this file provides <em>apsfilter</em> with the
command line options for <tt>pap</tt>. It is created by <tt>SETUP</tt> and only
contains the remote printer name in the <tt>PAP_NBPNAME</tt> variable.

<h2><a name="config_options">6.2 Command line options</a></h2>

<p>
Specifying command line options to <em>apsfilter</em> is the easiest way to
control the printout. The parameters are <strong>driver independent</strong>
and <strong>case sensitive</strong>. Options are always valid for
<strong>all</strong> files on the same command line; later options in the
parameter list override previous values of the same kind.

<p>
Note that not all printer/driver combinations support all options -- the
appropriate driver script in <tt>@datadir@/apsfilter/driver/</tt> will
tell you more.

<p>
<table border=1>
  <tr><th>option<th>meaning<th>variable
  <tr><td>draft<br>lo / low<br>med / medium<br>hi / high<br>photo
    <td>draft quality<br>low quality<br>medium quality<br>high quality<br>
    photo quality<td>QUALITY
  <tr><td>uni<br>bi<td>uni-/bi-directional sweeps<td>SWEEP
  <tr><td>plain<br>coated<br>glossy<br>premium<br>trans
    <td>plain paper<br>coated (inkjet) paper<br>glossy paper<br>premium
    (photo) paper<br>transparencies<td>MEDIA
  <tr><td>color / colour<br>gray / grey<br>mono<td>color mode<td>COLOR
  <tr><td>auto<br>ascii<br>raw<td>automatic data conversion<br>forced text
    mode<br>pass-through mode<td>METHOD
  <tr><td>a3 / a4 / legal / letter / ledger / tabloid<td>paper size
    <td>PAPERSIZE
  <tr><td>a2ps / mpage / enscript / recode<td>text file filter
    <td>ASCII_FILTER
  <tr><td>tray0 ... tray9<td>paper feed tray number<td>PAPERTRAY
  <tr><td>pretty=<em>N</em><td>highlight level for pretty-printing
    (<em>N</em>=0,1,2)<td>PRETTY_PRINTING
  <tr><td>header / noheader<td>whether you want headers with your text prints
    <td>ASCII_HEADER
  <tr><td>border / noborder<td>whether you want borders with your text prints
    <td>ASCII_BORDER
  <tr><td>1pps / 2pps / 4pps / 8pps<td>pages per sheet<td>PS_NUP, ASCII_PPS
  <tr><td>landscape / portrait<td>paper orientation<td>LANDSCAPE,
    ASCII_LANDSCAPE
  <tr><td>book<td>output pages in &quot;book&quot; format<br>implies
    &quot;2pps,duplex,shortbind&quot;<td>PS_BOOK, PS_NUP, ASCII_PPS, DUPLEX,
    BINDING
  <tr><td>duplex / simplex<td>whether to use duplex mode<td>DUPLEX
  <tr><td>shortbind / longbind<td>paper binding edge<td>BINDING
  <tr><td>copies=<em>N</em><td>number of copies<td>COPIES
</table>

<h2><a name="config_notes">6.3 Configuration notes</a></h2>

<h3><a name="config_notes_nup">6.3.1 Landscape and N-up printing</a></h3>

<p>
Since some combinations of <em>apsfilter</em> options are not too intuitive,
let me share some thoughts on combining &quot;landscape&quot; page orientation
with &quot;n-up&quot; printing (i.e. multiple pages per sheet).

<p>
Usually, you get one of the following layouts:

<pre>
.-------.                 .-------.  .-------.
|       |                 |   |   |  |   |   |
|       |  .-----------.  | 1 | 2 |  | 1 | 3 |  .-----------.  .-----------.
|       |  |     |     |  |   |   |  |   |   |  |1 |2 |3 |4 |  |1 |3 |5 |7 |
|   1   |  |  1  |  2  |  |---+---|  |---+---|  |--+--+--+--|  |--+--+--+--|
|       |  |     |     |  |   |   |  |   |   |  | 5| 6| 7| 8|  | 2| 4| 6| 8|
|       |  `-----------  | 3 | 4 |  | 2 | 4 |  `-----------  `-----------
|       |                 |   |   |  |   |   |
`-------                 `-------  `-------
</pre>

<p>
So n-up printing always means &quot;scale the pages with the correct x:y ratio
and distribute them on the sheet&quot;; but it assumes the pages to be in
<em>portrait</em> mode in any case, since the <em>psutils</em> (here:
<tt>psnup</tt>) can't know about the &quot;logical&quot; page orientation.

<p>
If you additionally use &quot;landscape&quot; mode, there might be some strange
results, according to the converter's rotation direction, but we try to ensure
that all tools cooperate with <tt>psnup</tt> w.r.t rotation.

<p>
Fortunately, with most (even moderately sophisticated) text-to-PostScript
filters (e.g. <em>a2ps</em>, <em>mpage</em> and <em>enscript</em>), you'll get
decent results most of the time, since these are able to rotate and scale the
pages in one go.

<h3><a name="config_notes_duplex">6.3.2 Page order in fake duplex mode</a></h3>

<p>
If you are a lazy user, you might want to reduce the effort of page shuffling,
flipping and re-ordering which is required when printing in fake duplex mode.

<p>
To keep the &quot;reverse&quot; operation(s) of <em>psselect</em> to a minimum,
here are some hints as to use the correct set of options, adjusted to the
various paper feeding mechanisms:

<ul>
  <li>top loader (e.g. <em>Epson Stylus</em> series):
<blockquote><pre>
DUPLEX_ODD_FIRST=set
</pre></blockquote>
  <li>front loader, output face down (e.g. <em>HP LaserJet</em> series):
<blockquote><pre>
DUPLEX_REVERSE_EVEN=set
</pre></blockquote>
  <li>front loader, output face up (e.g. <em>HP DeskJet</em> series):
<blockquote><pre>
DUPLEX_REVERSE_ODD=set
</pre></blockquote>
</ul>

<p>
If you happen to use the <tt>PS_UTILS</tt> variable to reverse the page order
for <strong>simplex</strong> printing, you might want to ensure that these
settings don't influence each other. In this case, you don't enter those values
in the <tt>apsfilterrc</tt> file, but rather add a block to the
<tt>restrictions</tt> file for that printer:

<blockquote><pre>
if [ "$DUPLEX" ]; then
    # your settings as described above, e.g.
    DUPLEX_REVERSE_EVEN=set
else
    PS_UTILS='psselect -r'
fi
</pre></blockquote>

<p>
<strong>Note:</strong> Please make sure that the setting of <tt>BLANK_PAGE</tt>
(default: <tt>'\012\014'</tt>, i.e. one LF followed by one FF) does indeed
create an empty page, otherwise documents with an odd number of pages might not
be printed as expected.

<h1><a name="faq">7 FAQ</a></h1>

<p>
This section covers the most frequently asked questions, or what we think
should be questions frequently asked if they were asked at all :)

<p>
If you dare to ask one of this questions on the mailing-lists, you will be
laughed at!

<h2><a name="faq_error">7.1 Error messages</a></h2>

<p>
<strong>Q:</strong> <em>&quot;can't find apsfilter basedir&quot;</em><br>
<strong>A:</strong> The <em>SETUP</em> (besides other things) creates a link
<tt>@sysconfdir@/apsfilter/basedir</tt> that points to the actual directory
where <em>apsfilter</em> was installed. This link has been either mangled or
deleted entirely. Try to run <em>SETUP</em> again.

<p>
<strong>Q:</strong> <em>&quot;can't find configuration&quot;</em><br>
<strong>A:</strong> The only configuration file that positively has to be found
for each <tt>QUEUE</tt> is <tt>@sysconfdir@/apsfilter/QUEUE/apsfilterrc</tt>,
because this file defines the most important variables (driver and printer
model, paper size, printing method). <em>SETUP</em> should have created that
file... strange.

<p>
<strong>Q:</strong> <em>&quot;unsupported file type 'foobar'&quot;</em><br>
<strong>A:</strong> The <tt>file</tt> command has identified your input file,
but <em>apsfilter</em> doesn't know how to print it. If you know a converter
for this type of file which works on the command line (preferably to PostScript
or PNM, but others might work as well), please contact us at
<a href="mailto:apsfilter-hackers@apsfilter.org">&lt;apsfilter-hackers@apsfilter.org&gt;</a>.

<p>
This could also be caused by a wrong guess by <em>file(1)</em> -- the input
data might match a &quot;magic number&quot; by accident. In this case you can
use the &quot;ascii&quot; option (if the file contains only text), or you must
convert it yourself.

<p>
<strong>Q:</strong> <em>&quot;missing 'foo'; can't convert file type 'bar'&quot;</em><br>
<strong>A:</strong> In this case <em>apsfilter</em> knows the file type, but is
unable to locate any filter which may be used for further processing. This
might be solved by adjusting the <tt>PATH</tt> setting in the global
<tt>apsfilterrc</tt>, but most likely you don't have a converter for that type
installed. For several file formats there's more than one possible filter (not
just the one that is called &quot;missing&quot;; in most cases, it's the
&quot;last resort&quot;).

<p>
<strong>Q:</strong> <em>&quot;invalid method 'foobar'&quot;</em><br>
<strong>A:</strong> This is another &quot;can't happen&quot; error, because the
only chance to get this error message is when <em>some person</em> fiddled with
the printer queue specific <tt>apsfilterrc</tt> file -- and it surely wasn't
you, was it? Anyway, the <tt>METHOD</tt> setting must be one of
&quot;auto&quot; (this is probably what you want), &quot;ascii&quot; or
&quot;raw&quot;.

<p>
<strong>Q:</strong> <em>&quot;can't determine the lpd spool directory&quot;</em><br>
<strong>A:</strong> This error may have two different reasons:
<ol>
  <li>You want to print directly to a remote printer queue, but your spooler
    can't handle it. In this case you either can install <em>LPRng</em> or you
    need a <a href="#faq_item_bounce">bounce queue</a>.
  <li>You are using a <em>BSD</em> style spooler, but have removed the
    &quot;accounting file&quot; specification in <tt>@printcap@</tt> (the
    &quot;:af=...&quot; line). Even if you don't want accounting, you must
    leave that line in there, because that's the only chance for
    <em>apsfilter</em> to get hold of the spool directory location (which is
    also the directory the accounting file is in).
</ol>

<p>
<strong>Q:</strong> <em>&quot;error creating directory for temporary
files&quot;</em><br>
<strong>A:</strong> The temporary file directory <tt>TMPDIR</tt> used by
<em>apsfilter</em> can be set in <tt>apsfilterrc</tt>; the default is
<tt>/tmp</tt>. The permission bits of this directory should be 1777
(rwxrwxrwt), so that <em>apsfilter</em> can create its own subdirectory which
will be used for temporary files.

<p>
Another reason for this error is a denial-of-service effect which occurs if the
name <tt>apsfilter<em>$$</em></tt> (where <em>$$</em> is the process ID) is
already used in <tt>TMPDIR</tt> <strong>and</strong> the <em>mktemp</em>
program cannot be found. If you install <em>mktemp</em>, you most likely won't
ever see this error message again.

<p>
<strong>Note</strong>: In this case, <em>apsfilter</em> exits with a non-fatal
error code. Depending on your printer spooler type, <em>lpd</em> might want to
retry to print the file, since the error condition is not persistent (e.g. the
next run will have a different <em>$$</em> value).

<p>
<strong>Q:</strong> <em>&quot;driver script 'foo' for 'bar' not found&quot;</em><br>
<strong>A:</strong> The driver you selected for your printer (<em>bar</em>) was
supposed to be configured by the shell script
<tt>@datadir@/apsfilter/driver/<em>foo</em></tt>, but this script wasn't
found. This shouldn't have happened!

<p>
<strong>Q:</strong> <em>&quot;driver script 'foo' not yet available&quot;</em><br>
<strong>A:</strong> Similar to the message above, this warning says that no
script has yet been written for your particular driver. If you are willing to
create one (it's not too difficult), have a look at
<tt>@datadir@/apsfilter/driver/README</tt>. In case the driver doesn't
support options other than its defaults, you can just create an empty file
(<tt>touch @datadir@/apsfilter/driver/<em>foo</em></tt>); this way, you
won't get annoyed by this message anymore.

<p>
<strong>Q:</strong> <em>&quot;missing 'foo'; can't unpack file type 'bar'&quot;</em><br>
<strong>A:</strong> The file you wanted to print was compressed, but the
decompressing tool was not found in the <tt>PATH</tt>. Install it, or adjust
the <tt>PATH</tt> setting in the global <tt>apsfilterrc</tt> configuration
file.

<p>
<strong>Q:</strong> <em>&quot;apsfilter warning: html2ps needs gs for DSC
compliance&quot;</em><br>
<strong>A:</strong> When converting HTML files to PostScript, the
<em>html2ps</em> converter relies on <em>ghostscript</em> to create
<em>DSC</em> compliant PostScript documents; this is needed for any further
processing via the <em>psutils</em> (n-up printing, duplex etc.). The
<em>gs</em> executable was not found in the <tt>PATH</tt>; however,
since it might be okay to create non-DSC documents, <em>apsfilter</em> just
prints a warning to the log/status file.

<p>
<strong>Note</strong>: Since <em>html2ps</em> can have its own <tt>PATH</tt>
setting in the configuration file <tt>html2psrc</tt>, this warning may even be
unnecessary.

<p>
<strong>Q:</strong> <em>&quot;apsfilter warning: duplex fifo couldn't be
created&quot;</em><br>
<strong>A:</strong> For fake duplex printing to work, <em>apsfilter</em> needs
to set up a named pipe (a.k.a. <em>fifo</em>) which enables the user to send
the release-key to <em>apsfilter</em>. This pipe/fifo is created with the
<tt>mkfifo</tt> command, which failed in this case -- <em>apsfilter</em> then
prints the file in simplex mode.

<h2><a name="faq_fail">7.2 Printing failures</a></h2>

<p>
<strong>Q:</strong> <em>I just have set up the printers, but the names are not
recognized by my spooler software!</em><br>
<strong>A:</strong> Are you sure you have restarted the printer daemon? As
<em>SETUP</em> alters the central configuration file <tt>@printcap@</tt>,
the spooler must be told to use the new version. The setup instructions tell
you <a href="#setup_item_restart">what to do</a>.

<p>
<strong>Q:</strong> <em>The spooler takes the input file, but there's nothing
coming out of the printer.</em><br>
<strong>A:</strong> Are you sure you're talking to the correct printer? If your
<tt>@printcap@</tt> already contained a printer called <em>lp</em>, it's
likely that you tried to use that printer queue. Some <em>lpd</em> packages
&quot;feature&quot; a sample <em>lp</em> entry in <tt>@printcap@</tt> which is
suitable for a generic, mostly text-only printer. Try using the
&quot;-P my_printer&quot; command line option to <em>lpr</em> (for the
<em>lp</em> interface it's &quot;-d my_printer&quot;). If that works, either
set the <strong>environment</strong> variable <tt>PRINTER=my_printer</tt> or
change <tt>@printcap@</tt> manually, so that <em>lp</em> is an alias for the
correct queue.

<p>
However, this could also be a processing error, maybe even a syntax error in
the filter script. Please have a look at the <em>help</em> chapter to find out
how to enable <a href="#help_you_bug">debugging</a>. If the debug output is not
helpful to you, please send us a bug report.

<p><a name="#faq_item_bounce"></a>
<strong>Q:</strong> <em>I want to print to a remote printer, but my spooler
doesn't allow input filters for remote printers in
<tt>@printcap@</tt>.</em><br>
<strong>A:</strong> This might be solved by using a so-called &quot;bounce
queue&quot;. You must edit <tt>@printcap@</tt> to change the <tt>:lp=</tt>
entry for the printer to be <tt>:lp=/dev/null:</tt>; then you create a simple
text file called <tt>lpr.conf</tt> in the appropriate configuration directory,
e.g. <tt>@sysconfdir@/apsfilter/QUEUE/</tt>, that consists just of one line:

<blockquote><pre>
REMOTE_NAME=<em>remoteprinter@remotehost.somedomain</em>
</pre></blockquote>

If the printer is on the same host, you can leave out the trailing
<em>@remotehost.somedomain</em> part. Remember to restart the daemon in any
case.

<p>
<strong>Q:</strong> <em>Why doesn't apsfilter find the conversion programs? I
know that they are installed!</em><br>
<strong>A:</strong> By default <em>apsfilter</em> uses a restricted
<tt>PATH</tt> for security reasons. You can alter the <tt>PATH</tt> in
<tt>@sysconfdir@/apsfilter/apsfilterrc</tt> (global) or in the printer
specific <tt>apsfilterrc</tt>.

<p>
<strong>Q:</strong> <em>Why is the resolution for dvips wrong?</em><br>
<strong>A:</strong> For whatever reason, there are different <em>dvips</em>
version out there which use either &quot;-D&quot; or &quot;-P&quot; as the
command line switch to set the resolution. Consult your <em>dvips</em> manpage
and set <tt>DVIPS_RES_DorP</tt> in the main configuration file.

<p>
<strong>Q:</strong> <em>I get &quot;permission denied&quot; errors for some
file <tt>cf...</tt>!</em><br>
<strong>A:</strong> That's a classic FAQ :) Far too many <em>lpd</em>
installations suffer from wrong permissions or non-matching user/group ID
settings which prevent <em>apsfilter</em> from reading that control file.
All I can say is: <em>LPRng</em> doesn't have that problem.

<p>
<strong>Q:</strong> <em>I want to print something, but I only see some weird
PostScript code!</em><br>
<strong>A:</strong> There are a couple of reasons for this (too common) error:

<ul>
  <li>You used an option for <tt>lpr</tt> or <tt>apsfilter</tt> which causes
    the data to be printed in &quot;raw&quot; (i.e. unfiltered) mode. This
    can be the result of a <tt>METHOD=raw</tt> setting in one of the config
    files, the &quot;-l&quot; or &quot;-b&quot; switch to <tt>lpr</tt> or the
    <tt>raw</tt> command line option to <em>apsfilter</em>.

    <p>
    The latter case happens with <em>gimp</em> in connection with PostScript
    output on a non-PostScript printer (maybe via an <em>apsfilter</em> queue).
    The default options include &quot;raw&quot;; remove that in the
    &quot;Setup&quot; dialog. (Please bear in mind that printing like this is
    only useful if your printer is not supported by <em>gimp-print</em>, since
    the plug-in is able to handle the options much better than
    <em>apsfilter</em>, and it avoids PostScript as an intermediate format.)

    <p>
    Another reason could be remote clients for a printer server that send the
    print jobs in &quot;raw&quot; mode. If the spooler on the client can't be
    configured to disable that behaviour, you can include a line
    <tt>IGNORE_LPD_RAW=set</tt> into the appropriate <tt>apsfilterrc</tt> file.
    If you still want to print files in &quot;raw&quot; mode with this queue,
    you can use the <tt>raw</tt> command line option to <em>apsfilter</em> --
    this one won't be ignored.

  <li>The input file might be PostScript code, but it is not recognized as
    such. In this case, it is taken as normal text. Check the file's first
    line to be at least <tt>%!</tt> or <tt>%!PS</tt> -- this should convince
    your <tt>file</tt> command to correctly report the file type.

    <p>
    Some files in the <em>ghostscript</em> distribution need this kind of help.

  <li>The printer type for this particular queue might be set to <tt>PS</tt> or
    <tt>PSgs</tt>, although you don't have a PostScript printer. Check the
    configuration file <tt>@sysconfdir@/apsfilter/QUEUE/apsfilterrc</tt>.
</ul>

<p>
<strong>Q:</strong> <em>My USB-connected Epson Stylus printer won't work with
{Free,Net,Open}BSD!</em> [from the <em>gimp-print</em> FAQ]<br>
<strong>A:</strong> By default, the BSD device driver for the USB printer
device (usually <tt>ulpt0</tt>) does a prime, or USB bus reset, when the device
is opened. This causes the printer to reset itself (one can hear the print head
moving back and forth when this happens) and lose sync. After this the printer
won't go into graphics mode and instead spews characters all over your
expensive photo paper. This has been observed on the Stylus Photo 870; it
likely exists with other USB-connected Epson Stylus printers.

<p>The fix is to use the <tt>unlpt0</tt> device instead of <tt>ulpt0</tt>. The
driver doesn't perform the USB prime when <tt>unlpt0</tt> is opened. If this
device doesn't exist on your system you can create it with

<blockquote><pre>
mknod unlpt0 c 113 64 root wheel
</pre></blockquote>

in the <tt>/dev</tt> directory.

<p>
<strong>Q:</strong> <em>For some files I want to print, there are error
messages regarding &quot;DSC&quot; showing up in the log. What's that?</em><br>
<strong>A:</strong> <em>DSC</em> (Document Structuring Conventions) is the
format specification for PostScript data files. These error messages probably
say that the application which produces the PostScript data is buggy. You may
be able to fix that by saving the PostScript data to a file first, then using
the &quot;fixps&quot; tool (or some variant) to get it working.

<p>
<strong>Q:</strong> <em>Why can't I print DVI/HTML/Sketch/FIG files with
embedded images etc.?</em><br>
<strong>A:</strong> That depends on the file format and the way the images are
embedded. For inline images, i.e. images that are literally included in the
file, there shouldn't be any problems. If the image is referenced by a
filename, it must not only be found but it must also be accessible.

<p>
Relative pathnames are very hard for the filter to expand, since it would have
to know a directory (or a set of directories) to search in. Absolute pathnames
are more pleasant, but you still have to make sure that the referenced file is
readable by anyone <em>and</em> every directory down the path is executable by
anyone.

<p>
The easiest way to print the file correctly might be to use <tt>aps2file</tt>
inside the correct &quot;document root&quot; directory, so that all relative
paths are actually referring to the right files, and then pipe the output
through a &quot;raw&quot; queue. For example:

<blockquote><pre>
$ cd @docdir@/apsfilter
$ aps2file handbook.html | lpr -Zraw
</pre></blockquote>

This should print the <em>apsfilter</em> handbook with a nice little logo :^)

<p>
<strong>Q:</strong> <em>How to persuade apsfilter to attach EOT to PS
jobs not to leave LED blinking on a PS printer?</em><br>
<strong>A:</strong> Use the printcap capability "tr". That string is sent
after each job. Add ":tr=\004:" to your printers entry in /etc/printcap.
This has been reported to work with a LJ 1200.

<h2><a name="faq_tuning">7.3 Tuning</a></h2>

<p>
<strong>Q:</strong> <em>My printer needs special treatment to reset it before
any print job, set the codepage, enable the correct end-of-line mode, add an
extra formfeed afterwards etc.</em><br>
<strong>A:</strong> Grab your printer documentation to look for the escape
sequences needed and enter these into the configuration variables
<tt>RAW_PROLOGUE</tt> and <tt>RAW_EPILOGUE</tt> (remember to use octal values).
To send a reset sequence of &quot;ESC c&quot; before and an additional formfeed
after the <em>raw</em> print job, use

<blockquote><pre>
RAW_PROLOGUE='\033c'
RAW_EPILOGUE='\014'
</pre></blockquote>

<p>
You can also set command line options for <em>recode</em> in the variable
<tt>RECODE_OPTS</tt> if you want fast text listings; a simple conversion
from the <em>latin1</em> charset with UNIX-style <tt>LF</tt> line endings to
<em>codepage 437</em> with <tt>CR+LF</tt> line endings would be enabled by

<blockquote><pre>
RECODE_OPTS='latin1..cp437/crlf'
</pre></blockquote>

<p>
The <tt>RECODE_PROLOGUE</tt> and <tt>RECODE_EPILOGUE</tt> variables are used
in addition to the <tt>RAW_...</tt> stuff whenever <em>recode</em> does text
conversion.

<p>
<strong>Q:</strong> <em>I have a PostScript Level 1 printer. How can I tell
apsfilter to produce correct output?</em><br>
<strong>A:</strong> You must use the special <tt>PSgs</tt> driver which uses
the &quot;pswrite&quot;, &quot;psgray&quot; and &quot;psmono&quot;
<em>ghostscript</em> devices. Then add &quot;-dLanguageLevel=1&quot; to the
<tt>GS_FEATURES</tt> variable for that printer.

<p>
<strong>Q:</strong> <em>How do I prevent users from using command line options?
My printer shall always use the same settings.</em><br>
<strong>A:</strong> There are two different approaches to this problem:
<ol>
  <li>The file <tt>@sysconfdir@/apsfilter/QUEUE/restrictions</tt> can be used
    to reset options to their default, e.g.
<blockquote><pre>
QUALITY=medium
MEDIA=plain
COLOR=full
PAPERSIZE=a4
unset DUPLEX
</pre></blockquote>
  <li>Instead of using your normal driver, you can create a custom driver
    script. First you have to install the correct driver for your printer, e.g.
    <em>pcl3/hpdj690c</em>. Then you change the <tt>PRINTER=pcl3/hpdj690c</tt>
    line in <tt>@sysconfdir@/apsfilter/QUEUE/apsfilterrc</tt> to
    <tt>PRINTER=custom</tt> (or some other unused name). The last step is to
    create a new driver script named
    <tt>@datadir@/apsfilter/driver/custom</tt> which includes all your
    variables like <tt>GS_FEATURES</tt> and <tt>RESOLUTION</tt> and their
    desired values, plus a line <tt>PRINTER=pcl3/hpdj690c</tt> to ensure the
    original <em>driver name</em> is used properly.
</ol>

<p>
<strong>Q:</strong> <em>Printing program listings etc. is dog slow.</em><br>
<strong>A:</strong> If you use <em>a2ps</em> (the default), <em>mpage</em> or
<em>enscript</em> to print text files, these are converted to PostScript first.
For plain text printings you can use <em>recode</em> as the filter (either set
<tt>ASCII_FILTER=recode</tt> or use the &quot;recode&quot; command line
option). However, you lose all the spiffy features like borders, headers,
multiple pages per sheet and fake duplex mode.

<p>
<strong>Q:</strong> <em>I want to print the source code of some PostScript,
HTML, Sketch, ... file, but all I get is the formatted output.</em><br>
<strong>A:</strong> You have to tell <em>apsfilter</em> not to automagically
convert the file, but rather treat is as normal text; use the &quot;ascii&quot;
command line option.

<p>
<strong>Q:</strong> <em>The page margins are not correct. / The printout is
shifted in one direction.</em><br>
<strong>A:</strong> Although this is not actually an <em>apsfilter</em>
problem, here are some hints:

<ul>
  <li><em>a2ps</em>, <em>mpage</em> and <em>enscript</em> have options for the
    command line and/or in the configuration files that enable you to set the
    correct page margins; see the appropriate documentation for details
  <li><em>ghostscript</em> drivers may have a mechanism to adjust page margins;
    e.g. the <em>uniprint</em> profiles usually contain a line like

<blockquote><pre>
-dupMargins=&quot;{9.0 39.96 9.0 9.0}&quot;
</pre></blockquote>

    which define the left, bottom, right and top margins in points (1pt =
    1/72in); other drivers may have different options, if they support this at
    all
  <li>you can use the <em>ghostscript</em> test file <tt>align.ps</tt> to
    measure the page drift and margins in points; then create a world-readable
    file (e.g. <tt>@sysconfdir@/apsfilter/QUEUE/margin.ps</tt>) that looks
    similar to this:

<blockquote><pre>
%!
% Example: Epson Stylus Color 640
&lt;&lt; /.HWMargins [-8.504 9.921 0 0] /Margins [-42.52 -2.835] &gt;&gt; setpagedevice
</pre></blockquote>

    and set <tt>PS_INIT=@sysconfdir@/apsfilter/QUEUE/margin.ps</tt>; if you
    already have a <tt>PS_INIT</tt> file, just add the correct line to it.
    <p>
    <strong>Note</strong>: You may need to use the command

<blockquote><pre>
{ echo '%!' ; cat <em>/path/to/</em>align.ps ; } | lpr
</pre></blockquote>

    to print the test file correctly. Please remember that <tt>align.ps</tt>
    resets those values to zero, so you won't see any change if you print it
    again with a <tt>PS_INIT</tt> file like the one above.
</ul>

<p>
<strong>Q:</strong> <em>Why are parts of the page missing on my PostScript
printer?</em><br>
<strong>A:</strong> Pages in higher resolutions or with complex content need
plenty of RAM to be rendered. For some printers the standard amount of memory
which is built in just isn't enough. You can either put more RAM into your
printer or reduce the rendering resolution (to probably half the amount).
Using the special <tt>PSgs</tt> driver might help as well.

<p>
<strong>Q:</strong> <em>When I print more than one file at a time, the headers
for text files are wrong; they still show the name of the first file!</em><br>
<strong>A:</strong> This ever-annoying problem only occurs with <em>BSD</em>
spoolers which just don't give enough information about a print job to the
filter. The solution is to install <em>LPRng</em>, or print just one file at a
time, or disable headers completely.

<p>
<strong>Q:</strong> <em>Why is my DVI file messed up? It should be in landscape
mode, but the right border is chopped off!</em><br>
<strong>A:</strong> The problem is that dvips doesn't know if the file is in
landscape mode or not. You have to explicitly use the &quot;landscape&quot;
command line option.

<h1><a name="links">8 Links</a></h1>

<p>
The first and most important link is of course the <em>Apsfilter Homepage</em>
at <a href="http://www.apsfilter.org/">http://www.apsfilter.org/</a>. This is
the definite source of information about <em>apsfilter</em>, most prominently
the <a href="http://www.apsfilter.org/download.html">download section</a>.

<p>
To keep up with the latest <em>apsfilter</em> changes, you can use the
anonymous CVS server as described on the
<a href="http://www.apsfilter.org/support.html">support page</a> or
<a href="http://www.apsfilter.org/cgi-bin/cvsweb.cgi">browse the repository</a>.

<h2><a name="links_software">8.1 Third party software</a></h2>

<p>
Here's an alphabetical list of software packages known to and supported by
<em>apsfilter</em>:

<dl>
  <dt>a2ps
    <dd><a href="http://www.inf.enst.fr/~demaille/a2ps/">http://www.inf.enst.fr/~demaille/a2ps/</a>
  <dt>acroread
    <dd><a href="http://www.adobe.com/products/acrobat/readermain.html">http://www.adobe.com/products/acrobat/readermain.html</a>
  <dt>ar (part of <em>binutils</em>)
    <dd><a href="http://sourceware.cygnus.com/binutils/">http://sourceware.cygnus.com/binutils/</a>
<!-- FIXME: arc/unarc -->
  <dt>bzip2
    <dd><a href="http://www.muraroa.demon.co.uk/">http://www.muraroa.demon.co.uk/</a>
  <dt>cabextract
    <dd><a href="http://www.kyz.uklinux.net/cabextract.php3">http://www.kyz.uklinux.net/cabextract.php3</a>
  <dt>convert (part of <em>ImageMagick</em>)
    <dd><a href="http://www.imagemagick.org/">http://www.imagemagick.org/</a>
  <dt>cpio
    <dd><a href="http://www.gnu.org/software/cpio/">http://www.gnu.org/software/cpio/</a>
  <dt>dvips (part of <em>teTeX</em>)
    <dd><a href="http://www.tug.org/teTeX/">http://www.tug.org/teTeX/</a>
  <dt>enscript
    <dd><a href="http://www.ngs.fi/mtr/genscript/index.html">http://www.ngs.fi/mtr/genscript/index.html</a>
  <dt>Epson printer drivers
    <dd><a href="http://www.epkowa.co.jp/english/linux_e/pips_e.html">http://www.epkowa.co.jp/english/linux_e/pips_e.html</a> <em>(&quot;pips&quot;)</em><br>
      <a href="http://www.epkowa.co.jp/english/linux_e/lpd_e.html">http://www.epkowa.co.jp/english/linux_e/lpd_e.html</a> <em>(laser printers)</em>
  <dt>fig2dev (part of <em>transfig</em>)
    <dd><a href="http://www.xfig.org/">http://www.xfig.org/</a>
  <dt>file
    <dd><a href="ftp://ftp.astron.com/pub/file/">ftp://ftp.astron.com/pub/file/</a>
  <dt>freeze
    <dd><a href="ftp://ftp.std.com/src/util/freeze2.5/">ftp://ftp.std.com/src/util/freeze2.5/</a>
  <dt>ghostscript
    <dd><a href="http://www.cs.wisc.edu/~ghost/">http://www.cs.wisc.edu/~ghost/</a> <em>(homepage)</em>
    <br><a href="http://ghostscript.sourceforge.net/">http://ghostscript.sourceforge.net/</a> <em>(project page)</em>
    <br><a href="http://www.ghostscript.com/">http://www.ghostscript.com/</a> <em>(commercial site)</em>
  <dt>gimp-print (a.k.a. <em>stp</em>)
    <dd><a href="http://gimp-print.sourceforge.net/">http://gimp-print.sourceforge.net/</a>
  <dt>groff
    <dd><a href="http://www.gnu.org/software/groff/">http://www.gnu.org/software/groff/</a>
  <dt>gzip
    <dd><a href="http://www.gnu.org/software/gzip/gzip.html">http://www.gnu.org/software/gzip/gzip.html</a>
  <dt>HP inkjet drivers (official)
    <dd><a href="http://hpinkjet.sourceforge.net/">http://hpinkjet.sourceforge.net/</a>
  <dt>hpdj
    <dd><a href="http://home.t-online.de/home/Martin.Lottermoser/pcl3dist/">http://home.t-online.de/home/Martin.Lottermoser/pcl3dist/</a>
  <dt>html2ps
    <dd><a href="http://www.tdb.uu.se/~jan/html2ps.html">http://www.tdb.uu.se/~jan/html2ps.html</a>
  <dt>htmldoc
    <dd><a href="http://www.easysw.com/htmldoc/">http://www.easysw.com/htmldoc/</a>
  <dt>IBM Omni drivers
    <dd><a href="http://oss.software.ibm.com/developer/opensource/linux/projects/omni/">http://oss.software.ibm.com/developer/opensource/linux/projects/omni/</a>
  <dt>lha
    <dd><a href="http://www2m.meshnet.or.jp/~dolphin/lha/lha-unix.htm">http://www2m.meshnet.or.jp/~dolphin/lha/lha-unix.htm</a>
  <dt>lpd (BSD-style)
    <dd><a href="http://sourceforge.net/projects/lpr/">http://sourceforge.net/projects/lpr/</a>
  <dt>LPRng
    <dd><a href="http://www.lprng.com/">http://www.lprng.com/</a>
  <dt>lzop
    <dd><a href="http://wildsau.idv.uni-linz.ac.at/mfx/lzop.html">http://wildsau.idv.uni-linz.ac.at/mfx/lzop.html</a>
  <dt>mktemp
    <dd><a href="http://www.courtesan.com/mktemp/">http://www.courtesan.com/mktemp/</a>
  <dt>mpage
    <dd><a href="http://www.mesa.nl/pub/mpage/">http://www.mesa.nl/pub/mpage/</a>
  <dt>nconvert (part of <em>XnView</em>)
    <dd><a href="http://www.xnview.com/">http://www.xnview.com/</a>
  <dt>ncprint (part of <em>ncplib</em>)
    <dd><a href="http://rbp.chat.ru/ncplen.html">http://rbp.chat.ru/ncplen.html</a>
  <dt>netpbm tools (a.k.a. <em>pbmplus</em>)
    <dd><a href="http://sourceforge.net/projects/netpbm/">http://sourceforge.net/projects/netpbm/</a>
  <dt>nprint (part of <em>ncpfs</em>)
    <dd><a href="ftp://ftp.platan.vc.cvut.cz/pub/linux/ncpfs/">ftp://ftp.platan.vc.cvut.cz/pub/linux/ncpfs/</a>
  <dt>pap (part of <em>netatalk</em>)
    <dd><a href="http://www.umich.edu/~rsug/netatalk/">http://www.umich.edu/~rsug/netatalk/</a>
  <dt>pcdtoppm (part of <em>xpcd</em>)
    <dd><a href="http://bytesex.org/xpcd.html">http://bytesex.org/xpcd.html</a>
  <dt>pcl3
    <dd><a href="http://home.t-online.de/home/Martin.Lottermoser/pcl3.html">http://home.t-online.de/home/Martin.Lottermoser/pcl3.html</a>
  <dt>pdftops (part of <em>xpdf</em>)
    <dd><a href="http://www.foolabs.com/xpdf/">http://www.foolabs.com/xpdf/</a>
  <dt>pnm2ppa
    <dd><a href="http://sourceforge.net/projects/pnm2ppa/">http://sourceforge.net/projects/pnm2ppa/</a>
  <dt>psutils
    <dd><a href="http://www.dcs.ed.ac.uk/home/ajcd/psutils/">http://www.dcs.ed.ac.uk/home/ajcd/psutils/</a>
  <dt>rar, unrar
    <dd><a href="http://www.rarsoft.com/">http://www.rarsoft.com/</a>
  <dt>recode
    <dd><a href="http://www.iro.umontreal.ca/contrib/recode/HTML/">http://www.iro.umontreal.ca/contrib/recode/HTML/</a>
  <dt>rpm
    <dd><a href="http://www.rpm.org/">http://www.rpm.org/</a>
  <dt>sendmail
    <dd><a href="http://www.sendmail.org/">http://www.sendmail.org/</a>
  <dt>sk2ps (part of <em>sketch</em>)
    <dd><a href="http://sketch.sourceforge.net/">http://sketch.sourceforge.net/</a>
  <dt>smbclient (part of <em>samba</em>)
    <dd><a href="http://www.samba.org/">http://www.samba.org/</a>
  <dt>tar
    <dd><a href="http://www.gnu.org/software/tar/tar.html">http://www.gnu.org/software/tar/tar.html</a>
  <dt>tgif
    <dd><a href="http://bourbon.cs.umd.edu:8001/tgif/">http://bourbon.cs.umd.edu:8001/tgif/</a>
  <dt>wmf2eps (part of <em>libwmf</em>)
    <dd><a href="http://www.wvware.com/libwmf.html">http://www.wvware.com/libwmf.html</a>
  <dt>unarj
    <dd><a href="http://testcase.newmail.ru/">http://testcase.newmail.ru/</a>
  <dt>unzip
    <dd><a href="http://www.info-zip.org/UnZip.html">http://www.info-zip.org/UnZip.html</a>
<!-- FIXME: zoo -->
</dl>

<p>
Other driver packages that can be made to work with <em>apsfilter</em> include:

<dl>
  <dt>turboprint
    <dd><a href="http://www.turboprint.de/">http://www.turboprint.de/</a>
  <dt>xw-tools
    <dd><a href="http://xwtools.automatix.de/">http://xwtools.automatix.de/</a>
</dl>

<h2><a name="links_info">8.2 Further information</a></h2>

<p>
A good overview of printers, drivers and printing systems can be found on
<a href="http://www.linuxprinting.org/">http://www.linuxprinting.org/</a>.
Don't be misled by the name, most of the information is valid on any
UNIX-like system.

<p>
The <em>Linux Printing HOWTO</em> at
<a href="http://www.linuxprinting.org/howto/">http://www.linuxprinting.org/howto/</a>
is a must read for all Linux administrators (and probably others as well) --
preferably <strong>before</strong> you try to set up your printer.
Users might also profit from the <em>Linux Printing Usage HOWTO</em> at
<a href="http://www.linuxdoc.org/HOWTO/Printing-Usage-HOWTO.html">http://www.linuxdoc.org/HOWTO/Printing-Usage-HOWTO.html</a>.

<p>
Even if you don't want to use <em>LPRng</em> (which is hard to believe), the
<em>LPRng-HOWTO</em> at
<a href="http://www.lprng.com/LPRng-HOWTO.html">http://www.lprng.com/LPRng-HOWTO.html</a>
is a rich source of everything related to printer daemons, protocols, filters
and stuff.

<!-- FIXME: add newsgroups? -->

<h1><a name="help">9 Help</a></h1>

<h2><a name="help_us">9.1 You help us</a></h2>

<p>
That's not what you wanted to read, is it? Anyway, we are in a constant need of
bug reports, new ideas, suggestions -- but also &quot;real value&quot; support
in form of hardware or software donations, job offerings or just pure hard
ca$h.

<p>
The easiest way to contribute to <em>apsfilter</em> is probably to improve the
driver scripts, especially the one(s) for your printer(s). Have a look at
<tt>@datadir@/apsfilter/driver/README</tt> for more information.
If your preferred driver does not have a script yet, you'd really help us
if you'd try to write and test one -- it isn't too difficult. Maybe the driver
is already mapped to some other script (with basically the same settings) via
<tt>@datadir@/apsfilter/driver/MAPPING</tt>, but you can simply create
an appropriately named script; this will override the <tt>MAPPING</tt> entry.

<h2><a name="help_you">9.2 We help you</a></h2>

<p>
The first step to solve any <em>apsfilter</em> problems is to make sure it
actually is not some kind of other defect on your system (hardware, spooler
software, cables, ...). If you are absolutely sure that your problem is not
already covered in the <a href="#faq">FAQ</a> or in other parts of this
documentation, read on.

<p>
There's also a <a href="http://www.apsfilter.org/Lists-Archives/">mailing-lists
archive</a> which you can browse and search. Maybe your problem has already
been solved, or even classified as a feature ;)

<h3><a name="help_you_bug">9.2.1 Reporting bugs</a></h3>

<p>
To prepare a bug report, it's absolutely necessary to create a log of the
failed printing attempt (unless you have problems that occur before even
having a chance to print). You can (and should) use the <tt>aps2file</tt> tool
with the &quot;-D&quot; option. It is a good idea to use the same printer queue
and command line options as before when the printing attempt failed. You can
pass the options to <em>apsfilter</em> via <tt>aps2file</tt> by using the
&quot;-P&quot; and &quot;-Z&quot; switches.

<p>
The log will be created on <em>stderr</em>, so you might want to redirect it
to a file by appending <tt>2&gt;log.txt</tt>. You can see a detailed trace of
what <em>apsfilter</em> tried to do; if that doesn't help you, just save the
file for inclusion into the bug report. If you can, please use <em>bash</em>
as your shell, since the log will be much more verbose.

<p>
Since many bug reports we received were not exactly helpful, we now supply a
script that generates a half-automatic bug report which you just have to fill
out. Call <tt>apsfilter-bug</tt> on the command line and your favourite editor
should present you the template text.

<p>
The first thing you should edit is the <tt>From:</tt> field; please enter your
correct e-mail address there. Do <strong>not</strong> change the <tt>To:</tt>
field line, unless you <strong>positively</strong> know better.

<p>
Then just read the comments and fill in any information requested there.
All lines starting with a <tt>#</tt> character are comments and will be removed
automatically before the bug report is sent.

<p>
When you're done, save the text under its original name and exit the editor.
Exiting without saving will cause the bug report to be discarded.

<p>
We hope that we can help you!

<h3><a name="help_you_general">9.2.2 General help</a></h3>

<p>
If you need general help with <em>apsfilter</em> (i.e. if it's not even
possible to produce a bug report), there are some more mailing-lists available:

<ul>
  <li><a href="mailto:apsfilter-help@apsfilter.org">&lt;apsfilter-help@apsfilter.org&gt;</a>:
    general help forum
  <li><a href="mailto:apsfilter-hilfe@apsfilter.org">&lt;apsfilter-hilfe@apsfilter.org&gt;</a>:
    general help forum in German (try to avoid this if possible)
  <li><a href="mailto:apsfilter-hackers@apsfilter.org">&lt;apsfilter-hackers@apsfilter.org&gt;</a>:
    technical discussion, code submissions, ideas and suggestions
  <li><a href="mailto:apsfilter-printing@apsfilter.org">&lt;apsfilter-printing@apsfilter.org&gt;</a>:
    tips and tricks, problems and solutions
  <li><a href="mailto:apsfilter-doc@apsfilter.org">&lt;apsfilter-doc@apsfilter.org&gt;</a>:
    everything concerning documentation
  <li><a href="mailto:apsfilter-chat@apsfilter.org">&lt;apsfilter-chat@apsfilter.org&gt;</a>:
    everything which doesn't fit to the other lists
</ul>

<p>
There are also two read-only public mailing-lists:

<ul>
  <li>&lt;apsfilter-announce@apsfilter.org&gt;:	release announcements
  <li>&lt;apsfilter-cvs@apsfilter.org&gt;: commit messages for CVS repository
</ul>

<p>
The lists are controlled by <em>majordomo</em>; to get more information, send
an email to
<a href="mailto:majordomo@apsfilter.org">&lt;majordomo@apsfilter.org&gt;</a>
with the <em>body</em> <tt>help</tt>.

<p>
To subscribe to a mailing-list, send an email to
<a href="mailto:majordomo@apsfilter.org">&lt;majordomo@apsfilter.org&gt;</a>
with the <em>body</em> <tt>subscribe apsfilter-<strong>xyz</strong></tt>.

<p>
To unsubscribe, send an email to
<a href="mailto:majordomo@apsfilter.org">&lt;majordomo@apsfilter.org&gt;</a>
with the <em>body</em> <tt>unsubscribe apsfilter-<strong>xyz</strong></tt>.

<p><hr>

<p align=center>
You have reached the official end of the <em>apsfilter handbook</em>.<br>
It is now safe to switch off your computer.

<!-- Let's see who is stupid enough to actually do that... -->

</body>
</html>