summaryrefslogtreecommitdiff
path: root/support/printmagic/magic_ljet4m_filter
blob: 5e64b762555fb1b503d108378da53c88b1072b3f (plain)
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
#! /usr/local/bin/magicfilter
#
# Magic filter setup file for 600 DPI LaserJet 4 series with PostScript
# (i.e. LJ 4MP, 4M, 4M+, 4MV or 4SiMX, or 4P, 4, 4+, 4V or 4Si with
# PostScript option SIMM installed)
#
# This file has been automatically adapted to your system.
#

# DVIPS PostScript output: send to printer
0	%!\?\?\?\?\?\?\?\?\
\?\?\?\?\?\?\?\?\?\?\
\?\?\?\?\?\?\?\?\?\?\
\?\?\?\?\?\?\?\?\?\?\
\?\?\?\?\?\?\?\?\?\?\
\?\?\?\?\?\?\?\?\?\?\
\?\?\?\?\?\?\?\?dvips	postscript

# Other PostScript files: send to printer via GhostScript
#  This is necessary because such files may contain Japanese text
0	%!		filter gs -q -dNOPAUSE -sDEVICE=ljet4 -sOutputFile=- - quit.ps

# DVI files: convert to PostScript using dvi2ps
#  These will pipe around for GhostScript conversion.  This my not
#  always be necessary, but we don't print DVI direct that often,
#  so I guess that'll be okay.
0	\367\002	pipe	dvi2dvi -q -F /usr/local/lib/dvi2dvi/a2n | dvi2ps -q -F /usr/local/lib/dvi2ps/ljet4 -R 600

# LaTeX2e files
0 	\\documentclass	pipe	runlatex -n $LPUSER

# LaTeX 2.09 files
0	\\documentstyle	pipe	runlatex -n $LPUSER

# LaTeXing failure flag, passed by "runlatex" script
0	BARF		ignore

# compress'd data
0	\037\235	pipe	/usr/local/bin/gzip  -cdq 

# compressed files (packed, gzip, freeze, and SCO LZH respectively)
0	\037\036	pipe	/usr/local/bin/gzip  -cdq 
0	\037\213	pipe	/usr/local/bin/gzip  -cdq 
0	\037\236	pipe	/usr/local/bin/gzip  -cdq 
0	\037\240	pipe	/usr/local/bin/gzip  -cdq 

# troff documents
0	.so\040		reject	Attempted to print a ".so" troff file.
0	.\?\?\040	pipe	nkf -e > /tmp/lpdtmp.$PPID; `/usr/bin/grog  -Tps /tmp/lpdtmp.$PPID`; rm /tmp/lpdtmp.$PPID
0	.\\\"		pipe	nkf -e > /tmp/lpdtmp.$PPID; `/usr/bin/grog  -Tps /tmp/lpdtmp.$PPID`; rm /tmp/lpdtmp.$PPID
0	'\\\"		pipe	nkf -e > /tmp/lpdtmp.$PPID; `/usr/bin/grog  -Tps /tmp/lpdtmp.$PPID`; rm /tmp/lpdtmp.$PPID
0	'.\\\"		pipe	nkf -e > /tmp/lpdtmp.$PPID; `/usr/bin/grog  -Tps /tmp/lpdtmp.$PPID`; rm /tmp/lpdtmp.$PPID
0	\\\"		pipe	nkf -e > /tmp/lpdtmp.$PPID; `/usr/bin/grog  -Tps /tmp/lpdtmp.$PPID`; rm /tmp/lpdtmp.$PPID

# ditroff
0	"x T ps"	pipe	/usr/bin/grops 
0	"x T dvi"	pipe	/usr/bin/grodvi 
0	"x T ascii"	pipe	/usr/bin/grotty 
0	"x T latin1"	pipe	/usr/bin/grotty 
0	"x T lj4"	filter	/usr/bin/grolj4 

# Portable bit-, grey- and pixmaps: convert to PostScript
0	P1\n		pipe	/usr/X11R6/bin/netpbm/pnmtops  \
	-scale 1000 -dpi 600 2>/dev/null
0	P2\n		pipe	/usr/X11R6/bin/netpbm/pnmtops  \
	-scale 1000 -dpi 600 2>/dev/null
0	P3\n		pipe	/usr/X11R6/bin/netpbm/pnmtops  \
	-scale 1000 -dpi 600 2>/dev/null
0	P4\n		pipe	/usr/X11R6/bin/netpbm/pnmtops  \
	-scale 1000 -dpi 600 2>/dev/null
0	P5\n		pipe	/usr/X11R6/bin/netpbm/pnmtops  \
	-scale 1000 -dpi 600 2>/dev/null
0	P6\n		pipe	/usr/X11R6/bin/netpbm/pnmtops  \
	-scale 1000 -dpi 600 2>/dev/null

# PCL control codes almost always start with a "reset" and are
# usually followed by at least one additional PCL control code.
0	\033E\033	cat

# PJL: Send directly to printer
0	\033%-12345X	cat
0	"@PJL "		cat
0	@PJL\t		cat
0	@PJL\r		cat
0	@PJL\n		cat

# GIF files: convert to PPM
0	GIF87a		pipe	/usr/X11R6/bin/netpbm/giftopnm  2>/dev/null
0	GIF89a		pipe	/usr/X11R6/bin/netpbm/giftopnm  2>/dev/null

# JFIF (JPEG) files: convert to PPM/PGM
0	\377\330\377\340\?\?JFIF\0	pipe	/usr/local/bin/djpeg  -pnm

# TIFF files (lousy magic!!)
0	MM		pipe	/usr/X11R6/bin/netpbm/tifftopnm  2>/dev/null
0	II		pipe	/usr/X11R6/bin/netpbm/tifftopnm  2>/dev/null

# BMP files (even lousier magic -- I guess that's what you can expect
# for something out of Microsoft)
0	BM\?\?\?\?\?\?\?\?\?\?\?\?\x0c	pipe	\
	/usr/X11R6/bin/netpbm/bmptoppm  2>/dev/null
0	BM\?\?\?\?\?\?\?\?\?\?\?\?\x40	pipe	\
	/usr/X11R6/bin/netpbm/bmptoppm  2>/dev/null
0	BM\?\?\?\?\?\?\?\?\?\?\?\?\x28	pipe	\
	/usr/X11R6/bin/netpbm/bmptoppm  2>/dev/null

# Sun rasterfiles
0	\x59\xa6\x6a\x95 pipe	/usr/X11R6/bin/netpbm/rasttopnm  2>/dev/null

# SGI Imagelib (RGB) files
0	\x1\xda		pipe	/usr/X11R6/bin/netpbm/sgitopnm  2>/dev/null
0	\xda\x1		pipe	/usr/X11R6/bin/netpbm/sgitopnm  2>/dev/null

#
# Standard rejects... things we don't want to print
#

# Various archive formats
257	ustar\0		reject	Attempted to print a tar file.
257	"ustar  \0"	reject	Attempted to print a tar file.
0	07070		reject	Attempted to print a cpio file.
0	PK\3\4		reject	Attempted to print a zip file.
20	\xdc\xa7\xc7\xfd reject	Attempted to print a zoo file.

# Binaries (Linux): reject with email message
0	\013\1d\0	reject	Attempted to print a compiled binary.
0	\100\1d\0	reject	Attempted to print a compiled binary.
0	\007\1d\0	reject	Attempted to print a compiled binary.
0	\314\0d\0	reject	Attempted to print a compiled binary.
0	\177ELF		reject	Attempted to print an ELF object.
0	\007\001\0	reject	Attempted to print an object file.
216	\021\001\0\0	reject	Attempted to print a core dump file.
0	!<arch>		reject	Attempted to print an archive.
0	=<ar>		reject	Attempted to print an archive.

# Don't confuse this one with troff!
0	.snd		reject	Attempted to print Sun/NeXT audio data.

# wild guesses
# PCL control codes start with <ESC>
0	\033		cat
# optimistic troff magic
0	.		ffilter	nkf | `cat $FILE | /usr/bin/grog  -Tlj4 -` 
# wacko troff magic
0	'''		ffilter	nkf | `cat $FILE | /usr/bin/grog  -Tlj4 -` 

# Default entry -- for normal (text) files.  MUST BE LAST.
# The original entry will be sort of restored when we have
# proper protection from Kanji printing.
# default		cat	\eE\e&k2G\e(0N	\eE
default			reject	Cannot print plain text files on this printer.