Announcement

Collapse
No announcement yet.

Printing via the USB port (rather than LPT1)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Printing via the USB port (rather than LPT1)

    In PowerBasic (all versions), to print to the LPT1 port, I use the statement:
    OPEN "LPT1" FOR OUTPUT SHARED AS #5
    to address the port and then
    PRINT #5, "whatever"
    to do the actual printing.

    I have tried to print to the USB port by using the statement:
    OPEN "USB" FOR OUTPUT SHARED AS #5
    to address the port and then
    PRINT #5, "whatever"
    to do the actual printing.

    Nothing happens! Does anyone know the correct statement needed to address the USB port. Almost all of the new printers are using that port rather than the LPT1 port so this is crucial.
    Thanks,
    Michael McMorrow

  • #2
    The short answer is that you can't print directly to a USB printer from DOS, unless the driver or the O/S can capture LPTx and redirect it to the USB port (has anyone seen a USB printer that supports LPTx redirection?).

    Another possible problem is that many USB printers are Windows-Only printers - most of these types of printers do not support DOS printing at all - they rely on the software driver performing all of the work to translate the "page image" into a format that the printer understands - usually this is a bit stream of graphical data in a proprietry protocol. This means that you have to use a Windows program to do your printing...


    The long answer is that it is possible to achieve your goals of printing to USB printers from DOS code, but you have to be running at least Windows 95 for these to work:

    There are a number of possible solutions, but they all involve using a Windows application to handle your printing requirements.

    For example, I have a (personal) product called DOSPRINT that can help with this exact issue without the need to write any Windows code yourself (see www.dosprint.com for more info ).

    However, if you already have or anticipate purchasing PB/CC or PB/DLL, then you can consider writing your own print application from scratch or use Don Dickinson's DDOC library ( DDoc )to make writing the application slightly easier.

    I hope this helps.

    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    Lance
    mailto:[email protected]

    Comment


    • #3
      <font face="Courier New, Courier" size="3"><pre>
      To print using Windows example:
      OPEN FileName$ for OutPut as #Whatever
      Print #Whatever
      Close #Whatever
      Shell "WinPrint " + FileName$ /OPTIONS

      I use "SHELL WinPrint FILENAME /NODIALOG /PRINTERNAME"
      WinPrint processes command line options and passes
      them on to the DDoc engine. This enables writing
      DOS applications without having to write any Windows code.
      WinPrint also handles mailing labels by reading in a
      file if it is in .CSV format.

      If you want a copy of WinPrint mailto:[email protected][email protected]</A>
      It requires DDOC and works great.
      Got your e-mail and have sent you a copy of WinPrint.
      The url requested to ddoc is http://www.basicguru.com/dickinson
      </pre></font>

      ------------------


      [This message has been edited by Mike Doty (edited April 19, 2000).]
      How long is an idea? Write it down.

      Comment

      Working...
      X