Sunday 15 July 2012

c# - Changing printer settings -


Then I have a code and when the dialog opens, it shows that the printer settings change to print two-sided , But when I right click and print it does not print double-side, but when I manually select double-side, it prints correctly. Any idea what might be the case? Thank you in advance for your help. Using ASP.NET Web Application

  (PrintDialog pd = new PrintDialog ()) {PrinterSettings ps = new PrinterSettings (); Ps.duplex = Duplex Horizontal; Pd.PrinterSettings = ps; // pd.UseEXDialog = True; If (pd.ShowDialog () == DialogResult.OK) {ProcessStartInfo info = new ProcessStartInfo (filePath); Info.Verb = "print"; Info.CreateNoWindow = True; Info.WindowStyle = Process WindowStyle.Hidden; Process.Start (info); }}    

You can check it PrinterSettings.CanDuplex Property Just set

  printer settings settings = new printer settings ();   

and check whether your printer supports it or not.

  • This property indicates whether the printer supports double-sided printing.
  • This printer returns true if the printer supports double-sided printing; Otherwise, false .

    You can just do this:

      printed pd = new printDialog (); Print document MyPrintDocument = new print document (); MyPrintDocument.PrintPage + = New PrintPage Event Handler (PrintPage Event); Pd.PrinterSettings.PrintRange = PrintRange.AllPages; MyPrintDocument.PrinterSettings.PrintRange = PrintRange.AllPages; MyPrintDocument.Print ();   

    Where PrintPageEvent at print () ;

No comments:

Post a Comment