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

Doriano Blengino doriano.blengino at ...1909...
Thu Sep 24 17:40:08 CEST 2009


charlesg ha scritto:
> Hi,
>
> I tried printing line-by-line directly to the raw device and got into awful
> overlapping (? buffering) problems.
>
> I think you would be far better to create a single line text file each time
> and then print it with (for example):
> SHELL "cat /home/charles/tilRcpt>/dev/lp0"
>
> It's blindingly quick and for me is absolutely reliable. As usual, I am sure
> there are more elegent solutions :)
>
> I also had to set write permission to the device in form_open something
> like:
> SHELL "gksu -u root 'chmod a+rw /dev/lp0'"
> Its a pain to have to supply a password, but it only does it once.
>
>   
Beware... I don't know if your overlapping problem is caused by 
buffering (I don't think so), but I am sure that in unix, text line are 
terminated by a single LF (line feed). For the printer, it means to go a 
line down, but not to reposition the printing head to the beginning of 
the line. What you obtain if you fail to do so, is something like this:

line1
     line2
          line3

It depends also on the kind of printer. I am sure that all old impact 
printer do so; the most modern ones, perhaps using postscript directly, 
can behave differently. You must add a CR (carriage return) to correctly 
print lines of text on an impact printer.

Regards,
Doriano





More information about the User mailing list