• Print to Lpt1(prn) from DOS progam

    Author
    Topic
    #495083

    I have an old dos program which only prints to the prn (lpt1) port. Please save the comments regarding upgrading the program, etc. I have not found an alternative and up until this point I have managed to make everything work.

    The problem pc does not have a lpt port. I have used the net use lpt1 \serverprinter command to redirect the output and everything seems to be functioning.

    When printing, a spool file is created (I can see it and the 0utput looks normal), the file seems to be properly sent to the redirected networks print queue as it shows up in the queue. However, it will never print. It tries and then reports a print error. (the same method works on a different machine).

    Any suggestions in how to trouble shoot this would be appreciated.

    Thanks,

    Viewing 20 reply threads
    Author
    Replies
    • #1455780

      What does the print file look like? Is it purely text, or does it contain formatting, perhaps for a particular printer?

      If pure text, I’d try redirecting the output to a txt file, and then printing it from there (perhaps by loading it into notepad).
      As in DOSprog.exe > D:DOSProgOutput.txt

      I gave up with ‘straight’ DOS printing several years ago, because of similar problems to those you are encountering.

      BATcher

      Plethora means a lot to me.

    • #1455782

      It is almost purely text with a few formatting commands. I just tried printing with no formatting and the same problem pops up. I can also change the printer it is directed to and no matter where it goes, same problem. I tried printing to a cutepdf printer and same thing.

    • #1455783

      I have also had success using the DOS command then open in a word processor program such as Wordpad, Notepad [both come with Windows] or other text program then print but as mentioned a lot will depend upon whether the program can save the print output to a file.

      If the computer is a Desktop you might be able to use an Add-in PCI Printer Port card.
      http://www.tigerdirect.com/applications/category/category_slc.asp?CatId=512

      Before you wonder "Am I doing things right," ask "Am I doing the right things?"
    • #1455796

      If you can print to file you should be able to drop the file into a network print queue.

      cheers, Paul

      • #1455861

        You didn’t specify the operating system your old DOS program is running on.
        Has to be some Windows version (net use …), so you can try vDos: http://sourceforge.net/projects/vdos.
        It goes beyond what you tried and expected until now to get that DOS program running in Windows.
        At least printing shouldn’t be an issue anymore.

    • #1455879

      Thanks, I will take a look at vbox or the referenced dosprinter.exe program. I am running under win XP currently but vbox may help with my hesitation to upgrade to 7 or 8 if it works.

      The programs currently work with the exception of the printing. the printing problems only appear on my laptop. I have a desktop where everything works fine. The odd part is that the spool files are being created and sent to the proper queue, they just refuse to print.

    • #1455894

      Your network printer is connected to another PC and shared from there?
      Have you looked at the render print jobs on client computers option?
      Eventually install the printer driver on the laptop, connect it to the network printer, share it and use that in net use lpt1.

    • #1455923

      Jos – The printer is a network printer but the printer is installed on the laptop and works fine if printing a test page or sending items from later Windows based programs.

      I assume there is a problem with the actual spool file (or instructions in the .shd file.

    • #1455926

      Are you trying to print from the dos application? You could try printing directly from a Command Prompt:

      print /d:\

    • #1455927

      Trying to print directly from the program. Although I have not tried just printing a file from the a dos window using the print command. I do not have the laptop with me at the moment but I will try that tonight.

    • #1455937

      It’s a Windows GUI printer?
      Then you can’t send ASCII output directly to it, it has to be rendered by the printer driver.
      So share the printer on the laptop and use that in net use lpt1.

      • #1457247

        I just discovered this thread, thanks to its listing in a recent Windows Secrets newsletter. Since 1998, I have been working with NET USE and all sorts of printers, with and without corresponding physical ports on the host machine, so I think I know a thing or two about what does and doesn’t work.

        There are quite a few things that can prevent a shared printer from working. The issues that I see most often are as follows.

          [*]File and printer sharing must be enabled on both machines.
          [*]The Windows Firewall on both machines must allow file and printer sharing across the local subnet.
          [*]The machine that hosts the share (the machine named following the double backslash, must allow Everyone to have access to the share. You use the Permissions button to do so.
          [*]Both machines must belong to the same Windows workgroup. This is set on the Properties pages of My Computer. If you change it, you must restart the machine for the change to take effect. This applies as well to the virtual XP machine on your Windows 7 host.
          [*]

        David A. Gray

        Designing for the Ages, One Challenge at a Time

        • #1457251

          Thanks for the reply. The shared printer is a share from the same machine and the jobs are going to the print queue. I think the cause is somewhere else. I have managed to work around it but would still like to know why the spooled jobs refuse to complete the print process.

    • #1455939

      This problem is occurring on several printers which are installed and shared on the laptop.

      I use the command net use lpt1 \serverprinter, the net use command shows all working correctly.

      When I print from the dos program, a spool file is created and sent to the proper printer queue. The problem is it will not print. It always shows a print -error after a short amount of time.

    • #1455958

      One way you could probably print would involve one extra step:

      1) Print to PDF using either Adobe Acrobat, Nitro PDF, or another such program.
      2) Print the resultant PDF file using normal Windows print methods.

      I have found that if you first print to PDF, and then print the PDF file, it is a lot easier to manage and deal with difficult printing issues.

      As a side benefit, you will have a PDF image of your print job, in case you wanted to save a copy of it for some reason. If not, you can delete the PDF after printing it.

      Group "L" (Linux Mint)
      with Windows 10 running in a remote session on my file server
      • #1457265

        Exactly what do you mean by “same machine?” If the share is defined on the Dell, does it show up on the Windows 7 machine when you enter NET SHARE without arguments to display a list of shares? What about in the virtual XP machine?

        David A. Gray

        Designing for the Ages, One Challenge at a Time

    • #1455963

      I have the exact same problem using the cutepdf writer. The installation works fine when printing from windows programs, but when redirecting to this printer the spool files shows up but the job never finishes.

    • #1455994

      I wonder if the OP might be able to set up Oracle VirtualBox with DOS as the OS. He might be able to print straight from the DOS program, without having to jump through any extra hoops.

      Group "L" (Linux Mint)
      with Windows 10 running in a remote session on my file server
      • #1456054

        I wonder if the OP might be able to set up Oracle VirtualBox with DOS as the OS. He might be able to print straight from the DOS program, without having to jump through any extra hoops.

        That’s what he was doing in the first place, but it will only print to a file.

    • #1456041


      Or if nothing else use Print to File (set up as a printer).

      🍻

      Just because you don't know where you are going doesn't mean any road will get you there.
    • #1456065

      Problem will be that the printer is a Windows GUI device.
      Being a physical or virtual printer (like CutePdf), it won’t accept a series of ASCII codes that a DOS program will send to it.
      You need some program like DOSPrinter that converts the stream of ASCII codes (saved to a file) to the format the printer driver will accept.
      Remains a mystery how that DOS program can function/print on the other PC’s.

    • #1456300

      Does your DOS program use LPRINT? Are you able to access the code? You could use QB64 if it is a Qbasic program: http://www.qb64.net/forum/index.php

      Check the Print Processor setting on the computer. The Default Data Type for the listed printer must be Text, NOT LEMF

      If you use other settings for other print work, you will need to change it back to LEMF.

      Redirection may not work with wireless printers.

      • #1456302

        This problem is occurring on several printers which are installed and shared on the laptop.

        I use the command net use lpt1 \serverprinter, the net use command shows all working correctly.

        When I print from the dos program, a spool file is created and sent to the proper printer queue. The problem is it will not print. It always shows a print -error after a short amount of time.

        You CAN’T use a Laptop. 1) There is NO LPT printer port to redirect from.

        Try using a SHELL command in QB to print a file using Notepad or use a batch file to do it.

        • #1456570

          You are correct that there is no LPT printer port. However the net use command does send the job to the print queue. It just refuses to print it.

    • #1456378

      I’m using Win 7 64 bit on a Lenovo G560 with no physical LPT port. It’s networked via router.

      I’m running a WinXP virtual machine inside VirtualBox v 4.3.12

      In the virtual XP, I run dBaseIII+

      I have a Bat file on the XP desktop with the lines:

      net use lpt1: \xxxxdellhplaserj /persistant:yes
      d:
      cd dbase
      dbase

      xxxxdell is a dell D600 laptop running XP natively. The hplaserj is model 1320. It’s connected to the Dell laptop via USB cable. It’s on the same network as the Lenovo.
      (The Dell DOES have a physical lpt port, but I doubt that that matters).

      The primary reason that we have the Dell running is that WIN 7 seems to have no end of problems sharing printers in a mixed environment. (I run XP inside virtual box, Ubuntu natively and virtually, etc.) XP likes to share. Win 7 not so much.

      • #1456408

        The HP 1320 handles PCL coding, so it can be used by DOS programs that support PCL printers.
        Your VirtualBox – WinXP combination is overkill.
        dBaseIII+ should run under vDos, http://sourceforge.net/projects/vdos.
        Starts dBase in a snap, integrates better with the Windows 7 host system and looks nice with a truly scalable font.
        You could also print to any Windows printer.

        Jos

      • #1456410

        Yeah, XP works with DOS if it is 32 bit, just like Windows 7 can. 64 bit eliminates 16 bit programs without NTVDM.

        Sure it matters. Your NET USE command sends the LPT data to the USB printer. You shouldn’t have to run the NET USE command more than once. Did you check the Print Processor data setting?

        Never did say what kind of DOS program you are using. Apparently not QB.

    • #1456423

      Just sharing what works for me. YMMV

    • #1457301

      to Recap:

      I have a machine running XP (lets call it laptop) with no lpt port. I have a network printer (the same behavior problem exists with the cuteftp printer) set up and working fine. The printer is shared as “dellprinter”.

      I have used the command net use lpt1: \laptopdellprinter /persistent:yes

      The net use command shows that the printer is available.

      If I run a dos program from the cmd window, the program runs fine. It is old and only allows printing to the prn (LPT) port. When printing from the program;

      If watching the print queue for dellprinter, the job can be seen spooling then attempting to print, but the print job always ends up with a print error.

      Other jobs printed directly to the printer from windows based programs work fine.

      • #1457434

        To recap:

        You CAN’T use a Laptop. 1) There is NO LPT printer port to redirect from.

        Try using a SHELL command in QB to print a file using Notepad or use a batch file to do it.

        • #1457438

          To recap:

          You CAN’T use a Laptop. 1) There is NO LPT printer port to redirect from.

          Right, most Notebooks/Laptops of the last few years don’t have the Parallel Printer port, the only one I have left with the port is a Panasonic Toughbook CF-29, unfortunately it won’t run any Windows newer than WinXP so will be putting a version of Linux on it soon.

          Before you wonder "Am I doing things right," ask "Am I doing the right things?"
          • #1457495

            Of course a laptop has LPT1/2/3. It just doesn’t have the physical connector, that’s all. And you can easily plug one in if you want.

            I’ve used LPT1 many times on a Win7 laptop, where it wouldn’t install a printer shared on an XP machine. I’ve had to install it as a local printer, change the port to LPT1, and use net use to redirect it. In fact, LPT1 is first choice for that very reason, i.e., it’s not in use. And even if it were, I’d just use LPT2.

    • #1457437

      I realize that there is no lpt port to redirect from. However, you can still use the net use lpt1 “printername”. The redirect does in fact work in the fact that it spools the file and sends the spool file to the print queue. Maybe the fact that no lpt port actually exists has something to do with the fact that the spool won’t print but it DOES send the spool file to the redirected printer.

      • #1457750

        I realize that there is no lpt port to redirect from. However, you can still use the net use lpt1 “printername”. The redirect does in fact work in the fact that it spools the file and sends the spool file to the print queue. Maybe the fact that no lpt port actually exists has something to do with the fact that the spool won’t print but it DOES send the spool file to the redirected printer.

        Therein is probably the crux of the OP’s problem. The print file is spooled, and the printer driver needs to be set to use the spooler. On the Advanced settings page is a pair of linked radio buttons.

          [*]One is marked “Spool print documents so program finishes printing faster.”
          [*]The other button is labeled “Print directly to the printer.”
          [*]

        You must select the first option.

        David A. Gray

        Designing for the Ages, One Challenge at a Time

    Viewing 20 reply threads
    Reply To: Print to Lpt1(prn) from DOS progam

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: