LEADTOOLS Virtual Printer (Leadtools.Printer assembly)

RemoteData Property

Show in webframe
Example 





Gets the remote data related to the current printed job.
Syntax
public PrintJobData RemoteData {get;}
'Declaration
 
Public ReadOnly Property RemoteData As PrintJobData
'Usage
 
Dim instance As Printer
Dim value As PrintJobData
 
value = instance.RemoteData

            

            
public:
property PrintJobData^ RemoteData {
   PrintJobData^ get();
}

Property Value

The remote data wrapper class.
Remarks

When printing a job from a remote machine, the data will be recieved in the server machine.

This property will return the data related to the current printe job.

This parameter will be available between JobStart and JobEnd for a given job.

This data has been sent from the client machine in the Leadtools.Printer.Client.IVirtualPrinterClient.PrintJob(Leadtools.Printer.Client.PrintJobData) method.

Example
Copy Code  
Imports Leadtools.Support.Examples
Imports Leadtools.Printer
Imports Leadtools

Private Sub printer_NetworkJobEvent(ByVal sender As Object, ByVal e As JobEventArgs) Handles networkPrinter.JobEvent
   Dim printerName As String = e.PrinterName
   Dim jobID As Integer = e.JobID
   If e.JobEventState = EventState.JobStart Then
      'get the remote data sent from client
      Dim jobData As PrintJobData = networkPrinter.RemoteData

      MessageBox.Show(String.Format("Job {0} was started with printer {1} from remote client", jobData.PrintJobName, jobData.VirtualPrinterName))

   ElseIf e.JobEventState = EventState.JobEnd Then
      Dim arrFonts As String() = networkPrinter.GetEmbeddedFonts("C:\path to save file", e.JobID)
      If Not arrFonts Is Nothing AndAlso arrFonts.Length > 0 Then
         MessageBox.Show(String.Format("{0} fonts recieved", arrFonts.Length))
      End If

      MessageBox.Show(String.Format("Job {0} was ended with printer {1}", jobID, printerName))
   Else
      networkPrinter.CancelPrintedJob(jobID)
   End If
End Sub

Private WithEvents networkPrinter As Printer

Public Sub SetNetworkData(ByVal strData As String)
   Dim bytes As Byte() = Encoding.ASCII.GetBytes(strData)

   'Set initial network data
   networkPrinter.SetNetworkInitialData(bytes)
End Sub

Public Function GetNetworkData() As String
   Dim bytes As Byte()

   'Get initial network data
   bytes = networkPrinter.GetNetworkInitialData()

   Return Encoding.ASCII.GetString(bytes)
End Function

Public Sub PrinterDriverNetworkExamples()
   networkPrinter = New Printer("Test LEADTOOLS Printer")
   ' Set network printing enable
   networkPrinter.EnableNetworkPrinting = True

   'Check network printing state
   Dim bNetworkEnabled As Boolean = networkPrinter.EnableNetworkPrinting

   Dim strData As String = "Network Printer Initial Data"
   'Set network initial data
   SetNetworkData(strData)

   'Get network initial data
   Dim strRet As String = GetNetworkData()

   If strRet <> strData Then
      Return
   End If
End Sub
using Leadtools.Printer;
using Leadtools;

void printer_NetworkJobEvent(object sender, JobEventArgs e)
{
   string printerName = e.PrinterName;
   int jobID = e.JobID;
   if (e.JobEventState == EventState.JobStart)
   {
      //get the remote data sent from client
      PrintJobData jobData = networkPrinter.RemoteData;

      MessageBox.Show(string.Format("Job {0} was started with printer {1} from remote client", jobData.PrintJobName, jobData.VirtualPrinterName));

   }
   else if (e.JobEventState == EventState.JobEnd)
   {
      string[] arrFonts = networkPrinter.GetEmbeddedFonts("C:\\path to save file", e.JobID);
      if (arrFonts != null && arrFonts.Length > 0)
      {
         MessageBox.Show(string.Format("{0} fonts recieved", arrFonts.Length));
      }

      MessageBox.Show(string.Format("Job {0} was ended with printer {1}", jobID, printerName));
   }
   else
   {
      networkPrinter.CancelPrintedJob(jobID);
   }
}

Printer networkPrinter;

public void SetNetworkData(string strData)
{
   byte[] bytes = Encoding.ASCII.GetBytes(strData);

   //Set initial network data
   networkPrinter.SetNetworkInitialData(bytes);
}

public string GetNetworkData()
{
   byte[] bytes;

   //Get initial network data
   bytes = networkPrinter.GetNetworkInitialData();

   return Encoding.ASCII.GetString(bytes);
}

public void PrinterDriverNetworkExamples()
{
   networkPrinter = new Printer("Test LEADTOOLS Printer");
   // Set network printing enable
   networkPrinter.EnableNetworkPrinting = true;

   //Check network printing state
   bool bNetworkEnabled = networkPrinter.EnableNetworkPrinting;

   string strData = "Network Printer Initial Data";
   //Set network initial data
   SetNetworkData(strData);

   //Get network initial data
   string strRet = GetNetworkData();

   if (strRet != strData)
      return;

   networkPrinter.JobEvent += new EventHandler<JobEventArgs>(printer_NetworkJobEvent);
}
Requirements

Target Platforms

See Also

Reference

Printer Class
Printer Members

 

 


Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.

Leadtools.Printer requires a Printer module license and unlock key. It is included as part of LEADTOOLS Document Imaging Enterprise. For more information, refer to: Imaging Pro/Document/Medical Features