[Gambas-user] How to sent a line line to a lp1 printer and form to lp0 printer directly.

Doriano Blengino doriano.blengino at ...1909...
Wed Sep 23 12:11:14 CEST 2009


Vassilis K ha scritto:
> I have an 9 pins printer for this job.
>
> If I understood well I have to make a file with the line that I want to print
> then I shall use the SHELL command to send it directly to the printer lp1:
>
> SHELL lp -d lpt2 printfile.ps
>
> I need a small example to get it to work.
> I also need the printer to feed one line per time. Is this possible?
>   
If you printer has a 9 pin DB connector, then it could be a serial printer.
If so, check out its manual, and determine the communication parameters; 
set up the serial port used to communicate to it (within gambas), then 
send every line you want to print to that serial port, followed by a CR 
and a LF: chr$(13) and chr$(10).

Using SHELL and /bin/lp is perhaps more simple but far less versatile 
and very slow (for what it can count speaking about printers...). 
/bin/lp (or /usr/bin/lp) is intended for a higher level usage, and it 
could be difficult to explain to it that you *don't* want to eject a 
page, you *don't* want to print if the printer is off-line, you *don't* 
want a banner and so on.

By sending special characters and/or escape sequences you can take 
advantage of some printer features (may be your printer has a cutter, or 
other equipment). Probably it can do also graphics, barcode and more, 
but this is more difficult.


Regards,
Doriano





More information about the User mailing list