예제 #1
0
 public static bool PrintToImage(string printerName, Image image)
 {
     try
     {
         PrintDocument printDocument = DocumentHelper.BuildDefaultPrintDocument(image, printerName);
         printDocument.EndPrint += new PrintEventHandler(PrintDocument_EndPrint);
         printDocument.Print();
         return(true);
     }
     catch
     {
         return(false);
     }
     finally
     {
         image?.Dispose();
     }
 }