Printing to my Printer - 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: Printing to my Printer (/showthread.php?tid=605) Pages:
1
2
|
Printing to my Printer - Dimster - 07-12-2022 Hi, I have just recently found my program needs to print out some of the results on paper. I much prefer to print to the screen however now find I can compare present results better if I had a printed copy of the past results. I was sure I'd be able to search our site for hints on this topic but wasn't able to find a clue as to what I'm missing in the code I have picked up from the WIKI. If you can see where I may be going wrong, thanks in advance for your help. This code I'm using is printing a BLACK page on my printer and I can't tell if it is printing the test phrase or not. Code: (Select All) 'NOTE: THIS ROUTINE DOESN'T WORK ... SUPPOSTED HAVE A WHITE BACKGROUND BUT GETTING AN ALL BLACK INK PAGE RE: Printing to my Printer - Pete - 07-12-2022 I haven't worked with _PRINTIMAGE before, but from reading your code it appears to me the image you are capturing with img& has a black background. I would think you would want to write your text to the Page& screen, instead, and capture that image to send to the printer. Pete RE: Printing to my Printer - SierraKen - 07-12-2022 People don't use PRINTIMAGE with text, they use it with graphics. Most likely the black background of your screen is flooding the tiny white fonts of your text. Instead of PRINTIMAGE and COPYIMAGE and FREEIMAGE you should just use: LPRINT Text$ and it will print it directly to your printer. RE: Printing to my Printer - SierraKen - 07-12-2022 https://qb64phoenix.com/qb64wiki/index.php/LPRINT RE: Printing to my Printer - bplus - 07-12-2022 This worked fine for me, I even had to reload my printer driver and stuff first because working from fresh SSD drive. Code: (Select All) 'NOTE: THIS ROUTINE DOESN'T WORK ... SUPPOSTED HAVE A WHITE BACKGROUND BUT GETTING AN ALL BLACK INK PAGE I used a graphics screen for easy (for me) manipulation of images. The printout was the one line down (one page only) about 1/16 th of page from top black print on white background. The font was as crappy looking as in preview (see snapshot) because your page is not scaled with screen, ie different ratios width x height... RE: Printing to my Printer - Dimster - 07-12-2022 Thanks guys - I literally thought I was following the directions in the wiki. As Pete said the black must have been coming from my computer screen even though I thought I was setting the foreground and background colors correctly. Sierra I have used LPrint, and only LPrint if I want to send something to my printer but was hoping to find a better path (quicker) path to the printer. I'm not sure where that font came from bplus. The only printed version of that rain/spain phrase was on my computer screen and it did not look like that. Your code does work for me but I agree the font looks awful. I expected the screen font to be the same font directed to the printer. The only thing I thought I needed to worry about was the difference in rows/columns I had on the screen v's that available to me in an 8x10 piece of paper in the printer. RE: Printing to my Printer - Kernelpanic - 07-12-2022 This is according to the QBasic Reference Guide; Screenshot. It doesn't work. Maybe it is because: "The LPRINT USING statement sends formatted data to LPT1, the parallel port printer." My printer is connected to USB. It is an HP Deskjet Plus 4120. RE: Printing to my Printer - bplus - 07-12-2022 Quote:I'm not sure where that font came from bplus. The only printed version of that rain/spain phrase was on my computer screen and it did not look like that. Your code does work for me but I agree the font looks awful. I expected the screen font to be the same font directed to the printer. The only thing I thought I needed to worry about was the difference in rows/columns I had on the screen v's that available to me in an 8x10 piece of paper in the printer. Sorry I misspoke, it's not the font that is the problem, it is the stretching and shrinking of it to fit in the image containers. If you keep the ratios of screen to printer paper the same the font will not be badly distorted. When I was printing calendars from screen I used _PutImage to rotate from portrait to landscape view for _PrintImage, Rotozoom could do it too. For an 8.5 x 11 inch paper = (4.25 x 5.5) * 100 is 425 x 550. Try that screen size in code I modified. Should magnify the print with little distortion. Or the 210 x 297 ratio .7070 hmm... 8.5/11 = .7727...If your paper is 210 x 297 something units, try screen size 420 X 594. RE: Printing to my Printer - SierraKen - 07-13-2022 (07-12-2022, 09:02 PM)Kernelpanic Wrote: This is according to the QBasic Reference Guide; Screenshot. It doesn't work. Maybe it is because: In QB64 LPRINT detects USB printers. It says on the Wiki help page. I'm not sure about LPRINT USING https://qb64phoenix.com/qb64wiki/index.php/LPRINT RE: Printing to my Printer - George McGinn - 07-13-2022 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$ 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. |