We need you!

We're working hard on the next version of Developer Fusion. Let us know what you think we should be up to!

Members

Technology Zones

Articles

Hosted By

MaximumASP

Info

Rated
Read 213,153 times

Contents

Related Categories

Printing in VB - Printer Options

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!

James first started writing tutorials on Visual Basic in 1999 whilst starting this website (then known as VB Web). Since then, the site has grown rapidly, and James has written numerous tutorials, articles and reviews on VB, PHP, ASP and C#. In October 2003, James formed the company Developer Fusion Ltd, which owns this website, and also offers various development services. In his spare time, he's a 3rd year undergraduate studying Computer Science in the UK. He's also a Visual Basic MVP.

Comments

  • Posted by bakuretsu on 27 Sep 2005

    Can you tell me how to set the margins and printer orientation also using this method. It should work in VB .NET 2003 I'm assuming.

    I need to be able to control the printer margins and headers and...

  • Cannot print from Local printer connected on Win X

    Posted by vasanthi on 27 Sep 2005

    [Hi,

    Facing problem in printing from local printer connected to WinXp from VB6. I am able to capture Printer.devicename and thru this print to network printer. But when trying to print on Local pri...

  • problem in printing

    Posted by aadreja on 04 Jul 2005

    hi suhaas

    have u added new paper...

    now go to properties of your generic printer..
    in printing preferences select default paper instead of letter select ur created custom paper...

    now open ...

  • Posted by suhaas on 04 Jul 2005

    hi aadreja,

    thanks for your reply.

    I tried to do as per your reply. But this does not work with VB6. I am working on a invoice printing application where I am using Generic Text printer with VB6...

  • custom paper size in xp

    Posted by aadreja on 04 Jul 2005

    for setting custom paper size in xp
    u have to create form...

    go to start->settings->printers
    in file menu go to "server properties"
    create new from with desired paper size... and give name

    n...