Menu

Printing to network printer

2017-02-05
2017-02-05
  • Jim Nealand

    Jim Nealand - 2017-02-05

    I am trying to print to a network printer that is a pure ip printer, i.e. not attached to a workstation. This is a one computer site so no other computers. I have tried naming the printer something simple HPLJ. It is the default printer for this computer. I have tried using the --lpt1=PRINTER: and --lpt1=HPLJ: and --lpt1=PRINTER:HPLJ to no avail. I have shared the printer even though there are no other computers to use the share. I've tried using the same options in the pcbasic.ini file. I am running out of ideas. I am a friend of the owner of the program and data.

    In my own environment with multiple computers I was able to print a report by using a net use lpt1: \dellxps\hplj where I am not running on the dellxps computer, but the user is an elderly friend who manages a personal stamp collection with the program with only a single computer so I have been trying to get this to work using just one computer for him. Got any ideas. The program is started via a batch file.that currently reads as follows:
    "C:\Program Files (x86)\PC-BASIC\pcbasic" -r=jnfdc --lpt1=HPLJ

     

    Last edit: Jim Nealand 2017-02-05
  • Jim Nealand

    Jim Nealand - 2017-02-05

    More info. I was able to get output by using the FILE:output.txt in the batch file. Is there a way to control the name of the output file programatically. If so that may be an even better solution than printing and using so much paper that is really not needed. But there are multiple files that need to be printed / saved. Or could the output be directed to a pdf printer????? Maybe I should try that.

     

    Last edit: Jim Nealand 2017-02-05
  • Rob Hagemans

    Rob Hagemans - 2017-02-06

    HiJim,

    I'm afraid I have little experience with IP printers, but perhaps it works if you specify the full network address? Something like --lpt1=PRINTER:\\dellxps\hplj or whatever Windows shows as the address of the printer. PC-BASIC depends on Notepad and the win32 printing system to find the printer; I think the addressing would be the same as for net use. Can you print to this printer from Notepad?

    Rob

     
  • Jim Nealand

    Jim Nealand - 2017-02-06

    Ho Rob. Tried your suggestion using this line in my batch file
    "C:\Program Files (x86)\PC-BASIC\pcbasic" -r=jnfdc --lpt1=PRINTER:\dellxps\HPLJ
    Still does not work. I can print to that printer all day from every program including notepad as it is the default printer for this computer.

    If I go to a second computer and use the following in the batch file it works perfectly.
    net use lpt1: \DellXPS7\HPLJ
    The HPLJ is a printer share name on the main computer even though it is a network only printer. The owner of the program is a retired guy who can do some programming in basic. I think I will just suggest to him that he change the program to output to files with different names. He can then print the files anytime he really needs a printout. since I don't think he really needs to print the reports out that often, but he buys and sells things from his stamp collection and needs to be able to see the lists of data. Now that I can run the program on his Win 10 desktop, I hope he will be able just do some tweaking to the program and solve his problem. btw the program was originally written in 1988. I'm just an old retired computer guy who has not looked at basic in probably 40 years and trying to help out. Thanks for creating PC-Basic, looks like it really solves problems for those who cling to their old programs.

     
  • Rob Hagemans

    Rob Hagemans - 2017-02-07

    I'm afraid I have no idea why it does not work. All PC-BASIC does is call the Windows shell with a printto command on a text file, which should normally use notepad.exe to print a text file. Apparently that doesn't work with your network printer - no idea why. Perhaps the file associations of text files throw a spanner in the works somehow? You could try setting up a log file (--logfile=log.txt) and see if any messages show up.

    Alternatives would be to generate a new file name in your batch file and set that as the lpt1 target, or install a PDF printer locally (there's a number of free ones around); or indeed modify the code to print to file directly.

    Rob

     
  • Jim Nealand

    Jim Nealand - 2017-02-20

    more info
    I am now able to print to hardcopy using the command
    net use lpt1: \DellXPS7\HPLJ2055
    It also works if I run the following
    "C:\Program Files (x86)\PC-BASIC\pcbasic" -r=jnfdc --lpt1=PRINTER:\DellXPS7\HPLJ2055
    two problems I had in my prior testing - I missed the 7 in the computer name and the program requires a capital Y to the question "Hardcopy Y/N ?" or it assumes a no response.
    However the file does not print until the program ends. How can I force printing to occur without ending the program. I appreciate the help. The gentleman who owns the program is finally out of the hosptial and got back home yesterday. I will be showing him PCBasic and how to do what I have learned tomorrow afternoon.

     
  • Jim Nealand

    Jim Nealand - 2017-02-20

    LOL I was reviewing the prior posts and notice that in the 4th post my two examples clearly show the missing 7 in the computer name of one example, but not the other. It is always the little things that get us.

     
  • Rob Hagemans

    Rob Hagemans - 2017-02-21

    Hi Jim, good to know this is largely solved.

    To get it to print before closing PC-BASIC, try to set ----print-trigger=page which will send a document to the printer after every page break (form feed). If you're using an old-fashioned continuous-form (tractor-feed) printer, you could also set --print-trigger=line but be aware that on a modern printer this will print each line on a separate page!

     
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.