The [[_PRINTIMAGE]] statement prints a colored image on the printer, stretching it to full paper size first.
{{PageSyntax}}
: [[_PRINTIMAGE]] {{Parameter|imageHandle&}}
* {{Parameter|imageHandle&}} is created by the [[_LOADIMAGE]], [[_NEWIMAGE]] or [[_COPYIMAGE]] functions.
* Use a white background to save ink. {{InlineCode}}[[CLS]] , _RGB(255, 255, 255){{InlineCodeEnd}} can be used to set the white background in any [[SCREEN]] mode.
* The image may be stretched disproportionately using normal screen sizes. To compensate, use a [[_NEWIMAGE]] screen that is proportional to the paper size. ''e.g.'' A 640 X 900 SCREEN page is roughly the same as 3 times a 210mm X 297mm paper size.
* [[_NEWIMAGE]] or graphic screen pages can use [[_PRINTSTRING]] to print different sized text [[_FONT]]s.
* [[Keywords_currently_not_supported_by_QB64#Keywords_Not_Supported_in_Linux_or_MAC_OSX_versions|Keyword Not Supported in Linux or MAC versions]]
{{PageExamples}}
''Example 1:'' Shows how to transfer custom font text on screen pages to the printer in Windows. Change the font path for other OS's.
{{CodeStart}}PageScale = 10
PageHeight = 297 * PageScale 'A4 paper size is 210 X 297 mm
{{Cl|COLOR}} {{Cl|_RGB}}(255, 0, 0), {{Cl|_RGBA}}(0, 0, 0, 0) 'RED text on clear black background
{{Cl|_PRINTSTRING}} (0, CursorPosY), text$
{{Cl|_FONT}} 16 'change to the QB64 default font to free it
{{Cl|_FREEFONT}} FontHandle
{{Cl|_DEST}} 0
CursorPosY = CursorPosY + FontHeight 'adjust print position down
{{Cl|RETURN}}
{{CodeEnd}}
{{small|Code by Galleon}}
:''Explanation:'' CLS with the color white makes sure that the background is not printed a color. The PrintText [[GOSUB]] sets the [[COLOR]] of the text to red with a transparent background using [[_RGBA]] to set the [[_ALPHA]] transparency to zero or clear black.
''Example 2:'' Printing an old SCREEN 12 [[ASCII]] table using a deeper sized page to prevent stretching by [[_PRINTIMAGE]].
{{CodeStart}}
{{Cl|_TITLE}} "Print Preview ASCII Table"
{{Cl|SCREEN}} {{Cl|_NEWIMAGE}}(640, 900, 256) 'size is proportional to 210mm X 297mm(8-1/2 X 11) paper