17
Lecture 8 Configuring a Printer- using Magic Filter Introduction to IP Addressing

Lecture 8 Configuring a Printer-using Magic Filter Introduction to IP Addressing

Embed Size (px)

Citation preview

Page 1: Lecture 8 Configuring a Printer-using Magic Filter Introduction to IP Addressing

Lecture 8

•Configuring a Printer-using Magic Filter

•Introduction to IP Addressing

Page 2: Lecture 8 Configuring a Printer-using Magic Filter Introduction to IP Addressing

Topics to be covered To know how the printing process

works in Linux/Unix based system Configuring Magic filter Networking in Linux

Page 3: Lecture 8 Configuring a Printer-using Magic Filter Introduction to IP Addressing

Printing Under Linux Printer device connected to parallel port is known

as /dev/lpx where x can be 0,1 or 2 Print command –lpr [options] filename The printer daemon lpd always check a directory to

see whether any file is there for printing,called spooler directory. Each printer has its own area under this directory to spool data in. For my canon printer, I have a /var/spool/lpd/canon directory.

The printer spool directories should belong to the daemon group and are both user and group read/writable, and world -readable. That is, the directory has to have permissions of -rwxrwxr-x (0775).

Page 4: Lecture 8 Configuring a Printer-using Magic Filter Introduction to IP Addressing

Printing Under Linux When we issue a print command or

when lpr is executed, it first copies the specified file to the spool directory.

Once lpd is told that there is a file to print, it will spawn a copy of itself (what we programmers call forking). This copy will print our file while the original copy waits for more requests. This allows for multiple jobs to be queued at once.

Page 5: Lecture 8 Configuring a Printer-using Magic Filter Introduction to IP Addressing

Printing Under Linux lpr command options

-Pprinter instructs to use printer(default is lp) -s is used to creates a symbolic link instead of

copying the file to the spool directory (useful for large files)

-#num specifies the number of copies to print Example

lpr -#2 -sP dj thesis.txt This command will create a symbolic link to the file thesis.txt in the spool directory for the printer named dj, where it would be processed by lpd. It would then print a second copy of thesis.txt.

Page 6: Lecture 8 Configuring a Printer-using Magic Filter Introduction to IP Addressing

Why and What is a filter?As for what printers do work with Linux,

the best choice is to buy a printer with native PostScript support. Nearly all Unix software that produces printable output produces it in PostScript, so obviously it'd be nice to get a printer that supports PostScript directly. Unfortunately, PostScript support is scarce outside the laser printer domain, and is sometimes a costly add-on.

Page 7: Lecture 8 Configuring a Printer-using Magic Filter Introduction to IP Addressing

Why and What is a filter? Failing the (larger) budget necessary

to buy a Postscript printer, you can use any printer supported by Ghostscript, the free Postscript interpreter used in lieu of actual printer Postscript support.

It would take the Postscript format and convert it to the corresponding printer understandable output.

Page 8: Lecture 8 Configuring a Printer-using Magic Filter Introduction to IP Addressing

So, What is the problem? We only can print postscript directly with the

help of ghostscript and what about other types (.bmp, .jpeg, .pdf) ?

For these, we have to first convert the file to .ps with appropriate program and then use ghostscript to print the resulting .ps file.

Would not it be great if one could handle all these things, the solution is magic filter(e.g

Apsfilter)

Page 9: Lecture 8 Configuring a Printer-using Magic Filter Introduction to IP Addressing

The /etc/printcap file lp: Specifies the device to print to, such

as /dev/lp0 (empty for remote printer) sd: Specifies the name of the spool

directory for this printer if : Specifies the input filter name rm: Specifies the name of a remote

printing host rp: Specifies the name of a remote

printer

Page 10: Lecture 8 Configuring a Printer-using Magic Filter Introduction to IP Addressing

Apsfilter-IntroductionWhat is Apsfilter? Apsfilter is an input filter suitable for

most of the printer spoolers found on many UNIX-like operating systems.

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

Page 11: Lecture 8 Configuring a Printer-using Magic Filter Introduction to IP Addressing

How Apsfilter Works?lpr submits a file to

the spooler directory for

printing

Use appropriate program to convert it to PostScript(.ps) format

Determine the file type

(e.g bmp, pdf etc.)

Call ghostscript that interprets this .ps format and produces the printer

understandable outputs

lpd executes the appropriate filter as specified in the if attribute in /etc/printcap file

1

5

43

2

Page 12: Lecture 8 Configuring a Printer-using Magic Filter Introduction to IP Addressing

Installation Step1

Download the source distribution available at http://www.apsfilter.org

Step2 Stop the lpd daemon by service lpd stop

command Step3

gzip –dc /path/to/apsfilter-7.2.2.tar.gz |tar –xvf –

cd apsfilter ./configure make install

Page 13: Lecture 8 Configuring a Printer-using Magic Filter Introduction to IP Addressing

Installation, Contd. Step 4

There is a shell script called SETUP in the installation directory, start it.

Skip the initial screens Step 5 (Available driver)

To see which drivers are known to gs, and also which version you are using, enter d at the prompt.

Step 6 (Selecting appropriate driver) You will be presented a list of printer models,

preceded by a number. Just enter this number at the prompt.

Page 14: Lecture 8 Configuring a Printer-using Magic Filter Introduction to IP Addressing

Installation,Contd. Step 7 (Choosing Interface)

For Parallel or USB connection we can choose the full path of device node.

Step 8 (Paper format) We can choose A4

Step 9 (Print quality and color mode) We can choose “medium” and “full

color”

Page 15: Lecture 8 Configuring a Printer-using Magic Filter Introduction to IP Addressing

Installation, Contd. Step 10 (Printing Method)

For most cases, the printing method will be set to the default value "auto"; this will cause apsfilter to check the type of any input file and convert it to the correct printer language automatically.

Page 16: Lecture 8 Configuring a Printer-using Magic Filter Introduction to IP Addressing

Installation, Contd. Step 11 (Test page)

To test the current settings, you can send a test page to the printer.

Step 12 (Installation) If you think all settings are correct, you can

install the printer; this will create an entry in /etc/printcap, add the spool directories and put one or more configuration files into the queue configuration directory.

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.

Page 17: Lecture 8 Configuring a Printer-using Magic Filter Introduction to IP Addressing

Installation,Contd. Step 13 (Finishing setup)

Quit the program and restart the lpd daemon by /etc/rc.d/init.d/lpd restart.

Now try to print the files with lpr filename command.