void InvokePrint() { using (Image img = surface.GetImageForExport()) { PrintHelper ph = new PrintHelper(img, surface.CaptureDetails); this.Hide(); this.Show(); PrinterSettings ps = ph.PrintWithDialog(); if (ps != null) { surface.Modified = false; updateStatusLabel(lang.GetFormattedString(LangKey.editor_senttoprinter, ps.PrinterName)); } } }
/// <summary> /// Export the capture to the printer /// </summary> /// <param name="manuallyInitiated"></param> /// <param name="surface"></param> /// <param name="captureDetails"></param> /// <returns>ExportInformation</returns> public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { ExportInformation exportInformation = new ExportInformation(Designation, Description); PrinterSettings printerSettings = null; if (!string.IsNullOrEmpty(printerName)) { using (PrintHelper printHelper = new PrintHelper(surface, captureDetails)) { printerSettings = printHelper.PrintTo(printerName); } } else if (!manuallyInitiated) { PrinterSettings settings = new PrinterSettings(); using (PrintHelper printHelper = new PrintHelper(surface, captureDetails)) { printerSettings = printHelper.PrintTo(settings.PrinterName); } } else { using (PrintHelper printHelper = new PrintHelper(surface, captureDetails)) { printerSettings = printHelper.PrintWithDialog(); } } if (printerSettings != null) { exportInformation.ExportMade = true; } ProcessExport(exportInformation, surface); return exportInformation; }