Search code examples
vb6printing

Print Bitmap in Visual Basic 6


I needed to print a .bmp file to a printer using Visual Basic 6. Does anyone know how i can do this using the Printer.Print method?

Thanks


Solution

  • You have to use the PaintPicture method of the printer object. Example:

    Printer.PaintPicture LoadPicture(filename), xPosition, yPosition, _
                                        [Width], [Height]
    

    If you already have a picture loaded in a Image or Picture control, you can pass the Picture reference of the object instead of using LoadPicture a second time. Note that this method does not automatically resize the image to fit on the paper, you will have to figure out how much to scale the image yourself.

    Edit - More information on using the PaintPicture Method