Printing in VB

Printer Options

Aside from graphics, there is also a number of properties that directly affect printing. I'll cover these here.

Copies The number of copies of your output that will be printed
DeviceName The name of the printer device.
DriverName The name of the driver for the printer
Duplex Whether the printer is in Duplex mode or not (printing on both sides).
hDC A handle to the printers device context
Orientation The orientation of the paper. This can be vbPRORLandscape or vbPRORPortrait.
Page Returns the current page number (read-only)
PaperBin The paper bin to use when printing the document. The values for this property can be found by hitting F2 (Object Browser), selecting PrinterObjectConstants from the Classes list, and taking a look at all the constants beginning with vbPRBN
PaperSize The size of the paper that is being printed on. See PrinterObjectConstants in the Object Browser, beginning with vbPRPS
Port The name of the printer port (read-only)
PrintQuality The quality of printing (printer resolution). See PrinterObjectConstants, beginning with vbPRPQ
TrackDefault Whether to automatically move to the default printer if this is changed in Control Panel
Zoom The percentage with which the output is scaled up or down. (Note that this only works on printers that support it!)

And that's about it! Many of you may now be thinking about PrintPreview... a RichTextBox PrintPreview control will be coming soon to VB Web!

You might also like...

Comments

About the author

James Crowley

James Crowley United Kingdom

James first started this website when learning Visual Basic back in 1999 whilst studying his GCSEs. The site grew steadily over the years while being run as a hobby - to a regular monthly audien...

Interested in writing for us? Find out more.

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.” - Rich Cook