Re: How to print?



On Mon, 2004-01-12 at 01:16, Daniel Miralles García wrote:

(I wish it was any "dos-like" way to print something...

The short answer is "no".

Unlike DOS, Linux & Co. actually have a security infrastructure. Thus,
unless you own (or have write permissions to) /dev/lp0 or
/dev/printers/0, you cannot print to these files.  These would be the
special files to print to in DOS-like fashion.

The only courses of action are to either open up /dev/lp0 or
/dev/printers/0 by setting permissions to 1777 (a security DISASTER) or
installing a print manager such as cups or lprng.  However, this latter
is, in fact, what you call "installing" the printer so, like I said,
there is "no" way to do it without "installing" the printer.

Once the printer is installed, however, you can print simply by calling
system ("lpr /path/to/filename.txt") where filename.txt contains the
text you want to see printed.

To print curves and fancy fonts, you need to learn PostScript.  Then you
create a simple text file called "filename.ps" and fill it with
PostScript code.

Learning PostScript is not difficult.  It's basically a language that
consists of statements like "draw arc here".  I found an excellent
reference at

http://cgm.cs.mcgill.ca/~luc/PSgeneral.html

From that page, you want to download the "Red Book", the "Green Book"
and the "Blue Book".  These are PostScript references issued by Adobe
themselves.  They are quite detailed and easy to read, with lots of
examples.

Printing a postscript document is the same as printing a text document:
system ("lpr filename.ps") .

HTH




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]