Utilities

Below are some miscellaneous examples that show how to perform various tasks. These examples demonstrate how to retrieve a list of installed printers, set print job priority, send a fax and print to file.

List Installed Printers

The example below demonstrates how to retrieve a list of all printers (includes network printers for which a driver is installed).

Printer[] printerList = Printer.GetLocalPrinters();     
Dim printerList As Printer() = Printer.GetLocalPrinters()

Print Priority

The following example demonstrates specifying a print job priority. A value between 1 and 99 sets the job priority, where 99 is the highest priority. By default, the PrintPriority property value is set to 1. When the Windows print spooler receives multiple jobs with different priorities it prioritizes the spooled jobs with the highest print priority value.

InputPdf pdf = new InputPdf(pdfFilePath);
PrintJob printJob = new PrintJob(Printer.Default, pdf);
printJob.PrintPriority = 10;
printJob.Print();     
Dim pdf As InputPdf = New InputPdf(pdfFilePath)
Dim printJob As PrintJob = New PrintJob(Printer.Default, pdf)
printJob.PrintPriority = 10
printJob.Print()

Redirect to File

The following example demonstrates how to redirect a PDF document to a file instead of actually printing a document.

PrintJob printJob = new PrintJob(Printer.Default, pdfFilePath);
printJob.PrintToFileName = prnFilePath;
printJob.Print();   
Dim printJob As New PrintJob(Printer.Default, pdfFilePath)
printJob.PrintToFileName = prnFilePath      
printJob.Print()  

In this topic