In this chapter, we'll look at some aspects of using printers with FreeBSD. As a user, you don't access printers directly. Instead, a series of processes, collectively called the spooler, manage print data. One process, lpr, writes user print data to disk, and another, lpd, copies the print data to the printers. This method enables processes to write print data even if the printers are busy and ensures
In this section, we'll look briefly at what you need to do to set up printers. For more details, look in the online
lpd is the central
Through a
This may sound like
There are three commonly used ways to connect a printer to a computer:
It's pretty straightforward to connect a
Configuring an Ethernet-connected printer is more complicated. You obviously need an IP address, which you configure on the printer. Most modern printers then appear like a
When you have connected and powered on a
# lptest > /dev/lpt0
If you have a pure
The next step is to configure the central
lp|lj|ps|local LaserJet 6MP printer:\ :lp=/dev/lpt0:sd=/var/spool/output/lpd:lf=/var/log/lpd-errs:sh:mx#0:\ :if=/usr/local/libexec/lpfilter: rlp|sample remote printer:\ :rm=freebie:sd=/var/spool/output/freebie:lf=/var/log/lpd-errs:\ :rp=lp:
Let's look at this in detail:
:).\). Note particularly that you require a colon at the end of a continued line, and another at the beginning of the following line.|. By tradition, the last name is a more verbose description, and you wouldn't normally use it to talk to programs.=, and if it takes a numeric value, the delimiter is #. You'll find a full description in the man page.lp, lj, ps and local LaserJet 6MP printer. Why so many names? lp is the default, so you should have it somewhere. lj is frequently used to talk to printers that understand HP's LaserJet language (now ps might be used to talk to a printer that understands PostScript. The final name is more of a description.lp=/dev/lpt0 tells the sd tells the lf=/var/log/lpd-errs specifies the name of a file in which to log errors.sh is a flag telling lpd to omit a header page. If you don't have that, every job will be preceded by a descriptor page. In a small environment, this doesn't make sense and is just a waste of paper.mx tells lpd the maximum size of a spool job in mx to 0.if tells lpd to apply a filter to the job before printing. We'll look at this below.rm=freebie tells lpd to send the data to the machine called freebie. This could be a fully qualified domain name, of course.rp=lp tells lpd the name of the printer on the remote machine. This doesn't have to be the same name as the name on the local machine.In a network, you don't need to have a printer on every machine; you can print on another machine (which may be a printer) on the same network. There are a couple of things to consider:
rm capability, and you specify the name of the printer with the rp capability. You don't specify any lp (device name) capability. A typical entry might look like this:
lp|HP LaserJet 6MP on freebie:\ :rm=freebie:sd=/var/spool/output/freebie:lf=/var/log/lpd-errs:mx#0:
rp entry, of course.Probably the least intelligible entry in the
What does it do that for? There can be a number of reasons. Maybe you have data in a format that isn't fit to print. For example, it might be PostScript, and your printer might not understand PostScript. Or it could be the other way around: your printer understands only PostScript, and the input isn't PostScript.
There's a more likely reason to require a filter, though: most printers still emulate the old teletypes, so they require a
$ ps PID TT STAT TIME COMMAND 2252 pi Ss 0:01.35 /bin/bash 2287 p1 IW 0:04.77 e/etc/printcap 2346 p1 R+ 0:00.05 ps
When you try to print it, however, you get:
PID TT STAT TIME COMMAND 2252 p1 Ss 0:01.35 /bin/bash 2287 p1 IW 0
The rest of the page is empty: you've gone off the right margin. There are a number of ways to solve this problem:
There are a couple of options for the print filter. One of them, taken from the online
#!/bin/sh printf "\033k2G" cat printf "\f" exit 0 exit 2
This approach does not work well with some printers, such as my HP LaserJet 6MP, which can print both PostScript and LaserJet (natural) formats at random. They do this by
In this kind of
As we saw above, the line printer daemon lpd is responsible for printing spooled jobs. By default it isn't started at root, you can start it by name:
# lpd
Normally, however, you will want it to be started automatically when the system starts up. You do this by setting the variable lpd_enable in /etc/rc.conf:
lpd_enable="YES" # Run the line printer daemon
See page 552 for more details of /etc/rc.conf.
You can also add another line referring to the line printer daemon to /etc/rc.conf:
lpd_flags="" # Flags to lpd (if enabled).
You don't normally need this line. See the man page for lpd for details of the fags.
To test the
$ lptest 80 5 | lpr
The results should look like:
!"#$%'()* + ,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_,abcdefghijklmnop "#$%'()* + ,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_,abcdefghijklmnopq #$%'()*+,-./0123456789:;<=>?@ABCDEFGHIJK^OPQRSTUVWXYZ[\]^_,abcdefghijklmnopqr $%'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_,abcdefghijklmnopqrs %'()*+,-./0123456789:;<=>?@ABCDEFGHIJK^OPQRSTUVWXYZ[\]^_,abcdefghijklmnopqrst
Here's a list of the most common problems and how to solve them.
| Problem | Cause |
|---|---|
| The printer prints, but the last page doesn't appear. The status shows that the printer still has data in the buffer. After several minutes, the last page may appear. | Your output data is not ejecting the last page. The printer is configured to either wait for an explicit You have a choice as to what you do about this. Usually you can configure the printer, or you could get the print filter to print a |
| The lines | This is the staircase effect. Refer to page 268 for a couple of solutions. |
| Individual characters or whole sections of text are missing. | This problem occurs almost only on |
| The output contained completely | On a {|}~, this probably means that you have set up the communication parameters in correctly. Check the online |
| The text was legible, but it bore no relationship to what you wanted to print. | One possibility is that you are sending PostScript output to your printer. See the discussion on page 271 to check if it is PostScript. If it is, your printer is not interpreting it correctly, either because it doesn't understand PostScript, or because it has been confused (see the discussion on page 268 for one reason). |
| The display on the printer shows that data are arriving, but the printer doesn't print anything. | You might be sending normal text to a Alternatively, your # lptcontrol -p |
You get the message lpr: cannot create freebie/.seq | You have forgotten to create the spool directory /var/spool/output/freebie. |
Using the
# ps waux > /dev/lpt0 $ ps waux | lpr
Note the difference in prompt: you have to be root to write directly to the printer, but normally anybody can write to the lpq program:
$ lpq waiting for lp to become ready (offline ?) Rank Owner Job Files Total Size 1st grog 313 (standard input) 9151 bytes 2nd grog 30 (standard input) 3319m bytes 3rd Yvonne 31 (standard input) 3395 bytes 4th root 0 (standard input) 2611 bytes
The first line is a warning that lpd can't currently print. Take it seriously. In this example, the printer was deliberately turned off so that the queue did not change from one example to the next.
Normally, the job numbers increase sequentially: this particular example came from three different machines. You can get more detail with the -l option:
$ lpq -l waiting for lp to become ready (offline ?) grog: 1st [job 313freebie.example.org] (standard input) 9151 bytes grog: 2nd [job 030presto.example.org] (standard input) 3319 bytes yvonne: 3rd [job 031presto.example.org] (standard input) 3395 bytes root: 4th [job 000bumble.example.org] (standard input) 2611 bytes
Sometimes you may want to delete spool output without printing it. You don't need to do this because of a printer configuration error: just turn the printer off, fix the configuration error, and turn the printer on again. The job should then be printed correctly. But if you discover that the
lprm 30 dfA030presto.example.org dequeued cfA030presto.example.org dequeued lpq waiting for lp to become ready (offline ?) Rank Owner Job Files Total Size 1st grog 313 (standard input) 9151 bytes 2nd yvonne 31 (standard input) 3395 bytes 3rd root 0 (standard input) 2611 bytes
If the printer is offline, it may take some time for the lprm to complete.
We've encountered the term PostScript several times already. It's a Page Description Language. With it, you can transmit detailed documents such as this book electronically and print them out in exactly the same form
Most other document formats describe special print features with escape sequences, special commands that start with a special character. For example, the HP LaserJet and Oxlb) to indicate the beginning of an escape sequence. PostScript uses the opposite approach: unless defined otherwise, the contents of a PostScript file are commands, and the printable data is
%!PS-Adobe-3.0 %%Creator: groff version 1.10 %%CreationDate: Fri Oct 31 18:36:45 1997 %%DocumentNeededResources: font Symbol %%+ font Courier %%+ font Times-Roman %%DocumentSuppliedResources: file images/vipw.ps %%Pages: 32 %%PageOrder: Ascend %%Orientation: Portrait %%EndComments %%BeginProlog
This is the prologue (the beginning) of the PostScript output for this chapter. The prologue of such a program can be several hundred
You can do a number of things with PostScript:
gv, which is in the Ports Collection. We'll look at this option below.gv is part of the instant workstation port that we discussed on page 93. To view a file with gv, simply start it:
$ gv filename
If you don't specify a file name, you get a blank display. You can then open a file window by pressing o, after which you can select files and display them. Figure 15-1 shows the display of a draft version of this page with an overlaid open window at the top right. The Open File window contains a field at the top into which you can type the name of a file. Alternatively, the columns below, with
The window below shows the text of the previous page (roughly) on the right hand side. Instead of Save Marked. You can scroll the image in all directions by selecting the box with the left
The column to the right of these buttons is a list of page numbers. You can select a page number with the middle
(рис 15.1) gv display
If your printer doesn't support PostScript, you can still print some semblance of the intended text with the help of ghostscript. The results are very acceptable with modern
To print on your particular printer, you first need to find a driver for it in ghostscript. In this context, the term driver means some code inside ghostscript that converts the data into something that the printer can print.
We've already seen how to use /etc/printcap. In this case, we'll need an input filter, a script or program that transforms the PostScript data into a form that the printer understands. The entry in /etc/printcap is pretty much the same for all printers:
ps|HP Office Jet 725 with PostScript:\ :lp=/dev/lpt0:sd=/var/spool/output/colour:lf=/var/log/lpd-errs:sh:mx#0:\ :if=/usr/local/libexec/psfilter:
This entry defines a printer called ps. The comment states that it's an HP Office Jet, but that's only a comment. Obviously you should choose a comment that matches the printer you really have.
The printer is connected to /dev/lpt0,the first
The important entry is in the last line, which refers to the input filter /usr/local/libexec/ps-filter. This file contains the instructions to convert the PostScript into something that the printer can understand. For example, for the HP Office Jet we're talking about here, it contains:
#!/bin/sh /usr/local/bin/gs -sDEVICE=pcl3 -q -sPaperSize=a4 -dNOPAUSE -sOutputFile=- -
These options state:
-q means guiet. Normally ghostscript outputs a message on startup, and it often outputs other informative messages as well. In this case, we're using it as a filter, so we don't want any output except what we print.- by itself tells ghostscript that the input is from stdin. Together with the output to stdout, this makes ghostscript function as a filter.The previous example used the driver for the HP DeskJet. Well, to be more precise, it used one of a plethora of drivers available. You can find more information in the HTML driver documentation at /usr/local/share/ghostscript/7.05/doc/Devices.htm. The 7.05 in the name refers to the release of ghostscript, which will change.
The documentation isn't the easiest to read. It's probably older than your printer, so there's a good chance that it won't mention your specific printer model. You may need to experiment a little before you get things working the way you want.
There are at least six sets of drivers for HP DeskJets. They're all described in Devices.htm, but the following summary may help:
If you're using a DeskJet, you have the choice. Unfortunately, there's no way to know which is best until you've tried them all. Similar considerations apply to other makes of printer.
The uniprint drivers have a somewhat different kind of interface. They're described towards the end of the same Devices.htm file. To use them, change the driver specification as in the following example, that refers to an Epson
#!/bin/sh /usr/local/bin/gs @stc500ph.upp -q -sPaperSize=a4 -dNOPAUSE -sOutputFile=- - -c quit
The differences here are:
-c quit). The exact meaning is not documented, though it's easy to guess.Another problem you might encounter is that it's possible to specify the drivers you want in your ghostscript executable when you build the port. It's quite possible that the drivers described in Devices.htm don't exist on your system. To find out, run ghostscript interactively with the -h (help) option:
$ gs -h
GNU Ghostscript 7.05 (2002-04-22)
Copyright (C) 2002 artofcode LLC, Benicia, CA. All rights reserved.
Usage: gs [switches] [file1.ps file2.ps ...]
Most frequently used switches: (you can use # in place of =)
-dNOPAUSE no pause after page -q 'quiet', fewer messages
-g<width>x<height> page size in pixels -r<res> pixels/inch resolution
-sDEVICE=<devname> select device -dBATCH exit after last file
-sOutputFile=<file> select output file: - for stdout, |command for pipe,
embed %d or %ld for page #
Input formats: PostScript PostScriptLevell PostScriptLevel2 PDF Available devices:
x11 x11alpha x11cmyk x11gray2 x11gray4 x11mono x11rg16x x11rg32x md2k
md5k md50Mono md50Eco md1xMono bj10e bj10v bj10vh bj200 bjc600 bjc800
lips2p lips3 lips4 bjc880j lips4v uniprint dmprt epag escpage lp2000
alc8600 alc8500 alc2000 alc4000 lp8800c lp8300c lp8500c lp3000c lp8200c
lp8000c epl5900 epl5800 epl2050 epl2050p epl2120 lp7500 lp2400 lp2200
lp9400 lp8900 lp8700 lp8100 lp7700 lp8600f lp8400f lp8300f lp1900
lp9600s
lp9300 lp9600 lp8600 lp1800 mjc180 mjc360 mjc720 mj500c deskjet djet500
cdeskjet cdjcolor cdjmono cdj550 cdj670 cdj850 cdj880 cdj890 cdj1600
cdj970 laserjet ljetplus ljet2p ljet3 ljet3d ljet4 ljet4d cljet5
cljet5c cljet5pr lj5mono lj5gray pj pjxl pjxl300 pxlmono pxlcolor pcl3 hpdj ijs
npdl rpdl gdi bmpmono bmpgray bmp16 bmp256 bmp16m bmp32b bmpsep1 bmpsep8
faxg3 faxg32d faxg4 jpeg jpeggray pcxmono pcxgray pcx16 pcx256 pcx24b
pcxcmyk pdfwrite bit bitrgb bitcmyk pbm pbmraw pgm pgmraw pgnm pgnmraw pnm
pnmraw ppm ppmraw pkm pkmraw pksm pksmraw pngmono pnggray png16
png256 png16m psmono psgray psrgb pswrite epswrite tiffcrle tiffg3
tiffg32d tiffg4 tiff12nc tiff24nc tifflzw tiffpack nullpage
Search path:
. : /opt/lib/ghostscript : /opt/lib/ghostscript/fonts :
/opt/lib/ghostscript/garamond : /usr/local/share/ghostscript/7.05/lib :
/usr/local/share/ghostscript/fonts
For more information, see /usr/local/share/ghostscript/7.05/doc/Use.htm.
Report bugs to bug-gs@ghostscript.com, using the form in Bug-form.htm.
PDF, or Portable Document Format, is a newer format for transferring print documents. Like PostScript, it comes from Adobe, and it is becoming increasingly important as a document interchange format on the Internet.
There are two ways to handle PDF:
Un like PostScript, an editor is available for PDF (Acrobat, the big brother of Acrobat Reader). Unfortunately, it's proprietary and not free, and worse still, it's not available for FreeBSD.
Для получения официальных документов о завершении программы дополнительного профессионального образования (удостоверения о повышении квалификации, дипломов о профессиональной переподготовке и MBA) необходимо предоставить:
Внимание! Вы можете не заказывать доставку бумажной версии официального документы, а скачать его в электронном виде и распечатать самостоятельно. Информация о выданном документе в течение 1 месяца загружается в Федеральную информационную систему «Федеральный реестр сведений о документах об образовании и (или) о квалификации, документах об обучении» - ФИС ФРДО.
Доступ на новый сайт осуществляется с использованием адреса электронной почты, который был указан вами при регистрации на "старом". Мы постарались перенести все ваши данные с прежнего ресурса, однако не исключена вероятность потери части информации.
При возникновении проблемы со входом, воспользуйтесь функцией сброса пароля
Если вы обнаружите несоответствия, пожалуйста, сообщите нам.