GetEmbeddedFonts Method

Summary
Gets the embedded fonts created by a print job.
Syntax
C#
C++/CLI
public string[] GetEmbeddedFonts( 
   string fontSavePath, 
   int jobId 
) 
public: 
array<String^>^ GetEmbeddedFonts(  
   String^ fontSavePath, 
   int jobId 
)  

Parameters

fontSavePath
Path of folder to copy fonts to

jobId
job id

Return Value

An array of strings that contain the name of the embedded fonts.

Remarks

Printing from certain application (like adobe) require some embedded fonts to be present on the machine in order to save the file correctly, using this function the user can get the fonts sent to the printer from printing.

The user can then install, copy, move, and uninstall these fonts.

This function should be used in the JobEvent, and only in the job end stage.

Example
C#
using Leadtools.Printer; 
using Leadtools; 
 
 
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); 
} 
 
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 received", 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); 
} 
Requirements

Target Platforms

See Also

Reference

Printer Class

Printer Members

Help Version 22.0.2023.1.25
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Printer Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.