07-14-2022, 05:47 PM
Give this a try:
For me, this will open a text dialog and print me a PDF file as I have "Microsoft Print to PDF" set as my default printer. If your physical printer is set as the default output, then you can use this to print directly to it instead. If you need to choose between printer outputs, then you have a lot more code to write to interface with the printer management interface used by your OS, but if you just want to print to your default printer, this is all you really need to do for it.
Code: (Select All)
'How to properly _PRINTIMAGE a screen of text
'by Steve!
$Color:32
Const scale = 80
Screen _NewImage(7.5 * scale, 10 * scale, 32) 'standard printer paper is 8.5 x 11 inches, with .5 margins.
' This gives us a 7.5 x 10 inch print area.
' Scale here is used so we can set this to a proper size for our PC display
' In this case, I'm going with a 600 x 800 screen size.
' Notice in most cases, this is a simple 3:4 width:height ratio!
Cls , White ' Set the screen to being a white color, so that you won't print your page in black.
Color Black ' Set the text to Black so that it'll show up on the screen as you desire.
_PrintMode _KeepBackground ' And either set the color with a transparent background, a white background,
' or use printmode so you're not printing Black on the default Black background.
Print "This screen is"; 7.5 * scale; "pixels wide, and"; 10 * scale; "pixels high."
Print
Print "Also notice that I've colored the background white, and the text black."
Print
Print "And this is honestly all I need to do to set up a page for proper printing with _PRINTIMAGE."
Print
Print "Press <ANY KEY> to see for yourself!"
Sleep
_PrintImage 0 'the 0 here says to print the active/visual screen image.
For me, this will open a text dialog and print me a PDF file as I have "Microsoft Print to PDF" set as my default printer. If your physical printer is set as the default output, then you can use this to print directly to it instead. If you need to choose between printer outputs, then you have a lot more code to write to interface with the printer management interface used by your OS, but if you just want to print to your default printer, this is all you really need to do for it.