472,133 Members | 997 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,133 software developers and data experts.

Print duplex on network printer



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
0 3062

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Maileen | last post: by
reply views Thread by KohlerTommy | last post: by
reply views Thread by louiann | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.