07-13-2022, 01:25 AM
(This post was last modified: 07-13-2022, 01:27 AM by George McGinn.
Edit Reason: Spacing was messed up
)
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:
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.
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
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