←Select platform

Install Method

Summary

Installs the LEADTOOLS Virtual Printer to the system.

Syntax

C#
VB
C++
public static void Install( 
   PrinterInfo printerInfo 
) 
  
Public Shared Sub Install( _ 
   ByVal \_printerInfo\_ As Leadtools.Printer.PrinterInfo _ 
)  
public: 
static void Install(  
   Leadtools.Printer.PrinterInfo^ \_printerInfo\_ 
)  

Parameters

printerInfo
Information to be used when installing the printer.

Remarks

To uninstall a printer from the system, call the UnInstall method.

Example

C#
VB
using Leadtools.Printer; 
using Leadtools; 
 
public void InstallNewPrinter() 
{ 
   try 
   { 
      string printerName = "Test LEADTOOLS Printer3"; 
      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.\\19\\Printer\\"; 
      PrinterInfo printerInfo = new PrinterInfo(); 
      printerInfo.MonitorName = printerName; 
      printerInfo.PortName = printerName; 
      printerInfo.DriverName = printerName; 
      printerInfo.ProductName = printerName; 
      printerInfo.PrinterName = printerName; 
      printerInfo.Password = printerPassword; 
      printerInfo.RegistryKey = documentPrinterRegPath + printerName; 
      printerInfo.RootDir = @"C:\LEADTOOLS 19\Bin\Common\PrinterDriver"; 
      printerInfo.Url = "https://www.leadtools.com"; 
      printerInfo.PrinterExe = Application.ExecutablePath; 
      printerInfo.AboutString = "LEADTOOLS Printer"; 
      printerInfo.AboutIcon = Path.Combine(LEAD_VARS.ImagesDir, @"\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)); 
   } 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images"; 
} 
Imports Leadtools.Support.Examples 
Imports Leadtools.Printer 
Imports Leadtools 
   ''' <!--Leadtools.Printer.Printer.GetPrinterInfo--> 
      If Printer.IsLeadtoolsPrinter(printerName) Then 
   ''' <!--Leadtools.Printer.Printer.GetPrinterInfo--> 
   ''' <!--Leadtools.Printer.Printer.Install--> 
         If (Printer.IsLeadtoolsPrinter(printerName)) Then 
         printerInfo.Url = "http://www.LeadtoolsPrinterDriver.com" 
   ''' <!--Leadtools.Printer.Printer.Install--> 
   ''' <!--Leadtools.Printer.Printer.Specifications--> 
         If (Printer.IsLeadtoolsPrinter(printerName)) Then 
         printerInfo.Url = "http://www.LeadtoolsPrinterDriver.com" 
   ''' <!--Leadtools.Printer.Printer.Specifications--> 
   ''' <!--Leadtools.Printer.Printer.RemoteData--> 
   ''' <!--Leadtools.Printer.Printer.RemoteData--> 
   ''' <!--Leadtools.Printer.Printer.EnableInternetPrinting--> 
   ''' <!--Leadtools.Printer.Printer.EnableInternetPrinting--> 
 
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.\\19\\Printer\\" 
      Dim printerInfo As New PrinterInfo() 
      printerInfo.MonitorName = printerName 
      printerInfo.PortName = printerName 
      printerInfo.DriverName = printerName 
      printerInfo.ProductName = printerName 
      printerInfo.PrinterName = printerName 
      printerInfo.Password = printerPassword 
      printerInfo.RegistryKey = documentPrinterRegPath + printerName 
      printerInfo.RootDir = "C:\\LEADTOOLS 19\\Bin\\Common\\PrinterDriver" 
      printerInfo.Url = "http://www.LeadtoolsPrinterDriver.com" 
      printerInfo.PrinterExe = Application.ExecutablePath 
      printerInfo.AboutString = "LEADTOOLS Printer" 
      printerInfo.AboutIcon = Path.Combine(LEAD_VARS.ImagesDir, "\\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 
 
Public NotInheritable Class LEAD_VARS 
   Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images" 
End Class 

Requirements

Target Platforms

See Also

Reference

Printer Class

Printer Members

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Printer Assembly