diff --git a/Elwig/Helpers/Printing/Pdf.cs b/Elwig/Helpers/Printing/Pdf.cs index f7040d4..103405a 100644 --- a/Elwig/Helpers/Printing/Pdf.cs +++ b/Elwig/Helpers/Printing/Pdf.cs @@ -74,12 +74,16 @@ namespace Elwig.Helpers.Printing { } public static async Task Print(string path, int copies = 1) { - var p = new Process() { StartInfo = new() { FileName = PdfToPrinter } }; - p.StartInfo.ArgumentList.Add(path); - p.StartInfo.ArgumentList.Add("/s"); - p.StartInfo.ArgumentList.Add($"copies={copies}"); - p.Start(); - await p.WaitForExitAsync(); + try { + var p = new Process() { StartInfo = new() { FileName = PdfToPrinter } }; + p.StartInfo.ArgumentList.Add(path); + p.StartInfo.ArgumentList.Add("/s"); + p.StartInfo.ArgumentList.Add($"copies={copies}"); + p.Start(); + await p.WaitForExitAsync(); + } catch (Exception e) { + MessageBox.Show("Beim Drucken ist ein Fehler aufgetreten:\n\n" + e.Message, "Fehler beim Drucken"); + } } } }