By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,267 Members | 1,861 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,267 IT Pros & Developers. It's quick & easy.

Print duplex on network printer

P: n/a


In my application I need to give the user the ability to print duplex if the
selected printer supports duplex printing. Many of the printer options do
not make much sense in my application, and many of the settings in the common
printer dialog would have a negative impact on my printing process. To
handle this strict printing constraint on which my application imposes I do
not want to show the common print dialog. I want to be able to change the
settings from within code. I have run across one problem using the duplex
property off the PrinterSettings object. On this page,
http://msdn.microsoft.com/library/de...classtopic.asp,
it states that the duplex property specifies the printer’s duplex setting.
This seems to only work if the printer is installed as a local printer. I am
not sure if this is related or not, but I found this article stating a
problem in printing duplex on a network printer for Word automation.
http://support.microsoft.com/kb/q230743/. I installed my network printer as
a local printer as the article stated for testing purposes. The code I
provided below did in fact print duplex. I don’t wish to have to say that my
application only supports local printers. If a network printer is used and I
show the print dialog and I navigate to the printer properties dialog and
change the duplex setting to duplex, the application does indeed print duplex
as well. I can understand if the user printing on a network printer doesn’t
have access to print duplex and the print command throws some type of access
denied error. Which if I try to open the printer using API’s I do get an
access denied error if I use the level of access required to set the duplex
property. What confuses me is if I show the print dialog, the changing of
the duplex property works. Is there a way to reproduce that same behavior
from within code? Also is there a way to detect whether or not the setting
of the duplex property worked from within code as well?

Friend WithEvents pctPrintDocument As System.Drawing.Printing.PrintDocument

Friend WithEvents pctPrintDialog As System.Windows.Forms.PrintDialog

.......
If optDuplexDouble.Checked Then
pctPrintDialog.Document = Me.pctPrintDocument
pctPrintDocument.PrinterSettings.Duplex = Duplex.Vertical
pctPrintDocument.DefaultPageSettings.PrinterSettin gs.Duplex =
Duplex.Vertical
pctPrintDialog.PrinterSettings.Duplex = Duplex.Vertical
Else
Me.pctPrintDocument.PrinterSettings.Duplex = Duplex.Simplex
End If
.......
Aug 26 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.