Skip to main content

Overview

Version: 4.0

Programming Overview

DynamicPDF PrintManager for .NET is a straightforward yet powerful SDK for printing PDF documents from .NET applications. Whether you need to print a single PDF using default settings or build advanced printing workflows with custom scaling, paper trays, duplex printing, and event handling, the SDK is designed to make PDF printing simple and efficient.

The PrintManager object model centers around three primary classes.

Typical Print Workflow​

Most PrintManager applications follow the same general workflow:

  1. Create a PrintJob.
  2. Select a printer.
  3. Configure print options.
  4. Optionally subscribe to print events.
  5. Call the Print() method.

The PrintJob Class​

The PrintJob class is the central class used when printing PDF documents. A PrintJob represents a single print operation and contains the PDF documents, printer settings, print options, selected pages, and event handlers associated with that operation.

In most scenarios, creating a PrintJob is the first step when using DynamicPDF PrintManager.

The PrintJob class provides several constructor overloads for creating print jobs using a printer name, a Printer object, a file path, or an InputPdf object.

The following is a simple example using the PrintJob class to print a PDF.

PrintJob printJob = new PrintJob(Printer.Default, Util.GetPath("Resources/DocumentA.pdf"));
printJob.Print();

The PrintJob class provides ten constructors that allow initializing a PrintJob by specifying the printer, the input PDF document, and the page range to print.

Properties​

The PrintJob class provides properties for managing and monitoring a print job, including the target printer, pages to print, print options, document name, print priority, spooler status, and overall job status. These properties also allow tracking printing progress, retrieving the job identifier, and specifying an output filename when printing to a file.

Methods​

The PrintJob class provides methods for managing the print job lifecycle, including adding a license, printing the document, and releasing resources when printing is complete. It also inherits several standard .NET object methods such as Equals, GetHashCode, GetType, and ToString.

Events​

The PrintJob class supports several events that allow applications to monitor and respond to the printing process. These events can be used to track print progress, detect failures, and perform actions before or after a print job completes.

Printer​

The Printer class represents a physical or virtual printer installed on the system. You can use Printer.Default, create one by name (e.g. new Printer("Printer Name")), or access it via PrintJob.Printer.

The Printer class allows your application to determine which capabilities a printer supports, including:

  • Color printing
  • Duplex printing
  • Supported paper sizes
  • Available paper trays
  • Supported resolutions
  • Available media types

This allows applications to validate printer capabilities before applying print settings.

Properties​

The Printer class provides properties for retrieving information about a printer and its capabilities. These properties allow applications to determine whether a printer supports features such as color printing, duplex printing, collating, and faxing, as well as retrieve supported paper sizes, paper trays, media types, resolutions, copy limits, and printer driver information. The class also provides access to the system’s default printer and the printer’s supported paper dimension ranges.

Methods​

The Printer class provides methods for retrieving and refreshing printer information. These methods allow applications to retrieve the system’s local printers, refresh printer capabilities and custom settings such as paper sizes or paper trays, and access standard inherited .NET object functionality including equality comparison, type information, hash generation, and string representation.

The PrintJobPrintOptions Class​

The PrintJobPrintOptions class controls how a PDF document is printed. Print options are accessed through the PrintJob.PrintOptions property.

Programmatically configuring print options is similar to selecting settings in the Windows print dialog box before printing a document manually.

Common print options include:

  • Copies
  • Duplex mode
  • Scaling
  • Paper size
  • Paper source
  • Orientation
  • Resolution
  • Annotation printing

Properties​

The PrintJobPrintOptions class provides properties for controlling how a PDF document is printed. These properties allow applications to configure print settings such as copies, collating, color printing, duplex mode, paper size, paper tray, media type, resolution, page scaling, alignment, orientation, and annotation printing. Together, these options provide fine-grained control over the appearance and behavior of printed output.

Methods​

The PrintJobPrintOptions class provides methods for configuring printer settings and managing print option resources. These methods allow applications to set paper sizes, paper trays, media types, and resolutions by name or DPI value, as well as release resources when printing is complete. The class also inherits standard .NET object methods for equality comparison, type information, hash generation, and string representation.

GitHub​

Refer to the print-manager-dotnet-core project on GitHub for examples demonstrating how to use the DynamicPDF PrintManager for .NET.