Printing to my Printer
#1
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


'Printing on the Printer - an example using "_PrintImage" command
'Assumes a menu where an option to print to printer is the letter "p" or "P"

DIM img AS LONG
DIM Page AS LONG

PageScale = 10
PageHeight = 297 * PageScale
PageWidth = 210 * PageScale

Page& = _NEWIMAGE(PageWidth, PageHeight, 32)

a$ = "P"
Text$ = "The Rain in Spain falls mainly in the Plain."
PRINT
PRINT
PRINT Text$ 'This text is printing to the screen ok
IF a$ = "p" OR a$ = "P" THEN
    IF img& <> 0 THEN _FREEIMAGE (img&)
    _DEST Page& ' This is meant to capture the PRINTER data, making the size of the print the same size as the typical paper found in the printer and set the focus to the printer
    CLS , _RGB32(255, 255, 255) ' Insterestingly, this CLS does not Clear the computer screen but setting the RGB color to white seems to NEED Cls plus the comma, _RGB(255,255,255) on it's own generates an error
    '                             according to the _PRINTIMAGE wiki , this line sets a white background
    '.....I think things go wrong from here on down. .....
    _DEST 0 ' This is supposed to set the focus on the computer screen
    _PRINTSTRING (1, 1), Text$ 'This re-writes the phrase to the computer screen, so the phrase is written once at line 22 and again here
    img& = _COPYIMAGE(0) ' This is supposed to capture the computer screen where the phrase is written twice

    _PRINTIMAGE img& ' this command is supposed to send the img just captured to the printer
    _DELAY 5

END IF
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: 7 Guest(s)