Getting Started
Introduction
Sample Programs
IDEs
History
Advice
Mini-Tutorial
Tutorials
Code Snippets

Resources
Web Sites
More Tutorials
Forums
Vendors/Tools
Books
Magazines
Newsletters
NewsGroups
User Groups
Talk Shows
Blogs

Controls
Overview
Button
Check3State
Checkbox
ComboBox
Frame
Graphic
Image
ImageX
ImgButton
ImgButtonX
Label
Line
ListBox
ListView
Option
Progress Bar
Scrollbar
StatusBar
TAB
TextBox
Toolbar
TreeView

GBIC >> PowerBASIC >> Tutorials >> Printing

PowerBASIC Information Center Tutorials
These tutorials were written to help you get a quick, but thorough, understanding of PowerBASIC - the scope of the language as well as it's specific capabilities.

Introduction       Projects       Language           Messages       Functions           Advanced
  • Overview
  • Examples
  • IDE
  • Compilation
  • Distribution
  • Project Files
  • DDT Windows
  • Controls
  • Menus
  • Dialogs  
  • Help Files
  • Resources  
  • Templates  
  • Project Shell  
  • Syntax
  • Operators
  • Data Types
  • Variables
  • Scope
  • Declarations  
  • Procedures
  • Flow Control
  • Windows
  • Messages
  • Callbacks
  • Mouse
  • Keyboard
  • Dialogs
  • Controls
  • Subclassing
  • Arithmetic
  • Trig  
  • Strings
  • Arrays
  • Date/Time
  • Printing
  • Files
  • Folders
  • Keyboard
  • Mouse
  • Sound
  • System
  • Error Traps
  • Debugging
  • Objects
  • Graphics
  • Databases
  • API
  • DLLs
  • ASM
  • Threads
  • Printer Function Summary
    PowerBASIC provides a large number of commands with which to control printing. Most are part of the XPRINT family of commands (XPRINT ATTACH, XPRINT CLOSE, ..., etc.).

    The commands can be broken into the following categories. Note that all of these commands are preceded by XPrint (except for Printer$, PrinterCount, XPrint, and XPrint$).

      • Connecting to Printers
       Attach, Close
      
      • Printer List
       Printer$, PrinterCount, XPrint$
      
      • Printer Control
       Cancel, FormFeed
      
      • Get Properties
        ("XPRINT GET")
       Client, Collate, ColorMode, Copies,
       DC, Duplex, Lines, Margin, Mix,
       Orientation, Paper, Papers, PPI,
       Quality, Size, Tray, Trays
      
      • Set Properties
        ("XPRINT SET")
       Collate, ColorMode, Copies,
       Duplex, Mix, Orientation,  
       Paper, Quality, Tray
      
      • Get Graphics Properties
       Chr Size, Color, Text Size
       GET Pixel, GET Pos, GET Scale
      
      • Set Graphics Properties  
       Font, Scale, Scale Pixels, Style, Width 
       SET Font, SET Pixel, SET Pos,
      
      • Shapes/Text
       Arc, Box, Ellipse, Line
       Pie, Polygon, Polyline, XPrint
      
      • Images
       Copy, ImageList, Render, Stretch 

    Printing Text
    In general, printing under PowerBASIC requires three steps.

    1. Select a Printer
      The XPrint Attach statement is used to pick a printer. The printer can be selected from a dialog, the default printer can be used, or the program can declare the name of the printer explicitly. The following code shows all three.

          XPrint Attach Default       'uses default printer
          XPrint Attach Choose        'open printer select dialog
          XPrint Attach PrinterName$  'explicitly select a printer
      

    2. Send text to printer
      To send text to the attached printer, simply use the XPrint statement, as shown in these examples.

         XPrint "hello"    'print text and move print position to next line
         XPrint "hello";   'print text and do not move print position
      

    3. Detach Printer
      Anything printed by the XPrint statement is saved in a buffer and is not sent to the printer until an XPrint Close statement is executed. The next example shows a complete printing session.

          XPrint Attach Default    'use the default printer
          XPrint "hello"           'print one line of text
          XPrint "goodbye"         'print a second line of text
          XPrint Close             'send content to printer
      

    In PowerBASIC, when the printer is detached, all buffer content is sent to the printer

    Fonts
    The font and font properties used for printing may be controlled by an application. In general, the Font New command is used to create one or more fonts. Each is given a handle. Then, the Set Font statement can be used to select from any of the available handles.

        Font New - create a font
        XPrint Set Font - select a font 
        XPrint Text Size - get height/width of text string
        XPrint Chr Size - get height/width of a single character
    

    Font New is used to define a font and its properties. It also gives the font a handle.

    XPrint Set Font can select any font created by Font New. The selected font will be used

    XPrint Text Size and XPrint Chr Size return string and character size (height/width) information for the selected font.

    Printer Job Control
    To print on a new page, use the XPrint FormFeed statement.

    To cancel print statement not yet released to the printer, use the XPrint Cancel statement. Content released to the printer cannot be stopped by PowerBASIC.

        XPrint FormFeed    'printing starts at 0,0 on new page
        Xprint Cancel      'cancel all buffered printing statements
    

    Printing Graphics (Drawing Primitives)
    PowerBASIC provides tools to create graphics. Both drawing primitives and bitmap images may be sent to the selected printer.

    There are seven primitives - arc, box, ellipse, line, pie, polygon, and polyline. Setting of individual pixels is also supported.

    The primitives can be roughly categorized by the way in which they use page coordinates for defining where a drawing takes place.

    Examples of all the drawing functions are included in the reference table at the bottom of this page.

    • POS
      PowerBASIC maintains a current "position" on the page, call POS, which can be set manually using the POS function. Only the functions XPrint, XPrint Line, and XPrint Set Pixel use POS and update it based on the endpoint of the operation.

          XPrint Set POS     'sets POS for the next operation
          XPrint Get POS     'get POS information
          XPrint             'write text at POS
          XPrint Line        'draw line from POS to x,y
          XPrint Set Pixel   'set color of pixel at POS
      

    • Bounding Box
      For drawing coordinates, some drawing functions simply use pairs of coordinates that define a bounding box that encloses the drawing. The Arc, Ellipse, Pie, and Box functions use this approach.

          XPrint ARC
          XPrint Ellipse
          XPrint Pie
          XPrint Box
      

    • Point List
      The final set of drawing primitives uses a UDT structure to hold pairs of points with which to draw the line segments.

          XPRINT Polygon
          XPRINT Polyline
      

    Graphics Properties
    When drawing the primitives discussed in the previous section there are several properties which can be set to adjust how the drawing looks.

        XPRINT SCALE - define custom coordinate system
        XPRINT GET SCALE - get scale settings
        XPRINT SCALE PIXELS - Reset coordinate system to default
        XPRINT STYLE - Set line style
        XPRINT WIDTH - Set line width
    

    XPrint Scale allows defining the upper/left and lower/right coordinates of the printable area of the selected printer.

    XPrint Scale Pixel resets the coordinate system to pixels, returning from the custom coordinates set by XPrint Scale.

    XPrint Style selects from 0-solid, 1-dash, 2-dot, 3-dashdot and 4-dashdotdot for drawing lines and borders of primitives.

    XPrint Width set the line width in pixels (regardless of XPrint Scale settings). Default is 1 pixel. If set greater than 1, style 0-solid is always used.

    Examples of all the drawing functions are included in the reference table at the bottom of this page.

    Pixels, Pixels, Pixels
    In addition to drawing primitives, PowerBASIC can work at the pixel level - setting the pixel color at a specific location.

    XPrint Color - sets default fg/bg colors
    XPrint Set Pixel - set pixel color at x,y
    XPrint Get Pixel - get pixel color at x,y
    XPrint Set POS
    

    XPrint Color can set the foreground color, which XPrint Set Pixel uses as a default color.

    XPrint Set Color sets the color at x,y. Uses default foreground color if a color is not explicitly specified. If a STEP option is invoke, the x,y dimension are relative to POS.

    XPrint Get Pixel support depends on the printer driver's ability to provide the information. If not supported, -1 is returned.

    XPrint Set POS changes the default position, which XPrint Set Color uses if invoked with the STEP option.

    Printing Images
    PowerBASIC supports several methods of printing images onto a page, a shown in the next listing.

        XPrint Copy - send bitmap to printer (all or partial)
        XPrint ImageList - print image from ImageList (all)
        XPrint Stretch - copy/resize bitmap (all or partial, with resize)
        XPrint Render - print image (all, with resize)
    

    With Copy, ImageList and Stretch, a preloaded image from a control, window, bitmap structure or imagelist structure is used. Using preloaded images significantly speeds up image display operations, especially animated displays.

    With Render, an image from a resource file or disk file is used.

    Two of the functions, Stretch and Render can resize the image.

    Two of the functions, Copy and Stretch, can be used to print only a portion of the original image.

    The Printer
    In addition to selecting a printer when using the XPrint command, there are three other statements useful in managing the selection of a printer for attachment.

        Printer$ - get printer names, one at a time
        PrinterCount - get quantity of installed printers
        XPrint$ - get name of attached printer
    

    Printercount tells how many printers are available. Printer$ takes a number from 1 to PrinterCount and returns the name of the printer. XPrint$ returns the name of the currently attached printer.

    Also, PowerBASIC also enables a programmer to get or set various properties (over 18) of the attached printer. The specific functions were listed in the table at the top of the page. Examples of each are provided in the reference table at the bottom of this page.

    Printing Commands - One Line Descriptions
    All of these commands apply to attached host printers. The use of line printer commands is discouraged and the commands are not shown here.

    • PRINTER$ - Get list of printers
    • PRINTERCOUNT - Get number of installed printers
    • XPRINT - Send text to printer
    • XPRINT ARC - Draw arc
    • XPRINT ATTACH - Select printer for use with XPRINT
    • XPRINT BOX - Draw box (square/rounded corners)
    • XPRINT CANCEL - Cancel print job
    • XPRINT CHR SIZE - Get character size using current font
    • XPRINT CLOSE - Close printer connection, begin printing
    • XPRINT COLOR - Set foreground/background colors
    • XPRINT COPY - Send bitmap to printer
    • XPRINT ELLIPSE - Draw ellipse/circle
    • XPRINT FORMFEED - Start new page
    • XPRINT GET CLIENT - Get size of client area
    • XPRINT GET COLLATE - Get collate setting
    • XPRINT GET COLORMODE - Get colormode setting
    • XPRINT GET COPIES - Get copy count
    • XPRINT GET DC - Get handle of printer device context
    • XPRINT GET DUPLEX - Get duplex setting
    • XPRINT GET LINES - Get max line per page
    • XPRINT GET MARGIN - Get margin sizes
    • XPRINT GET MIX - Get color mix mode
    • XPRINT GET ORIENTATION - Get paper orientation
    • XPRINT GET PAPER - Get paper size/type
    • XPRINT GET PAPERS - Get list of allowed paper types
    • XPRINT GET PIXEL - Get color of pixel
    • XPRINT GET POS - Get last point referenced (POS)
    • XPRINT GET PPI - Get resolution
    • XPRINT GET QUALITY - Get print quality
    • XPRINT GET SCALE - Get coordinate limits
    • XPRINT GET SIZE - Get size
    • XPRINT GET TRAY - Get active tray
    • XPRINT GET TRAYS - Get list of trays
    • XPRINT IMAGELIST - Print image from ImageList
    • XPRINT LINE - Draw a line
    • XPRINT PIE - Draw a pie section
    • XPRINT POLYGON - Draw a polygon
    • XPRINT POLYLINE - Draw series of connected lines
    • XPRINT RENDER - Print image
    • XPRINT SCALE - Define coordinate system
    • XPRINT SCALE PIXELS - Reset coordinate system to default
    • XPRINT SET COLLATE - Set collate status
    • XPRINT SET COLORMODE - Set colormode status
    • XPRINT SET COPIES - Set copy count
    • XPRINT SET DUPLEX - Set duplex status
    • XPRINT SET FONT - Set font
    • XPRINT SET MIX - Set color mix mode
    • XPRINT SET ORIENTATION - Set paper orientation
    • XPRINT SET PAPER - Set paper size/type
    • XPRINT SET PIXEL - Set pixel color
    • XPRINT SET POS - Set last point referenced (POS)
    • XPRINT SET QUALITY - Set print quality
    • XPRINT SET TRAY - Set active tray
    • XPRINT STRETCH - Copy/resize bitmap
    • XPRINT STYLE - Set line style
    • XPRINT TEXT WIDTH - Get width of text character
    • XPRINT WIDTH - Set line width
    • XPRINT$ - Get name of attached printer

    Line Printers
    PowerBASIC also supports line printers, where printing content is sent directly to a port, rather than through a Windows device driver. See the PowerBASIC Help file for more information on the LPRINT family of functions which provides this capability. Using printers which connect through Windows printer drivers is recommended for the greater capabilities they offer. The line printer family of commands (LPRINT) are not covered in this tutorial.

    Function Reference
    Here's a quick reference of the available array functions, in alphabetical order.

    • PRINTER$ - Get list of printers
          name$ = XPrinter$ NAME, n%
          name$ = XPrinter$ PORT, n%
      

      Takes a number from 1 to PrinterCount and returns the name or port of the printer.

    • PRINTERCOUNT - Get number of installed printers
          n% = PrinterCount
      

    • XPRINT - Send text to printer
          XPrint "hello"    ' text sent to printer 
                            ' doesn't print until XPrint Close is used
      

    • XPRINT ARC - Draw arc
          XPrint ARC (x1,y1)-(x2,y2), angBegin, angEnd, rgbColor!
      

    • XPRINT ATTACH - Select printer for use with XPRINT
          XPrint Attach Default       'uses default printer
          XPrint Attach Choose        'open printer select dialog
          XPrint Attach PrinterName$  'explicitly select a printer
      

      All 3 options allow naming of print job. Just add ", jobname$" to the end of the statements.

    • XPRINT BOX - Draw box (square/rounded corners)
          XPrint Box (x1,y1)-(x2,y2), corner&, rgbColor&, fColor&, style&
      

    • XPRINT CANCEL - Cancel print job
          XPrint Cancel    
      
      Cancels print statements not yet released to the printer. Content released to the printer cannot be stopped by PowerBASIC.

    • XPRINT CHR SIZE - Get character size using current font
          XPrint Chr Size TO width!, height!
      

    • XPRINT CLOSE - Close printer connection, begin printing
          XPrint CLOSE    'detach currently selected printer
                          'send print buffer to printer
      

      If not used, print content may be lost.

    • XPRINT COLOR - Set foreground/background colors
          XPrint Color fgcolor&, bgcolor&     'rgb values, bgcolor optional
      

      Use -1 for default color or -2 for background color.

    • XPRINT COPY - Send bitmap to printer
          XPrint Copy hBMP, id&, style&                    'full at 0,0
          XPrint Copy hBMP, id& TO (x,y), style&           'full at x,y
          XPrint Copy hBMP, id&, (a,b)-(c,d) TO (x,y), style&   'partial
      
          hBMP is handle of control, window, or bitmap
          id& is control identifier assigned CONTROL ADD GRAPHIC
          id& is 0 for window or bitmap image source
          
          Style& Options:
          %mix_NotMergeSrc - inverse of the MergeSrc color.
          %mix_NotCopySrc - inverse of the pen color.
          %mix_MaskSrcNot - colors common to source and inverse-pixel
          %mix_XorSrc - colors in the source and pixel, but not in both
          %mix_MaskSrc - colors common to both the source and the pixel.
          %mix_MergeNotSrc - combination of source and inverse-pixel colors
          %mix_CopySrc - source color (default)
          %mix_MergeSrc - combination of source and pixel colors
      

    • XPRINT ELLIPSE - Draw ellipse/circle
          XPrint Ellipse (x1,y1)-(x2,y2), rgbColor&, fColor&, style&
      
          style& options:
          0 - solid
          1 -  horizontal lines
          2 - vertical lines
          3 - upward diagonal lines
          4 - downward diagonal lines
          5 - crossed lines
          6 - diagonal crossed lines
      

    • XPRINT FORMFEED - Start new page
          XPrint FormFeed    ' starts new page
      

    • XPRINT GET CLIENT - Get size of client area
          XPrint Get Client TO iWidth, iHeight  
      

    • XPRINT GET COLLATE - Get collate setting
          XPrint Get Collage TO status&    ' 0 is false, -1 is true
      

    • XPRINT GET COLORMODE - Get colormode setting
          XPrint Get ColorMode TO mode&    ' 1-monochrome  2-color
      

    • XPRINT GET COPIES - Get copy count
          XPrint Get copies TO count&      ' # copies to print
      

    • XPRINT GET DC - Get handle of printer device context
          XPrint Get DC TO hDC    'hDC is handle to page devices context
      

    • XPRINT GET DUPLEX - Get duplex setting
          XPrint Get Duplex TO status&    ' 0 if duplex unsupported
      
          Status Options:   
          n/a               0   duplex printing not supported
          %DMDUP_SIMPLEX    1   single sided printing
          %DMDUP_VERTICAL   2   page flipped on vertical edge
          %DMDUP_HORIZONTAL 3   page flipped on horizontal edge   
      

    • XPRINT GET LINES - Get max line per page
          XPrint Get Lines TO count&   'max can print on one page
      

      Count& differs depending on font size.

    • XPRINT GET MARGIN - Get margin sizes
          XPrint Get Margin TO left!, top!, rite!, bottom!  'margin sizes
      

    • XPRINT GET MIX - Get color mix mode
          XPrint Get Mix TO mode&   'mode& is how to mix color with 
                                    'color already at drawing location
      
          Mode& Options
          %mix_Blackness - always 0 (black).
          %mix_NotMergeSrc - inverse of the MergeSrc color.
          %mix_MaskNotSrc - colors common to pixel and source-inverse
          %mix_NotCopySrc - inverse of the pen color.
          %mix_MaskSrcNot - colors common to source and inverse-pixel
          %mix_Not - inverse of the pixel color.
          %mix_XorSrc - colors in the source and pixel, but not in both
          %mix_NotMaskSrc - inverse of the MaskSrc color.
          %mix_MaskSrc - colors common to both the source and the pixel.
          %mix_NotXorSrc - inverse of the XorSrc color.
          %mix_Nop - unchanged.
          %mix_MergeNotSrc - combination of source and inverse-pixel colors
          %mix_CopySrc - source color (default)
          %mix_MergeSrcNot - combination of source and pixel-inverse colors
          %mix_MergeSrc - combination of source and pixel colors
          %mix_Whiteness - always 1 (white).
      

    • XPRINT GET ORIENTATION - Get paper orientation
          XPrint Get Orientation = status&   ' 1-portrait, 2-landscape
      

      Zero is printer does not support paper orientation.

    • XPRINT GET PAPER - Get paper size/type
          XPrint Get Paper TO type&   '0 if paper styles unsupported
      
          Common Paper Types:
          %DMPAPER_LETTER    =  1      Letter    8.5   x 11    inches
          %DMPAPER_LEGAL     =  5      Legal     8.5   x 14    inches
          %DMPAPER_11X17     = 17      11x17     11    x 17    inches
      
          %DMPAPER_A3        =  8      A3        297   x 420   mm
          %DMPAPER_A4        =  9      A4        210   x 297   mm
          %DMPAPER_A5        = 11      A5        148   x 210   mm
          %DMPAPER_B4        = 12      B4        250   x 354   mm
          %DMPAPER_B5        = 13      B5        182   x 257   mm
      
          %DMPAPER_ENV_9     = 19      9 Envlp   3.875 x 8.875 inches
          %DMPAPER_ENV_10    = 20      10 Envlp  4.125 x 9.5   inches
      

    • XPRINT GET PAPERS - Get list of allowed paper types
          XPrint Get Papers TO result$    'CSV list of all available types
      

      Use parsecount$ and parse$() functions to extract specific information from the result string.

    • XPRINT GET PIXEL - Get color of pixel
          XPrint Get Pixel (x,y) TO rgbColor&
      

      If printer does not support the features, -1 is returned.

    • XPRINT GET POS - Get last point referenced (POS)
          XPrint Get POS TO x,y    'current values of POS
      

    • XPRINT GET PPI - Get resolution
          XPrint Get PPI TO x,y    'always in pixels per inch
      

    • XPRINT GET QUALITY - Get print quality
          XPrint Get Quality TO result&    ' 0-not supported, 1-draft,
                                           ' 2-low 3-medium 4-high
      

    • XPRINT GET SCALE - Get coordinate limits
          XPrint Get Scale TO x1,y1,x2,y2
      

    • XPRINT GET SIZE - Get size
          XPrint get Size TO width, height   'full size
      

    • XPRINT GET TRAY - Get active tray
          XPrint Get Tray TO tray&     'active paper tray
      
          Common Paper Tray Values
          %DMBIN_UPPER         = 1
          %DMBIN_LOWER         = 2
          %DMBIN_MIDDLE        = 3
          %DMBIN_MANUAL        = 4
          %DMBIN_ENVELOPE      = 5
          %DMBIN_ENVMANUAL     = 6
          %DMBIN_AUTO          = 7
      

    • XPRINT GET TRAYS - Get list of trays
          XPrint Get Trays TO trays&    'CSV string of supported trays
      

      Use parsecount$ and parse$() functions to extract specific information from the result string.

    • XPRINT IMAGELIST - Print image from ImageList
          XPrint ImageList (x,y), hList, index&, overlay&, style&
      
          hlist - handle to imagelist structure
          index& - index of image within imagelist
          overlay& - overlay image
          style&  %ILD_NORMAL      - use bgcolor of imagelist
                  %ILD_TRANSPARENT - transparently if there is a mask
                  %ILD_MASK        - draw the mask
                  %ILD_BLEND25     - blend 25% with system hilite color
                  %ILD_BLEND50     - blend 50% with system hilite color
      

    • XPRINT LINE - Draw a line
          XPrint Line (x1,y1)- (x2,y2), rgbColor&
          XPrint Line STEP (x1,y1)- STEP (x2,y2), rgbColor&
      

      Line drawn up to, but no including, the second point. (x1,y1) are optional - POS will be used. STEP indicates coordinates are relative to POS. rgbColor& is optional, default if foreground color.

    • XPRINT PIE - Draw a pie section
          XPrint Pie (x1,y1)-(x2,y2), ang1, ang2, lcolor&, fcolor&, fstyle&
      
          ang1 - starting angle (radians)
          ang2 - ending angle (radians)
          lcolor& - line color
          fcolor& - fill color
          fsyle& - fill style
      

    • XPRINT POLYGON - Draw a polygon
          XPrint Polygon points, rgbColor&, fillColor&, style&, fillmode&
      
          Fill Styles:
          0 - solid
          1 -  horizontal lines
          2 - vertical lines
          3 - upward diagonal lines
          4 - downward diagnonal lines
          5 - crossed lines
          6 - diagonal crossed lines
      
          Scalar UDT approach:
          TYPE PolyPoints    'scalar
            count as long
            x1 as single
            y1 as single
            x2 as single
            y2 as single
            x3 as single
            y3 as single
          END TYPE
      
          Array UDT approach:
          TYPE PolyPoint     'array
            x as single
            y as single
          END TYPE
          TYPE PolyArray     
            count as long
            xy(1 TO 3) as PolyPoint
          END TYPE
      

      Minimum of 2 vertices, maximum of 1024.

    • XPRINT POLYLINE - Draw series of connected lines
          XPrint Polyline points, rgbColor&
      

      For points, use same UDTs options as in XPrint Polygon.

    • XPRINT RENDER - Print image
          XPrint Render bmpFile$, (x1,y1)-(x2-y2)
      

      bmpFile$ is resource name or file name. Image can be stretched or shrunk. Entire image is used.

    • XPRINT SCALE - Define coordinate system
          XPrint Scale (x1,y1)-(x2,y2)   'defines full page coordinates
      

    • XPRINT SCALE PIXELS - Reset coordinate system to default
          XPrint Scale Pixels   'resets coordinates to pixels
      

    • XPRINT SET COLLATE - Set collate status
          XPrint Set Collate status&   
      
          %DMCOLLATE_FALSE  0
          %DMCOLLATE_TRUE   1
      

      Causes error if printer does not support collating.

    • XPRINT SET COLORMODE - Set colormode status
          XPrint Set ColorMode status$
      
          %DMCOLOR_MONOCHROME   1
          %DMCOLOR_COLOR        2
      

    • XPRINT SET COPIES - Set copy count
          XPrint Set Copies  count&   'number of copies default=1
      

      Error generated if count is greater than printer supports

    • XPRINT SET DUPLEX - Set duplxe status
          XPrint Set Duplex status$ 
      
          %DMDUP_SIMPLEX    1   single sided printing
          %DMDUP_VERTICAL   2   page flipped on vertical edge
          %DMDUP_HORIZONTAL 3   page flipped on horizontal edge   
      

      Error generated if printer does not support duplex printing.

    • XPRINT SET FONT - Set font
          XPrint Set Font hFont&     'use font handle from Font New
      

    • XPRINT SET MIX - Set color mix mode
          XPrint Set Mix mode&
      
          Mode& Options
          %mix_Blackness - always 0 (black).
          %mix_NotMergeSrc - inverse of the MergeSrc color.
          %mix_MaskNotSrc - colors common to pixel and source-inverse
          %mix_NotCopySrc - inverse of the pen color.
          %mix_MaskSrcNot - colors common to source and inverse-pixel
          %mix_Not - inverse of the pixel color.
          %mix_XorSrc - colors in the source and pixel, but not in both
          %mix_NotMaskSrc - inverse of the MaskSrc color.
          %mix_MaskSrc - colors common to both the source and the pixel.
          %mix_NotXorSrc - inverse of the XorSrc color.
          %mix_Nop - unchanged.
          %mix_MergeNotSrc - combination of source and inverse-pixel colors
          %mix_CopySrc - source color (default)
          %mix_MergeSrcNot - combination of source and pixel-inverse colors
          %mix_MergeSrc - combination of source and pixel colors
          %mix_Whiteness - always 1 (white).
      

    • XPRINT SET ORIENTATION - Set paper orientation
          XPrint Set Orientation status&   '1-portrait, 2-landscape
      

    • XPRINT SET PAPER - Set paper size/type
          XPrint Set Paper papertype&
      
          Common Paper Types:
          %DMPAPER_LETTER    =  1      Letter    8.5   x 11    inches
          %DMPAPER_LEGAL     =  5      Legal     8.5   x 14    inches
          %DMPAPER_11X17     = 17      11x17     11    x 17    inches
      
          %DMPAPER_A3        =  8      A3        297   x 420   mm
          %DMPAPER_A4        =  9      A4        210   x 297   mm
          %DMPAPER_A5        = 11      A5        148   x 210   mm
          %DMPAPER_B4        = 12      B4        250   x 354   mm
          %DMPAPER_B5        = 13      B5        182   x 257   mm
      
          %DMPAPER_ENV_9     = 19      9 Envlp   3.875 x 8.875 inches
          %DMPAPER_ENV_10    = 20      10 Envlp  4.125 x 9.5   inches
      

    • XPRINT SET PIXEL - Set pixel color
          XPrint Pixel STEp (x,y), rgbColor&    'set pixel color at x,y
          XPrint Set Pixel STEP (x,y), rgbColor&
      

      XPrint Color can set the foreground color, which XPrint Set Pixel uses as a default color.

      With STEP, x,y is incremental from POS.

    • XPRINT SET POS - Set last point referenced (POS)
          XPrint Set POS (x,y)        'POS is now at x,y
          XPrint Set POS STEP (x,y)   'POS is now at x,y from prior POS
      

    • XPRINT SET QUALITY - Set print quality
          XPrint Set Quality status&   ' 0-not supported, 1-draft,
                                       ' 2-low 3-medium 4-high
      

    • XPRINT SET TRAY - Set active tray
          XPrint Set Tray nTray%
      
          Common Paper Tray Values
          %DMBIN_UPPER         = 1
          %DMBIN_LOWER         = 2
          %DMBIN_MIDDLE        = 3
          %DMBIN_MANUAL        = 4
          %DMBIN_ENVELOPE      = 5
          %DMBIN_ENVMANUAL     = 6
          %DMBIN_AUTO          = 7
      

    • XPRINT STRETCH - Copy/resize bitmap
          XPrint Stretch hBMP, id%, (x1,y1)-(x2,y2) TO _
                                    (x3,y3)-(x4-y4), mix, mode
      
          Mix Modes:
          %mix_NotMergeSrc - inverse of the MergeSrc color.
          %mix_NotCopySrc - inverse of the pen color.
          %mix_MaskSrcNot - colors common to source and inverse-pixel
          %mix_XorSrc - colors in the source and pixel, but not in both
          %mix_MaskSrc - colors common to both the source and the pixel.
          %mix_MergeNotSrc - combination of source and inverse-pixel colors
          %mix_CopySrc - source color (default)
          %mix_MergeSrc - combination of source and pixel colors
      
          Stretch Mode Options:
          %BLACKONWHITE - default. best for monochrome bitmaps (some color)
                        - boolean OR of eliminated and existing pixels
                        - preserves black pixels at expense of white pixels
       
          %WHITEONBLACK - boolean OR of eliminated and existing pixels
                        - preserves white pixels at expense of black pixels
       
          %COLORONCOLOR - deletes eliminated lines of pixels
       
          %HALFTONE     - highest quality for color bitmaps
                        - pixel block average color kept ~ the same
       

      Copy all or a portion of an image. Use handle of control, window, or bitmap structure.

    • XPRINT STYLE - Set line style
          XPrint STYLE style&   ' 0-solid, 1-dash, 2-dot, 3-dashdot
      
      

    • XPRINT TEXT SIZe - Get width of text character
          XPrint TEXT SIZE text$ TO width!, height!
      

    • XPRINT WIDTH - Set line width
          XPrint WIDTH n&    ' drawing width of lines 
      

    • XPRINT$ - Get name of attached printer
          devicename$ = XPrint$    ' returns name of attached printer
      

    If you have any suggestions or corrections, please let me know.