print directly on another computer's LPT
-
- Level 2
- Posts: 11
- Joined: Mon Sep 08, 2008 12:53 am
print directly on another computer's LPT
how do i print directly to another computer's LPT port?
printing via GDI is no problem.
i have application that must print directly to LPT ports
on several computers. on local printer, there's no problem,
but i can't access LPT port on another computer.
in windows, i could simply map it to LPT2, and use the LPT2
"net use LPT2: \\servername\printername"
or in my application i could open the network name directly:
handle = fopen("\\servername\printername");
fwrite( handle, buffer, buffersize );
fclose( handle );
is it possibly to do that under wine?
or similiar solution to do that?
printing via GDI is no problem.
i have application that must print directly to LPT ports
on several computers. on local printer, there's no problem,
but i can't access LPT port on another computer.
in windows, i could simply map it to LPT2, and use the LPT2
"net use LPT2: \\servername\printername"
or in my application i could open the network name directly:
handle = fopen("\\servername\printername");
fwrite( handle, buffer, buffersize );
fclose( handle );
is it possibly to do that under wine?
or similiar solution to do that?
Re: print directly on another computer's LPT
No this won't work on Wine.tjandracom wrote:in windows, i could simply map it to LPT2, and use the LPT2
"net use LPT2: \\servername\printername"
or in my application i could open the network name directly:
handle = fopen("\\servername\printername");
fwrite( handle, buffer, buffersize );
fclose( handle );
is it possibly to do that under wine?
or similiar solution to do that?
-
- Level 2
- Posts: 11
- Joined: Mon Sep 08, 2008 12:53 am
thanks for the response.
i recently try:
OpenPrinter( "EpsonLX", &handle, NULL );
WritePrinter( handle, buffer, buffersize );
ClosePrinter( handle );
"EpsonLX" is installed printer connected via smb://servername/printername.
i can get the handle with OpenPrinter() function, but still can't print anything.
i recently try:
OpenPrinter( "EpsonLX", &handle, NULL );
WritePrinter( handle, buffer, buffersize );
ClosePrinter( handle );
"EpsonLX" is installed printer connected via smb://servername/printername.
i can get the handle with OpenPrinter() function, but still can't print anything.
-
- Level 2
- Posts: 11
- Joined: Mon Sep 08, 2008 12:53 am
it works now.
the network (samba) printer must be installed using "Generic - text-only" driver. in my example, i named it "EpsonLX".
in my application i wrote:
DocInfo.pDocName = "whatever";
DocInfo.pOutputFile = NULL;
DocInfo.pDataType = "RAW";
OpenPrinter( "EpsonLX", &handle, NULL );
StartDocPrinter( handle, 1, &DocInfo );
StartPagePrinter( handle );
WritePrinter( handle, buffer, buffersize );
EndPagePrinter( handle );
EndDocPrinter( handle );
ClosePrinter( handle );
still not as fast as windows (needs 15 - 20 seconds to print, while
in windows only took 2 - 3 seconds to print), but it works.
the network (samba) printer must be installed using "Generic - text-only" driver. in my example, i named it "EpsonLX".
in my application i wrote:
DocInfo.pDocName = "whatever";
DocInfo.pOutputFile = NULL;
DocInfo.pDataType = "RAW";
OpenPrinter( "EpsonLX", &handle, NULL );
StartDocPrinter( handle, 1, &DocInfo );
StartPagePrinter( handle );
WritePrinter( handle, buffer, buffersize );
EndPagePrinter( handle );
EndDocPrinter( handle );
ClosePrinter( handle );
still not as fast as windows (needs 15 - 20 seconds to print, while
in windows only took 2 - 3 seconds to print), but it works.
tjandracom that is always going to hurt that way. Reason messages has to go to samba then into a cups interface then to printer.
If it was a USB Printer port I could make it work threw Linux far more effective. http://usbip.sourceforge.net/ There is no printer port over IP I know of other than that. Yes that is direct printer port.
I will be blunt. Linux is designed that raw device access is not normally provided over the network. Theory is that you would create a daemon/service to carry out that location where the device is.
Really please exam your path. 15 - 20 second speed hit is being caused by abusing the Linux stacks.
If it was a normal serial port it would not be hard either servers to deal with that problem exist. http://www.jfc.org.uk/software/conc.html .
You seam to be coding the program to do this job. Why cannot a remote service be used to control the printer port directly.
If it was a USB Printer port I could make it work threw Linux far more effective. http://usbip.sourceforge.net/ There is no printer port over IP I know of other than that. Yes that is direct printer port.
I will be blunt. Linux is designed that raw device access is not normally provided over the network. Theory is that you would create a daemon/service to carry out that location where the device is.
Really please exam your path. 15 - 20 second speed hit is being caused by abusing the Linux stacks.
If it was a normal serial port it would not be hard either servers to deal with that problem exist. http://www.jfc.org.uk/software/conc.html .
You seam to be coding the program to do this job. Why cannot a remote service be used to control the printer port directly.
-
- Level 2
- Posts: 11
- Joined: Mon Sep 08, 2008 12:53 am
all i want to do is to print on another computer's "dot matrix printer" using the printer's font, character by character. if i'm using the linux driver, i will get the graphically translated printing (dot by dot). with graphically printing, all the escape code i've sent to the Epson printer (ESC/P2) will be translated first by the driver and not received by the printer.oiaohm wrote:If it was a USB Printer port I could make it work threw Linux far more effective. http://usbip.sourceforge.net/ There is no printer port over IP I know of other than that. Yes that is direct printer port.
I will be blunt. Linux is designed that raw device access is not normally provided over the network. Theory is that you would create a daemon/service to carry out that location where the device is.
Really please exam your path. 15 - 20 second speed hit is being caused by abusing the Linux stacks.
If it was a normal serial port it would not be hard either servers to deal with that problem exist. http://www.jfc.org.uk/software/conc.html .
any hint to do that? i'm a windows programmer, and relatively new to linux. is it possible to write a windows program and use it as a linux daemon/service through Wine?oiaohm wrote:You seam to be coding the program to do this job. Why cannot a remote service be used to control the printer port directly.
i plan to recoding all my windows application to native linux application, but before i accomplish that, there is Wine.

Wine is not really made for this. It's big and requires too many things. For most programs it will need to create windows which means you'll need to have X session available for the user running daemon.tjandracom wrote:is it possible to write a windows program and use it as a linux daemon/service through Wine?
Ok so we have a service cups that normally handles printers. Direct control of the printer is normally the cups print driver.
You hit the idea of separation. Number 1 sending stuff into a Linux print que normally you talk like generic postscript. So cups does what it should sees escape code and make it printable. The cups printer driver for that printer is to generate the escape codes that go to the printer not the application sending items to the printer. This keeps your application more generic and able to use more different types of printers without issues.
Be aware cups has two major printing modes. printer text and graphics. Printer text uses internal printer fonts where able.
To using internal fonts in most dot matrix printers is just using the right mode and assigning the correct font names. Ie fonts that exist internally in printer.
This case I don't think you need a new service. Just to learn to use the Linux existing services correctly.
http://www.linuxprinting.org/show_print ... er_P6_plus Ok there are quite a few printers dot matix where you have to use the other mode so it prints correctly.
dot by dot only happens in graphics mode.
Case of fighting with the system and wondering why you are having problems.
It might be a case that the cups print driver needs expanding to do what you want.
Altering application output instead of correcting driver might be the correct way under windows but is not the correct way under Linux. Yes you do take a performance hit going the wrong way with Linux.
You hit the idea of separation. Number 1 sending stuff into a Linux print que normally you talk like generic postscript. So cups does what it should sees escape code and make it printable. The cups printer driver for that printer is to generate the escape codes that go to the printer not the application sending items to the printer. This keeps your application more generic and able to use more different types of printers without issues.
Be aware cups has two major printing modes. printer text and graphics. Printer text uses internal printer fonts where able.
To using internal fonts in most dot matrix printers is just using the right mode and assigning the correct font names. Ie fonts that exist internally in printer.
This case I don't think you need a new service. Just to learn to use the Linux existing services correctly.
http://www.linuxprinting.org/show_print ... er_P6_plus Ok there are quite a few printers dot matix where you have to use the other mode so it prints correctly.
dot by dot only happens in graphics mode.
Case of fighting with the system and wondering why you are having problems.
It might be a case that the cups print driver needs expanding to do what you want.
Altering application output instead of correcting driver might be the correct way under windows but is not the correct way under Linux. Yes you do take a performance hit going the wrong way with Linux.
print directly on another computer's LPT
On Sat, Sep 13, 2008 at 3:42 AM, oiaohm <[email protected]> wrote:
Whouldn't LPR work better for dot-matrix printers?Ok so we have a service cups that normally handles printers. Direct control of the printer is normally the cups print driver.
You hit the idea of separation. Number 1 sending stuff into a Linux print que normally you talk like generic postscript. So cups does what it should sees escape code and make it printable. The cups printer driver for that printer is to generate the escape codes that go to the printer not the application sending items to the printer. This keeps your application more generic and able to use more different types of printers without issues.
Be aware cups has two major printing modes. printer text and graphics. Printer text uses internal printer fonts where able.
To using internal fonts in most dot matrix printers is just using the right mode and assigning the correct font names. Ie fonts that exist internally in printer.
This case I don't think you need a new service. Just to learn to use the Linux existing services correctly.
LPR on most Linux systems go to cups Gert van deb Berg.
http://en.wikipedia.org/wiki/Line_Print ... n_protocol
They are not independent. Cups set right for dot-matrix works fine. Really using raw mode has to be though about why. Since raw mode is printer dependant and kinda heavy. Lots of cases after looking at the text driver options its not required.
http://en.wikipedia.org/wiki/Line_Print ... n_protocol
They are not independent. Cups set right for dot-matrix works fine. Really using raw mode has to be though about why. Since raw mode is printer dependant and kinda heavy. Lots of cases after looking at the text driver options its not required.
print directly on another computer's LPT
On Sat, Sep 13, 2008 at 1:15 PM, oiaohm <[email protected]> wrote:
http://www.lprng.com/
Doesn't really seem to offer any real advantages though...
Does Linux support the sharing of devices (in a usable way) in /dev
over the network? (maybe with NFS?) (Without apecial spoftware such as
the ports of parts of plan 9 listed below...)
Something like this might allow that: http://sourceforge.net/projects/v9fs
Gert
I was more thinking along the lines of LPRng or something similar...LPR on most Linux systems go to cups Gert van deb Berg.
http://en.wikipedia.org/wiki/Line_Print ... n_protocol
They are not independent. Cups set right for dot-matrix works fine. Really using raw mode has to be though about why. Since raw mode is printer dependant and kinda heavy. Lots of cases after looking at the text driver options its not required.
http://www.lprng.com/
Doesn't really seem to offer any real advantages though...
Does Linux support the sharing of devices (in a usable way) in /dev
over the network? (maybe with NFS?) (Without apecial spoftware such as
the ports of parts of plan 9 listed below...)
Something like this might allow that: http://sourceforge.net/projects/v9fs
Gert
-
- Level 2
- Posts: 11
- Joined: Mon Sep 08, 2008 12:53 am
in most circumstances i would agree with that. but there are situation that i really need to print raw mode.oiaohm wrote:Really using raw mode has to be though about why. Since raw mode is printer dependant and kinda heavy
my reasons:
1. if used locally, raw mode is very light, because no processing is required. data sent to printer is only as much as the character count plus the escape codes. if it is graphically printing, then the data sent to printer is all the dot resolution.
2. ESC/P escape codes for dot matrix printer is quite a standard in the old world (DOS/Netware/Windows) and there are printers that only understand this escape codes as the formatting codes, such as small printer that is usually seen in cash register, etc.
3. the result of driver translated fonts is mostly not as crisp clear as the built-in printer fonts, especially if using several layer of carbonized paper.
4. draft mode printing in raw mode is extremely fast compared to draft mode printing using the driver.
Yes, i am able to print using text-mode print locally. it is behave as expected. light and fast. the problem is to print on another computer's printer. with samba, i get 15 - 20 seconds hit, but it works. without samba, i don't know how to access other computer's printer.oiaohm wrote:To using internal fonts in most dot matrix printers is just using the right mode and assigning the correct font names. Ie fonts that exist internally in printer.
how to use the lpr command from inside windows application?
-
- Level 2
- Posts: 11
- Joined: Mon Sep 08, 2008 12:53 am
it works for me now.
if i connect to the network printer using IP address instead of computer name, it prints immediately. i guess it is the server name resolving that hit me 15-20 seconds.
eg:
smb://192.168.0.111/EpsonLX
instead of:
smb://MYSERVER/EpsonLX
i know it may not be the best way to do it, but it solved my problem for now. thanks for all the helps and responses.
if i connect to the network printer using IP address instead of computer name, it prints immediately. i guess it is the server name resolving that hit me 15-20 seconds.
eg:
smb://192.168.0.111/EpsonLX
instead of:
smb://MYSERVER/EpsonLX
i know it may not be the best way to do it, but it solved my problem for now. thanks for all the helps and responses.