Results 1 to 7 of 7

Thread: Printing using printer properties

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2007
    Location
    Kent, UK
    Posts
    4

    Printing using printer properties

    Is there any way to print to a printer in VB6 using all the capabilities of the printer drivers.

    Most printers have a vast array of options, eg double sided, booklet form or even things like stapled if you can print to the office photocopier.

    Proprietry programs like Word, Excel etc automatically pick up these features when you print, using the properties button in the printer dialog.

    I can use the common dialog supplied with VB6 or the replacement from MDSN or call it via API calls but I can never get my program to print according to all the preferences set, when using standard Printer.Print commands etc.

    I would prefer not to change the default printer as this can have unwanted side effects on other programs if my application is still running.

    Is there any way of acomplishing this, theoretically, standard function in VB6? If all the other programs can do this why can't VB6? I'm even willing to try printing via API if someone can point me in the right direction.

  2. #2
    Addicted Member
    Join Date
    Jul 2007
    Posts
    228

    Re: Printing using printer properties

    You can use the Vbprndlg.dll file instead of the Print dialog box portion of the Visual Basic CommonDialog control. This file exposes properties and provides functionality that the CommonDialog control does not.

    Information is found here:

    http://support.microsoft.com/kb/322710

    Tom

  3. #3

    Thread Starter
    New Member
    Join Date
    Jun 2007
    Location
    Kent, UK
    Posts
    4

    Re: Printing using printer properties

    Quote Originally Posted by Tom Moran View Post
    You can use the Vbprndlg.dll file instead of the Print dialog box portion of the Visual Basic CommonDialog control. This file exposes properties and provides functionality that the CommonDialog control does not.
    Yes I've tried that one. You still have no access to most of the print driver's properties.

    I suppose it is VB's Printer object that is limiting the options.

  4. #4
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Printing using printer properties

    are you wanting to set the printer properties for the vb printer object or present a dialog for the user to select from?

    just about all print options are available to vb printer object, though later operating systems seem to have broken some previously working features

    which specific properties are you having problems setting?
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  5. #5

    Thread Starter
    New Member
    Join Date
    Jun 2007
    Location
    Kent, UK
    Posts
    4

    Re: Printing using printer properties

    Quote Originally Posted by westconn1 View Post
    are you wanting to set the printer properties for the vb printer object or present a dialog for the user to select from?
    I was hoping to print using the printer object. I want the user to be able to select the desired printer and any properties as one does from any word processor for instance. I have effectively written my own very simplified report writer, so I'm just setting the font size and X Y position and using Print statements.

    Quote Originally Posted by westconn1 View Post
    which specific properties are you having problems setting?
    Really I want the user to be able to use all properties available, but especially things like the number of pages per sheet, and booklet printing and saddle-stich stapling which the main office printer can cope with.

    I was wondering about outputting to a Word object if that is possible (although I've never tried that), but the formatting would then be more complicated, and then possibly letting Word do the printing if that is possible, but presumably this would cause problems if the user does not have Word installed.

  6. #6
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Printing using printer properties

    It would definately cause problems if the user did not have Word installed (in fact, it just flat out would not work), but, using something like Word or Excel would be the easiest way to accomplisy your goal.

    The printer object in VB can be powerful, but it can also be limiting.
    Quote Originally Posted by PJB146
    Really I want the user to be able to use all properties available....booklet printing and saddle-stich stapling
    I don't even know what that is, but I feal reasonably comfortable in saying you aren't gonna get that out of Printer.Print

  7. #7
    Addicted Member
    Join Date
    Jul 2007
    Posts
    228

    Re: Printing using printer properties

    Just a thought, PJB... Since most printers include a software interface for setting it's myriad of options, could you not just shell that interface from your program?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width