Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^2: Raw Data to Printer on Win XP

by dvergin (Monsignor)
on Sep 29, 2004 at 22:16 UTC ( [id://395152]=note: print w/replies, xml ) Need Help??


in reply to Re: Raw Data to Printer on Win XP
in thread Raw Data to Printer on Win XP

Well, yes. I had thought of that (or something similar). But:
     >net use LPT1:
     System error 2 has occurred.

     The system cannot find the file specified.
And besides, the printer is not on the network. It's attached to USB002 on my laptop (which, to my frustration, lacks a parallel port). I had figured to use MODE to redirect LPT1 to USB002. But I could not make it work. Here's a MODE status request as an example of at least part of the problem:
     >mode LPT1: /status
     Illegal device name - LPT1
It would be great if I could activate LPT1 and then redirect it to point at USB002. Any clues?

Replies are listed 'Best First'.
Re^3: Raw Data to Printer on Win XP
by BrowserUk (Patriarch) on Sep 29, 2004 at 22:32 UTC

    Does your usb device show up as a COMn: port if you do just issue the "mode" command alone?

    If so, you can redirect LPT to it using

    Redirect printing: MODE LPTn[:]=COMm[:]

    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "Think for yourself!" - Abigail
    "Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon
      >mode
      
      Status for device CON:
      ----------------------
          Lines:          300
          Columns:        80
          Keyboard rate:  31
          Keyboard delay: 1
          Code page:      437
      
      That's it. So I guess the answer to your question is 'No'. Is there a way to configure the USB port to appear that way?

        I think the answer is "Yes", but I don't have a usb printer (or any printer mine--died recently), with which to try this out, and I can't persuade the appropriate dialogs to pop up without one.

        The secret is to go into the printer configuration from Settings->Printers and Faxes. "Add a printer" if you haven't already done so. In that dialog (going on memory now) somewhere, there is an option to specify what device (LPTnn:) or COMnn:) you wish this printer to be known as.

        Assuming that you can find and successfully configure this, then printing a file should be as easy as copying it to the configured device.

        Sorry this is so vague. Good luck.


        Examine what is said, not who speaks.
        "Efficiency is intelligent laziness." -David Dunham
        "Think for yourself!" - Abigail
        "Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon
      i was of the understanding that usb printer drivers communication is different than on parallel, so i don't think it will work -- otherwise you can create any port you like in the windows printer control panel. and if the MODE thing doesn't work for you, there's a win32 port re-director called "redmon". If redirecting from lpt1 to usb works for you, please let us know.

        As I said, I don't have a usb printer, so I cannot test he theory. However, I belive that usb printers are basically serial printers eg. COMn:-like. I do know that you can redirect LPT1 to COMn:

        P:\test>mode /status Status for device LPT1: ----------------------- Printer output is not being rerouted. Status for device COM1: ----------------------- Baud: 1200 Parity: None Data Bits: 7 Stop Bits: 1 Timeout: OFF XON/XOFF: OFF CTS handshaking: OFF DSR handshaking: OFF DSR sensitivity: OFF DTR circuit: ON RTS circuit: ON P:\test>mode /status Status for device LPT1: ----------------------- Printer output is being rerouted to serial port COM1 Status for device COM1: ----------------------- Baud: 1200 Parity: None Data Bits: 7 Stop Bits: 1 Timeout: OFF XON/XOFF: OFF CTS handshaking: OFF DSR handshaking: OFF DSR sensitivity: OFF DTR circuit: ON RTS circuit: ON

        So, if usb are (or present themselves to the system as) serial ports, then it is entirely possible to re-route LPT1 to a usb printer.

        The OP chose to set his usb printer to masquarade as LPT1 directly. Personally I would have chosen to have it set as a COM1:, then, should I ever attach a second printer to a serial port or another usb, I could set that to COM2: and chose which of the two my CLI apps wrote to by using the MODE command above.

        I've had this set up on networked systems with half a dozen different local and network printers and it make life quite convenient.


        Examine what is said, not who speaks.
        "Efficiency is intelligent laziness." -David Dunham
        "Think for yourself!" - Abigail
        "Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon
Re^3: Raw Data to Printer on Win XP
by terra incognita (Pilgrim) on Sep 29, 2004 at 22:56 UTC
    mode /LPT1: /status should have been successful. On my system is replies that LPT1 is not redirected. Can you print at all (outside of Perl) from the CMD prompt? There have been issues in teh past with USB printing from the cmd line. If that is an issue you may have to update your drivers.
    HTH
      Viz:
           >print temp.txt
           Unable to initialize device PRN
      
      Also, Control-P (am I remembering correctly how to toggle printing of console activity?) doesn't work either. It appears as "^P" and nothing happens. Hit return and you get: "'►' is not recognized as an internal or external command, operable program or batch file."

      Is there any other way to print from the console?

      "you may have to update your drivers". Which drivers? USB?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://395152]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (5)
As of 2024-03-19 11:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found