Die Methode prüft ob der Drucker verfügbar ist.
using System.Drawing.Printing;
/// <summary>
/// Checks the printer.
/// </summary>
/// <param name="printerName">The printername.</param>
/// <returns></returns>
private bool CheckPrinter(string printerName)
{
bool online = false;
try
{
PrintDocument printDocument = new PrintDocument();
printDocument.PrinterSettings.PrinterName = printerName;
online = printDocument.PrinterSettings.IsValid;
}
catch
{
online = false;
}
return online;
}
1 Kommentare zum Snippet