Take the following steps to create and run a program that installs a LEADTOOLS Network Client Printer.
In the "Solution Explorer" window, right-click on the "References" folder, and select "Add Reference..." from the context menu. In the "Add Reference" dialog box, select the ".NET" tab and browse to Leadtools For .NET "<LEADTOOLS_INSTALLDIR>\Bin\Dotnet\Win32 " folder and select the following DLLs:
Add a reference to System.Windows.Forms from the .NET tab of the Add References dialog.
Add the following code to the beginning of the file:
Imports System.Windows.Forms
Imports Leadtools.Printer.Client.Interfaces
using System.Windows.Forms
using Leadtools.Printer.Client.Installer;
Implement the IVirtualPrinterClient interface using the following code:
Public Class MyVirtualPrinterClient
Implements IVirtualPrinterClient
public class MyVirtualPrinterClient : IVirtualPrinterClient
The created class needs to implement the three IVirtualPrinterClient methods. Open MyVirtualPrinterClient.cs and implement the following methods:
bool IVirtualPrinterClient.Startup(string virtualPrinterName, byte[] initialData) - This function will get called by the Virtual Printer Driver at startup
virtualPrinterName: printer name
initialData: will hold the initialization data sent from server.
Implement the Startup with the following code:
Private Function Startup(ByVal virtualPrinterName As String, ByVal initialData As Byte()) As Boolean Implements IVirtualPrinterClient.Startup
MessageBox.Show("Job received from " & virtualPrinterName & "printer")
Return True
End Function
bool IVirtualPrinterClient.Startup(string virtualPrinterName, byte[] initialData)
{
MessageBox.Show("Job received from " + virtualPrinterName + "printer");
return true;
}
bool IVirtualPrinterClient.PrintJob(PrintJobData printJobData) - This function will be called as the print job is received by the driver.
printJobData: contains printer data for this job
Implement the PrintJob method using the following code:
Private Function PrintJob(ByVal printJobData As PrintJobData) As Boolean Implements IVirtualPrinterClient.PrintJob
MessageBox.Show("Job data Ip Address = " & printJobData. IpAddress & " Job ID = " & printJobData.JobID)
'the UserData will be sent to the server machine
'this data can be any user specified data format
printJobData.UserData = New Byte() { CByte("H"c), CByte("E"c), CByte("L"c), CByte("L"c), CByte("O"c) }
Return True
End Function
bool IVirtualPrinterClient.PrintJob(PrintJobData printJobData)
{
MessageBox.Show("Job data Ip Address = " + printJobData. IpAddress + " Job ID = " + printJobData.JobID);
//the UserData will be sent to the server machine
//this data can be any user specified data format
printJobData.UserData = new byte[] { (byte)'H', (byte)'E', (byte)'L', (byte)'L', (byte)'O' };
return true;
}
void IVirtualPrinterClient.Shutdown(string virtualPrinterName) - This function will be called as a shutdown event
virtualPrinterName: Printer name
Implement the Shutdown method using the following code:
Private Sub Shutdown(ByVal virtualPrinterName As String) Implements IVirtualPrinterClient.Shutdown
MessageBox.Show("Shutdown received for " & virtualPrinterName & " printer")
End Sub
void IVirtualPrinterClient.Shutdown(string virtualPrinterName)
{
MessageBox.Show("Shutdown received for " + virtualPrinterName + " printer");
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.