/// <summary> /// プレビューしている <see cref="Document"/> を印刷します。 /// </summary> /// <param name="settings">印刷設定。</param> /// <exception cref="NullReferenceException">印刷するドキュメントは null です。</exception> /// <exception cref="PrintQueueException">印刷準備ができていません。</exception> public void Print(PrintSettings settings = null) { if (Document == null) { throw new NullReferenceException("印刷するドキュメントは null です。"); } if (settings != null) { UpdateSettings(settings); } PrintController.Print(Document); }
/// <summary> /// プリンター性能に影響する印刷設定を更新します。 /// </summary> /// <param name="settings">印刷設定。</param> public void UpdateCapabilities(PrintSettings settings) { PrintController.UpdateQueue(settings.SelectedPrinter); var caps = PrintController.PrintCapabilities.DuplexingCapability; if (caps.Contains(settings.Duplexing)) { PrintController.PrintTicket.Duplexing = settings.Duplexing; } else { PrintController.PrintTicket.Duplexing = Duplexing.OneSided; } }
public PrintStatus OnPrint(PrintJob printJob) { PrintSettings printSettings = printJob.PrintSettings; printSettings.PrinterName = "Microsoft XPS Document Writer"; printSettings.Landscape = false; printSettings.PrintBackgrounds = false; printSettings.ColorModel = ColorModel.COLOR; printSettings.DuplexMode = DuplexMode.SIMPLEX; printSettings.DisplayHeaderFooter = true; printSettings.Copies = 1; printSettings.PaperSize = PaperSize.ISO_A4; List <DotNetBrowser.PageRange> ranges = new List <DotNetBrowser.PageRange>(); ranges.Add(new DotNetBrowser.PageRange(0, 3)); printSettings.PageRanges = ranges; printJob.PrintJobEvent += delegate(object sender, PrintJobEventArgs e) { Console.WriteLine("Printing is finished successfully: " + e.Success); }; return(PrintStatus.CONTINUE); }
protected void UpdateSettings(PrintSettings settings) { PrintController.PrintTicket.CopyCount = settings.Copies; }