[Gambas-user] One line printing to a /dev/lp0 printer from local network

Doriano Blengino doriano.blengino at ...1909...
Wed Mar 17 07:28:16 CET 2010


Vassilis K ha scritto:
> Some months ago Doriano suggested the code for the printing of 1 line on
> a parallel printer which is the following:
>
> PUBLIC SUB bEktiposi_Click()
>         DIM hPrinter AS File
>         hPrinter = OPEN "/dev/lp0" FOR OUTPUT
>         hPrinter.EndOfLine = gb.Windows
>         PRINT #hPrinter, "test a line: "
>         CLOSE hPrinter
> END
> (I had to add the lp group to the user vassilis)
>
> I'm looking for the code for the printing of the same line from a PC in the local network.
> I've tried:
>
> PUBLIC SUB bEktiposi_Click()
>         DIM hPrinter AS File
>         hPrinter = OPEN "vassilis at ...2394.../dev/lp0" FOR OUTPUT
>         hPrinter.EndOfLine = gb.Windows
>         PRINT #hPrinter, "test a line: "
>         CLOSE hPrinter
> END
>
> But it says: "Access forbiden"
>
> I've made the printer shared and given to the /dev/lp0 file read - write permissions (for user-group and other)
>   
I don't think that this is possible, in that way. What you are doing now 
is to try to create a file named "lp0" in a directory "dev" in a 
directory "vassilis at ...2394..." in the current directory. A similar 
form (I mean, using file access) could work (I am not sure) by mounting 
the remote files - usually one mounts whole directories. Using either 
Samba or Nfs you should mount the /dev directory of the computer 
192...10 into a local directory, say /mnt/10dev. Then you could try to 
use the file "/mnt/10dev/lp0". I've never seen this method in real 
world, but it could work.

Another way, more common, is to use the traditional print sharing 
mechanisms of unix, lp: on the .10 machine you set up a print server, 
and on the local machine you configure a network printer referring to 
the .10 machine. The same can be done with CUPS. However, in both ways, 
printing is done in a totally different manner, which can be a problem 
for you; both mechanisms work on "documents", not single lines of text: 
it is probably difficult to convince the print manager that you don't 
want a form feed at the end of the printing.

Regards,

-- 
Doriano Blengino

"Listen twice before you speak.
This is why we have two ears, but only one mouth."





More information about the User mailing list