Installs the LEADTOOLS Virtual Printer to the system.
Syntax
Parameters
- printerInfo
- Information to be used when installing the printer.
Example
Visual Basic | Copy Code |
---|
Public Sub InstallNewPrinter()
Try
Dim printerName As String = "Test LEADTOOLS Printer"
Dim printerPassword As String = "Test Password"
If (Printer.IsLeadtoolsPrinter(printerName)) Then
Dim tmpPrinterInfo As New PrinterInfo()
tmpPrinterInfo.PrinterName = printerName
tmpPrinterInfo.DriverName = printerName
Printer.UnInstall(tmpPrinterInfo)
End If
Dim documentPrinterRegPath As String = "SOFTWARE\\LEAD Technologies, Inc.\\Printer\\"
Dim printerInfo As New PrinterInfo()
printerInfo.DriverName = printerName
printerInfo.ProductName = printerName
printerInfo.PrinterName = printerName
printerInfo.Password = printerPassword
printerInfo.RegistryKey = documentPrinterRegPath + printerName
printerInfo.RootDir = "C:\\Program Files\\LEAD Technologies"
printerInfo.Url = "http://www.LeadtoolsPrinterDriver.com"
printerInfo.PrinterExe = Application.ExecutablePath
printerInfo.AboutString = "LEADTOOLS Printer"
printerInfo.AboutIcon = "c:\\RasterPro.ico"
Printer.Install(printerInfo)
Dim strMsg As String = String.Format("Installion {0} Completed Successfully", printerName)
MessageBox.Show(strMsg, "LEADTOOLS Printer Demo", MessageBoxButtons.OK, MessageBoxIcon.Information)
Catch ex As PrinterDriverException
MessageBox.Show(String.Format("Other error: Message:{0}", ex.Message))
End Try
End Sub |
C# | Copy Code |
---|
public void InstallNewPrinter() { try { string printerName = "Test LEADTOOLS Printer"; string printerPassword = "Test Password"; if (Printer.IsLeadtoolsPrinter(printerName)) { PrinterInfo tmpPrinterInfo = new PrinterInfo(); tmpPrinterInfo.PrinterName = printerName; tmpPrinterInfo.DriverName = printerName; Printer.UnInstall(tmpPrinterInfo); } string documentPrinterRegPath = "SOFTWARE\\LEAD Technologies, Inc.\\Printer\\"; PrinterInfo printerInfo = new PrinterInfo(); printerInfo.DriverName = printerName; printerInfo.ProductName = printerName; printerInfo.PrinterName = printerName; printerInfo.Password = printerPassword; printerInfo.RegistryKey = documentPrinterRegPath + printerName; printerInfo.RootDir = @"C:\Program Files\LEAD Technologies"; printerInfo.Url = "http://www.Leadtools.com"; printerInfo.PrinterExe = Application.ExecutablePath; printerInfo.AboutString = "LEADTOOLS Printer"; printerInfo.AboutIcon = @"C:\RasterPro.ico"; Printer.Install(printerInfo); string strMsg = string.Format("Installion {0} Completed Successfully", printerName); MessageBox.Show(strMsg, "LEADTOOLS Printer Demo", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (PrinterDriverException ex) { MessageBox.Show(string.Format("Other error: Message:{0}", ex.Message)); } } |
Remarks
Requirements
Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Server 2003 family, Windows Server 2008 family
See Also