|
|
ru.linux- RU.LINUX --------------------------------------------------------------------- From : Kirill Frolov 2:5030/827.2 22 Sep 2004 00:45:30 To : Sergey Subject : Re: Печать PDF на матричном принтере -------------------------------------------------------------------------------- On Tue, 21 Sep 04 15:33:11 +0400, Sergey wrote: S> Hадо напечатать PDF на матричном принтере EPSON 1170. lpd, magicfilter, ghostscript. S> Как настроить для этого принтер ? Именно принтер? Hу можно отключить загрузку шрифтов, чтобы памяти по-больше было... S> Выбирал в CUPS - 1 прямая очередь печати и 2 принтер S> EPSON 1170. S> В обеих случаях прогоняет лист и ничего не печатает. Откуда я знаю, что там CUPS делает? У меня так: # /etc/printcap: printer capability database. See printcap(5). # You can use the filter entries df, tf, cf, gf etc. for # your own filters. See /etc/filter.ps, /etc/filter.pcl and # the printcap(5) manual page for further details. lp|ps|Post-Script:\ :lp=/dev/lp0:\ :sd=/var/spool/lpd/lq100:\ :sh:pw#80:pl#72:px#2400:mx#0:\ :if=/etc/magicfilter/lq100-filter:\ :af=/var/log/lp-acct:lf=/var/log/lp-errs: lpt|lp-text|Text:\ :lp=/dev/lp0:\ :sd=/var/spool/lpd/lp:\ :af=/var/log/lp-acct:\ :lf=/var/log/lp-errs:\ :pl#66:\ :pw#80:\ :pc#150:\ :mx#0:\ :sh: Здесь создаются пара принтеров, один печатает только текст, а второй пропускает все данные через magicfilter: > (комментарии выделены символом цитирования) #! /usr/sbin/magicfilter # # Magic filter setup file for Epson LQ series printers # THIS FILE IS UNTESTED! # # This file is in the public domain. # # This file has been automatically adapted to your system. # # wild guess: native control codes start with <ESC> 0 \033 cat # PostScript 0 %! filter /usr/local/bin/gs-lpr @lq100.upp -sOutputFile=- -q - 0 \004%! filter /usr/local/bin/gs-lpr @lq100.upp -sOutputFile=- -q - # Wind/U postscript driver. This one creates broken postscript, so we have to # put in a special case to convert it to PCL first 65 "%%Creator: Wind/U" filter /usr/local/bin/gs-lpr @lq100.upp -sOutputFile=- -q - > ^^ Тут оно просто пропускает PostScript файлы через GhostScript, > получая на выходе данные на языке ESC/P2, что и скармливается принтеру # PDF 0 %PDF fpipe /usr/bin/pdftops $FILE - > ^^^ А так печатается PDF. pdftops -- это из комплекта xpdf. # TeX DVI 0 \367\002 fpipe /usr/bin/dvips -D 180 -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 0 BZh pipe /usr/bin/bzip2 -cdq # troff documents 0 .\?\?\040 fpipe `/usr/bin/grog -Tps $FILE` 0 .\?\?\012 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 180 2>/dev/null 0 P2\n pipe /usr/bin/pnmtops -scale 1000 -dpi 180 2>/dev/null 0 P3\n pipe /usr/bin/pnmtops -scale 1000 -dpi 180 2>/dev/null 0 P4\n pipe /usr/bin/pnmtops -scale 1000 -dpi 180 2>/dev/null 0 P5\n pipe /usr/bin/pnmtops -scale 1000 -dpi 180 2>/dev/null 0 P6\n pipe /usr/bin/pnmtops -scale 1000 -dpi 180 2>/dev/null # PNG - Portable network graphics 0 \x89PNG pipe /usr/bin/pngtopnm # HP Printer Control Language (PCL) -- assume start with reset code 0 \033E\033 reject Cannot print PCL files on this printer. # 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 # Bug 40599 0 \377\330\377\341\?\?Exif\0 pipe /usr/bin/djpeg -pnm 6 JFIF 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 -a $FILE 0 II\x2a\0 fpipe /usr/bin/tiff2ps -a $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 # Garbage delivered from Windows via Samba # (donated by Andree Leidenfrost <leidenfrost@dkrz.de>) # 300 \033\052\157 cat # later changed to # (Bug report #22866: magicfilter: Incorrect magic for Win95/Samba print jobs) 0 \000\000\000\000\000 cat # 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/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. # wacko troff magic 0 ''' fpipe `/usr/bin/grog -Tps $FILE` # Default entry -- for normal (text) files. MUST BE LAST. #default text default filter konwert any/ru-cp866 > ^^^ А так обычные текстовые файлы из любой кодировки всегда печатаются > в правильной кодировке, причём шрифтами принтера. Что ещё? /usr/local/bin/gs-lpr -- это обёртка к GhostScrip, которая позволяет ему адекватно реагировать на SIGINT и прекращать печать (чего требует lpd)": #!/bin/sh # GhostScript SIGINT bug workaround function gsint() { kill -HUP %+ } set -m trap gsint SIGINT /usr/bin/gs "$@" <&0 >&1 & wait %+ Принтер у меня Epson LQ-100+, вот *.upp файл для него (даётся аргументом "@lq100.upp" для GhostScript): -supModel="Epson LQ-100, 180x180dpi" -sPAPERSIZE=a4 -sDEVICE=uniprint -dBATCH -dNOPAUSE -dSAFER -dupColorModel=/DeviceGray -dupRendering=/ErrorDiffusion -dupOutputFormat=/EscP2 -r180x180 -dupMargins="{ 9.0 39.96 9.0 9.0 }" -dupWhiteTransfer="{ 0.30000000 0.25411765 0.20862745 0.18509804 0.16313725 0.14588235 0.12862745 0.11450980 0.10196078 0.09098039 0.08156863 0.07215686 0.06431373 0.05490196 0.04549020 0.03764706 0.02980392 0.02196078 0.01254902 0.00627451 0.00000000 }" -dupOutputComponentOrder="{ 0 }" -dupOutputPins=24 -dupBeginPageCommand="< 1b40 1b40 1b2847 0100 01 1b2855 0100 14 1b2843 0200 0000 1b2863 0400 0000 0000 >" -dupAdjustPageLengthCommand -dupAdjustTopMarginCommand -dupAdjustBottomMarginCommand -dupEndPageCommand="(\033@\014)" -dupEndJobCommand="(\033@)" -dupAbortCommand="(\033@\033k\001\033!\072\015\012\012 --- Printout-Aborted ---\012\012\033@\015)" >>> КОHЕЦ ФАЙЛА. Hу вот вроде и всё. PDF печатается командой "lpr file.pdf". Что ещё? Можно печатать текстовые файлы посредством enscript, конфигурация: # /etc/enscript.cfg: # GNU Enscript configuration file. # Copyright (c) 1995-2000 Markku Rossi. # # Author: Markku Rossi <mtr@iki.fi> # # # # This file is part of GNU enscript. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; see the file COPYING. If not, write to # the Free Software Foundation, 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # # Do we accept PostScript font's composite characters? As a default, # this is false because I think this is GhostScript dependant. AcceptCompositeCharacters: 0 # Lookup path for the AFM files. AFMPath: /usr/share/enscript/afm:/usr/share/fonts/afms:/usr/share/fonts/type1/gsfonts/:/u sr/share/fonts/type1/scalable-cyrfonts/ #/usr/local/lib/ps:/usr/lib/ps # Append ^D character to the end of the output. Some printers like HP # LaserJet 5 require this but the default is `false'. AppendCtrlD: 0 # How characters greater than 127 are printed: # 1 generate clean 7-bit code; print characters greater than 127 # in the backslash-octal notation `\xxx' (default) # 0 generate 8-bit code Clean7Bit: 1 # Default input encoding. DefaultEncoding: koi8 # Default fancy header. DefaultFancyHeader: enscript # Default output media. DefaultMedia: A4lq100 # Where output goes as a default: `printer' or `stdout' DefaultOutputMethod: printer # Include following font files to all PostScript outputs. # # DownloadFont: FooFont1 # DownloadFont: FooFont2 # The escape character for special escapes. EscapeChar: 0 # What to do when a formfeed character is encountered from input: # column move to the beginning of the next column # page move to the beginning of the next page FormFeedType: column # Specify whether the PageSize page device option is generated to the # output. GeneratePageSize: 1 # The gray level which is used to print highlight bars. HighlightBarGray: .97 # How high highlight bars are in lines. The default is 0 so no # highlight bars are printed. # HighlightBars: 2 # Library path. Let's use built-in default. # LibraryPath: # How wrapped lines are marked in printout. Possible values are: `none', # `plus', `box' and `arrow'. As a default, we do not mark them. MarkWrappedLines: none # Media definitions: # name width height llx lly urx ury Media: a3 842 1190 24 24 818 1166 Media: a4 595 842 24 24 571 818 Media: a5 420 595 24 24 396 571 Media: legal 612 1008 24 24 588 984 Media: letter 612 792 38 24 574 768 Media: A4lq100 596 842 24 40 571 818 # HP DeskJet media (DeskJet can't print on the bottom 1/2" of the paper). Media: A4dj 595 842 24 50 571 818 Media: Letterdj 612 792 24 40 588 768 # Spooler option to suppress the job header. NoJobHeaderSwitch: -h # How non-printable characters are printed: `caret', `octal', # `questionmark' or `space'. NonPrintableFormat: octal # PostScript output's first line. OutputFirstLine: %!PS-Adobe-3.0 # Default page label format: `short' or `long'. PageLabelFormat: short # Enable / disable page prefeed. PagePrefeed: 0 # The PostScript language level that enscript should use. PostScriptLevel: 2 # Printer name to spool to. As a default we want to use system's # default printer. # Printer: ps # The spooler command switch to select the printer queue. This option # can also be used to pass other flags to the spooler command but they # must be given bofore the queue switch. QueueParam: -P # Pass following Page Device options to the generated output. # # Duplex printing. # SetPageDevice: Duplex:true # Printer spooler command name. Spooler: lpr # An absolute path to the states program. StatesBinary: /usr/bin/states # Create color outputs with States? StatesColor: 0 # The name of the States configuration file. StatesConfigFile: /usr/share/enscript/hl/enscript.st # States' default highlight style. StatesHighlightStyle: emacs # Path for the States program. # StatesPath: /usr/share/enscript/hl # Pass following statusdict options to the generated output. # # Use always paper tray 1. # StatusDict: setpapertray:1 # Format string for table-of-contents entries. # # TOCFormat: $3v $-40N $3% pages $4L lines $E $C # As a default, print this underlay text to all document. # Underlay: mtr's printout # Underlay text angle. # UnderlayAngle: 45 # Select underlay font. UnderlayFont: Times-Roman200 # Select underlay gray. UnderlayGray: .8 # Underlay text starting position. # UnderlayPosition: +0-0 # Underlay style: `outline' or `filled' UnderlayStyle: outline # EOF Hу и alias для печати русских текстов: alias enscript='enscript -f NimbusMonCYR-Regu12' Вроде, действительно всё. Для печати из Mozilla полезно иметь Fontmap: /Arial /CenturySchCYR-Roma ; /Arial-Bold /CenturySchCYR-Bold ; /Arial-Italic /CenturySchCYR-Ital ; /Arial-BoldItalic /CenturySchCYR-BoldItal ; /Helvetica /NimbusSansCYR-Regu ; /Helvetica-Bold /NimbusSansCYR-Bold ; /Helvetica-Oblique /NimbusSansCYR-ReguItal ; /Helvetica_Oblique /NimbusSansCYR-ReguItal ; /Helvetica-BoldOblique /NimbusSansCYR-BoldItal ; /Times-Roman /NimbusRomanCYR-Regu ; /Times-Italic /NimbusRomanCYR-ReguItal ; /Times-Bold /NimbusRomanCYR-Medi ; /Times-BoldItalic /NimbusRomanCYR-MediItal ; /Courier /NimbusMonCYR-Regu ; /Courier-Oblique /NimbusMonCYR-ReguObli ; /Courier-Bold /NimbusMonCYR-Bold ; /Courier-BoldOblique /NimbusMonCYR-BoldObli ; --- [ZX] * Origin: [ лучше пингвин в руках, чем журавль в облаках ] (2:5030/827.2) Вернуться к списку тем, сортированных по: возрастание даты уменьшение даты тема автор
Архивное /ru.linux/383364dad820.html, оценка из 5, голосов 10
|