Magicfilter from potato
Hello !
I'm trying to print to my stupid HP DeskJet 722c win#@## printer using
the pbm2ppa conversion program (in short it takes PS and converts into
PPA,poor man's PCL). I've been printing successfully in RH and SuSE
before but can't get it to work since I switched to potato.I'm only able
to print PS from command prompt with this script:
cat $1 | gs -sDEVICE=pbmraw -q -dNOPAUSE -r600 -sOutputFile=- - | \
pbm2ppa - - >/dev/lp0
Thanks to Michael Merten I can print ascii too but i would like to setup
magic or apsfilter. These are the two filters I tried: (very lengthy,
skip to the end for errors)
------------------------------------------------------------------------
#! /usr/sbin/magicfilter
#
# Magic filter setup file for HP DeskJet 720c
# Save as /etc/magicfilter/dj720c-filter, then
# run magicfilterconfig. Ignore the warning message about
# how to handle text!
#
# This file has been hacked together by gs 10/5/99
# set everything to convert output to PBM using 'pipe' rather than
filter
# then catch pbm files and forward to pbm2ppa for printing
# Note: pbm files have magic number P4; all other anymap files are
# converted to postscript first, then to pbm.
#! /bin/sh
# PostScript
0 %! fpipe /usr/bin/gs -q -dSAFER -dNOPAUSE -r600
-sDEVICE=pbmraw -sPAPERSIZE=a4 -sOutputFile=- -
0 \004%! fpipe /usr/bin/gs -q -dSAFER -dNOPAUSE -r600
-sDEVICE=pbmraw -sPAPERSIZE=a4 -sOutputFile=- -
# PDF
0 %PDF fpipe /usr/bin/gs -q -dSAFER -dNOPAUSE -r600
-sDEVICE=pbmraw -sPAPERSIZE=a4 -sOutputFile=- -
# TeX DVI
0 \367\002 fpipe /usr/bin/dvips -D 300 -R -q -f
# compress'd data
0 \037\235 pipe /bin/gzip -cdq
# packed, gzipped, frozen and SCO LZH data
0 \037\036 pipe /bin/gzip -cdq
0 \037\213 pipe /bin/gzip -cdq
0 \037\236 pipe /bin/gzip -cdq
0 \037\240 pipe /bin/gzip -cdq
# troff documents
0 .\?\?\040 fpipe `/usr/bin/grog -Tps $FILE`
0 .\\\" fpipe `/usr/bin/grog -Tps $FILE`
0 '\\\" fpipe `/usr/bin/grog -Tps $FILE`
0 '.\\\" fpipe `/usr/bin/grog -Tps $FILE`
0 \\\" fpipe `/usr/bin/grog -Tps $FILE`
# 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" reject Cannot print LaserJet 4 ditroff files.
# Portable bit-, grey- and pixmaps
0 P1\n pipe /usr/bin/pnmtops -scale 1000 -dpi 300
2>/dev/null
0 P2\n pipe /usr/bin/pnmtops -scale 1000 -dpi 300
2>/dev/null
0 P3\n pipe /usr/bin/pnmtops -scale 1000 -dpi 300
2>/dev/null
0 P4\n filter /usr/local/bin/pbm2ppa -s a4 - -
0 P5\n pipe /usr/bin/pnmtops -scale 1000 -dpi 300
2>/dev/null
0 P6\n pipe /usr/bin/pnmtops -scale 1000 -dpi 300
2>/dev/null
# HP Printer Control Language (PCL) -- assume start with reset code
0 \033E\033 reject sniff This printer can't handle PCL
# HP Printer Job Language (PJL)
0 \033%-12345X reject Cannot print PJL files on this printer.
0 "@PJL " reject Cannot print PJL files on this printer.
0 @PJL\t reject Cannot print PJL files on this printer.
0 @PJL\r reject Cannot print PJL files on this printer.
0 @PJL\n reject Cannot print PJL files on this printer.
# GIF files
0 GIF87a pipe /usr/bin/giftopnm 2>/dev/null
0 GIF89a pipe /usr/bin/giftopnm 2>/dev/null
# JFIF (JPEG) files
0 \377\330\377\340\?\?JFIF\0 pipe /usr/bin/djpeg -pnm
# TIFF files (the last two bytes of the "magic" is really a version
number;
# but the magic is really lame and as far as I have understood the
version
# number has never changed and never will, so we include it.)
0 MM\0\x2a fpipe /usr/bin/tiff2ps $FILE
0 II\x2a\0 fpipe /usr/bin/tiff2ps $FILE
# BMP files (even lousier magic -- Microsoft strikes again!)
0 BM\?\?\?\?\?\?\?\?\?\?\?\?\x0c pipe \
/usr/bin/bmptoppm 2>/dev/null
0 BM\?\?\?\?\?\?\?\?\?\?\?\?\x40 pipe \
/usr/bin/bmptoppm 2>/dev/null
0 BM\?\?\?\?\?\?\?\?\?\?\?\?\x28 pipe \
/usr/bin/bmptoppm 2>/dev/null
# Sun rasterfiles
0 \x59\xa6\x6a\x95 pipe /usr/bin/rasttopnm 2>/dev/null
# SGI Imagelib (IRIS RGB) files
0 \x1\xda pipe /usr/bin/sgitopnm 2>/dev/null
0 \xda\x1 pipe /usr/bin/sgitopnm 2>/dev/null
# FIG files; reported by Steven P. Hill <sph@uscbu.ih.att.com>
0 #FIG pipe /usr/bin/X11/fig2dev -Lps -P -l dummy
#
# 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.
# optimistic troff magic
0 . fpipe `/usr/bin/grog -Tps $FILE`
# wacko troff magic
0 ''' fpipe `/usr/bin/grog -Tps $FILE`
# wild guess: PCL control codes start with <ESC>
0 \033 reject no pcl available..
# Default entry -- for normal (text) files. MUST BE LAST.
# set two two-column printing
default fpipe enscript -2rj -p-
________________________________________________________________________________and
this one :
________________________________________________________________________________
! /usr/sbin/magicfilter
#
# Magic filter setup file for HP DeskJet 720c
# Save as /etc/magicfilter/dj720c-filter, then
# run magicfilterconfig. Ignore the warning message about
# how to handle text!
#
# This file has been hacked together by gs 10/5/99
# set everything to convert output to PBM using 'pipe' rather than
filter
# then catch pbm files and forward to pbm2ppa for printing
# Note: pbm files have magic number P4; all other anymap files are
# converted to postscript first, then to pbm.
#! /bin/sh
# PostScript
0 %! fpipe /usr/bin/gs -q -dSAFER -dNOPAUSE -r600
-sDEVICE=pbmraw -sPAPERSIZE=a4 -sOutputFile=- -
0 \004%! fpipe /usr/bin/gs -q -dSAFER -dNOPAUSE -r600
-sDEVICE=pbmraw -sPAPERSIZE=a4 -sOutputFile=- -
# PDF
0 %PDF fpipe /usr/bin/gs -q -dSAFER -dNOPAUSE -r600
-sDEVICE=pbmraw -sPAPERSIZE=a4 -sOutputFile=- -
# TeX DVI
0 \367\002 fpipe /usr/bin/dvips -D 300 -R -q -f
# compress'd data
0 \037\235 pipe /bin/gzip -cdq
# packed, gzipped, frozen and SCO LZH data
0 \037\036 pipe /bin/gzip -cdq
0 \037\213 pipe /bin/gzip -cdq
0 \037\236 pipe /bin/gzip -cdq
0 \037\240 pipe /bin/gzip -cdq
# troff documents
0 .\?\?\040 fpipe `/usr/bin/grog -Tps $FILE`
0 .\\\" fpipe `/usr/bin/grog -Tps $FILE`
0 '\\\" fpipe `/usr/bin/grog -Tps $FILE`
0 '.\\\" fpipe `/usr/bin/grog -Tps $FILE`
0 \\\" fpipe `/usr/bin/grog -Tps $FILE`
# 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" reject Cannot print LaserJet 4 ditroff files.
# Portable bit-, grey- and pixmaps
0 P1\n pipe /usr/bin/pnmtops -scale 1000 -dpi 300
2>/dev/null
0 P2\n pipe /usr/bin/pnmtops -scale 1000 -dpi 300
2>/dev/null
0 P3\n pipe /usr/bin/pnmtops -scale 1000 -dpi 300
2>/dev/null
0 P4\n filter /usr/local/bin/pbm2ppa -s a4 - -
0 P5\n pipe /usr/bin/pnmtops -scale 1000 -dpi 300
2>/dev/null
0 P6\n pipe /usr/bin/pnmtops -scale 1000 -dpi 300
2>/dev/null
# HP Printer Control Language (PCL) -- assume start with reset code
0 \033E\033 reject sniff This printer can't handle PCL
# HP Printer Job Language (PJL)
0 \033%-12345X reject Cannot print PJL files on this printer.
0 "@PJL " reject Cannot print PJL files on this printer.
0 @PJL\t reject Cannot print PJL files on this printer.
0 @PJL\r reject Cannot print PJL files on this printer.
0 @PJL\n reject Cannot print PJL files on this printer.
# GIF files
0 GIF87a pipe /usr/bin/giftopnm 2>/dev/null
0 GIF89a pipe /usr/bin/giftopnm 2>/dev/null
# JFIF (JPEG) files
0 \377\330\377\340\?\?JFIF\0 pipe /usr/bin/djpeg -pnm
# TIFF files (the last two bytes of the "magic" is really a version
number;
# but the magic is really lame and as far as I have understood the
version
# number has never changed and never will, so we include it.)
0 MM\0\x2a fpipe /usr/bin/tiff2ps $FILE
0 II\x2a\0 fpipe /usr/bin/tiff2ps $FILE
# BMP files (even lousier magic -- Microsoft strikes again!)
0 BM\?\?\?\?\?\?\?\?\?\?\?\?\x0c pipe \
/usr/bin/bmptoppm 2>/dev/null
0 BM\?\?\?\?\?\?\?\?\?\?\?\?\x40 pipe \
/usr/bin/bmptoppm 2>/dev/null
0 BM\?\?\?\?\?\?\?\?\?\?\?\?\x28 pipe \
/usr/bin/bmptoppm 2>/dev/null
# Sun rasterfiles
0 \x59\xa6\x6a\x95 pipe /usr/bin/rasttopnm 2>/dev/null
# SGI Imagelib (IRIS RGB) files
0 \x1\xda pipe /usr/bin/sgitopnm 2>/dev/null
0 \xda\x1 pipe /usr/bin/sgitopnm 2>/dev/null
# FIG files; reported by Steven P. Hill <sph@uscbu.ih.att.com>
0 #FIG pipe /usr/bin/X11/fig2dev -Lps -P -l dummy
#
# 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.
# optimistic troff magic
0 . fpipe `/usr/bin/grog -Tps $FILE`
# wacko troff magic
0 ''' fpipe `/usr/bin/grog -Tps $FILE`
# wild guess: PCL control codes start with <ESC>
0 \033 reject no pcl available..
# Default entry -- for normal (text) files. MUST BE LAST.
# set two two-column printing
default fpipe enscript -2rj -p-
________________________________________________________________________________
and I get this error when using lpr/lpd:
)
Jun 22 18:47:10 cc996881-a lpd[964]: cannot execv
/etc/magicfilter/dj722c-filter
Jun 22 18:47:10 cc996881-a lpd[963]: lp: job could not be printed
(cfA003AA1huie
)
and this one using lprng:
cc996881-a:/var/spool/lpd/lp# less status.lp
server starting at 19:39:09
printing 'root@cc996881-a+586', start, attempt 1 at 19:39:09
opening '/dev/lp0' at 19:39:09, attempt 1, timeout 10, grace 0 at
19:39:09
accounting at start 'root@cc996881-a+586' at 19:39:09
printing 'root@cc996881-a+586', file 1 'alphabet.ps', size 1455, format
'f' at 1
9:39:09
printed 50 percent of 1455 bytes of alphabet.ps at 19:39:09
printed 100 percent of 1455 bytes of alphabet.ps at 19:39:09
printed all 1455 bytes at 19:39:09
if filter died with status 33 'JABORT' at 19:39:09
subserver status 'JABORT' for 'root@cc996881-a+586' if filter died with
status 3
3 'JABORT', at 19:39:09 at 19:39:09
job 'root@cc996881-a+586' error 'if filter died with status 33 'JABORT',
at 19:3
9:09' at 19:39:09
removing job 'root@cc996881-a+586' at 19:39:09
server finished at 19:39:09
Of course, nothing prints.
The filters are mod 755 and present in the dir.
I'm using potato with magicfilter v 1.2.
Does anybody have any ideas what am I doing wrong ?
TIA
--
D.Damian
Reply to: