Lprinting printer control codes? - Printable Version +- QB64 Phoenix Edition (https://staging.qb64phoenix.com) +-- Forum: QB64 Rising (https://staging.qb64phoenix.com/forumdisplay.php?fid=1) +--- Forum: Code and Stuff (https://staging.qb64phoenix.com/forumdisplay.php?fid=3) +---- Forum: Help Me! (https://staging.qb64phoenix.com/forumdisplay.php?fid=10) +---- Thread: Lprinting printer control codes? (/showthread.php?tid=721) Pages:
1
2
|
RE: Lprinting printer control codes? - arnoldhf - 08-04-2022 Thanks for all the input. Those control codes I gave as examples were, I believe, PCL3 from the time I had my HPIII workhorse. They have continued to work for 25+ years on almost every laser printer I have tried, HP, Brother Lexmark, Canon, Kyocera, etc. even with many "Windows only" printers so I don't think compatibility would be an issue. In QB64, it appears Lprint can't send chr$(27) to the printer. I have tried printing to a file and then sending the file to the printer and that has worked fine, but, since I have such a large QBasic system (as I said, thousands of Lprint lines scattered throughout) changing all my programs to go first to a file would be very unwieldy. Hope I can find a different workaround. Arnold I RE: Lprinting printer control codes? - Pete - 08-04-2022 I very much doubt this would work. It is a statement that is on by default, but can be turned off, as shown below, and when off it allows the characters to be printed to the screen, like chr$(13), chr$(7), etc. So logically this should not make a difference in printing, as you would think it would want to be default (on) when sending chr$(27) as a printer escape code, but as a last resort, it might be worth one try. It just needs to be placed at the top of the program. _CONTROLCHR OFF RE: Lprinting printer control codes? - arnoldhf - 08-04-2022 (08-04-2022, 02:34 AM)Pete Wrote: I very much doubt this would work. It is a statement that is on by default, but can be turned off, as shown below, and when off it allows the characters to be printed to the screen, like chr$(13), chr$(7), etc. So logically this should not make a difference in printing, as you would think it would want to be default (on) when sending chr$(27) as a printer escape code, but as a last resort, it might be worth one try. It just needs to be placed at the top of the program. You were right. I tried it and no luck. RE: Lprinting printer control codes? - arnoldhf - 08-07-2022 Hi Guys, I figured out a (kludgy) workaround. I implemented it in one of my programs and it seems to work (until it doesn't.) Before I modify all my other programs, I wanted to get your input on possible pitfalls. At the beginning of the program I open a file, "printer.prn" for Output as file number ff%. I changed ALL my Lprints to Print #ff%, (something I tried very hard to avoid.) Every time I issue a page feed, Print #ff%, chr$(12), I call this sub: Sub PrintTheFile printfile$ = "printer.prn" Close ff% Shell _Hide "copy " + printfile$ + " prn" Open "O", ff%, printfile$: End Sub I probably could have used PRINT instead of COPY. One of the downsides here is that using SHELL copy (or PRINT) sends it out LPT1 so I have to make sure LPT1 is redirected properly. I found SUBing after each page feed gave me much more control then waiting until the entire job was in the file. I close the file and reopen it to make sure what I already sent to the printer does not get reprinted. Any comments would be appreciated. A |