Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Printing to my Printer
#10
I too had this issue for an application I wrote that needed to print baseball team statistics on paper so a manager could give them out to his players.

The following works on both Linux and MAC (I don't have a Windows machine, so I can't speak to that).

I first create an output file with what I print, then I SHELL out to enscript. The code looks something like:

Code: (Select All)
cmd = "enscript -B -r -fCourier8 " + ReportFile$
SHELL (cmd)


ReportFile$ is the formatted file I want to print. It prints to my HP Laser printer, or whatever printer I have set as my default printer.

You have to make sure that enscript is installed on your Linux or Mac.

One note for Mac users, and I don't know if this is due to my printer or the way that Mac's version of enscript works, but I had to add 8 spaces to the left side of every line printed, otherwise it doesn't print correctly.

If I recall, I had to use Brew to install enscript on my Mac, as it was removed from the App Store awhile back.

With enscript, you can print in both portrait and landscape mode. I believe the -r parameter tells it to print in landscape.
—————————————————————————————
George McGinn
Theoretical/Applied Computer Science Specialist
Member: IEEE, IEEE Computer Society
               Technical Council on Software Engineering       
               IEEE Standards Association
               Society of American Baseball Research
Reply


Messages In This Thread
Printing to my Printer - by Dimster - 07-12-2022, 03:11 PM
RE: Printing to my Printer - by Pete - 07-12-2022, 05:30 PM
RE: Printing to my Printer - by SierraKen - 07-12-2022, 05:49 PM
RE: Printing to my Printer - by SierraKen - 07-12-2022, 05:50 PM
RE: Printing to my Printer - by bplus - 07-12-2022, 05:53 PM
RE: Printing to my Printer - by Dimster - 07-12-2022, 06:24 PM
RE: Printing to my Printer - by Kernelpanic - 07-12-2022, 09:02 PM
RE: Printing to my Printer - by SierraKen - 07-13-2022, 01:09 AM
RE: Printing to my Printer - by bplus - 07-12-2022, 11:16 PM
RE: Printing to my Printer - by George McGinn - 07-13-2022, 01:25 AM
RE: Printing to my Printer - by Dimster - 07-14-2022, 01:13 PM
RE: Printing to my Printer - by OldMoses - 07-14-2022, 02:39 PM
RE: Printing to my Printer - by Dimster - 07-14-2022, 03:25 PM
RE: Printing to my Printer - by Kernelpanic - 07-14-2022, 03:55 PM
RE: Printing to my Printer - by bplus - 07-14-2022, 04:24 PM
RE: Printing to my Printer - by SMcNeill - 07-14-2022, 05:47 PM
RE: Printing to my Printer - by Dimster - 07-14-2022, 06:33 PM
RE: Printing to my Printer - by SMcNeill - 07-14-2022, 06:54 PM



Users browsing this thread: 2 Guest(s)