Printer extension library overview for UWP device apps
This topic introduces the printer extension library, a library that helps device manufacturers write UWP device apps for their printer. The printer extension library is included with the Print settings and print notifications sample, and also the Job management and printer maintenance sample.
A high level design goal for the v4 printer driver architecture was to provide built-in support for the Microsoft Store app user interface. To provide access to the printer, the v4 print driver exposes COM-based Printer Extension Interfaces.
To access those interfaces from your UWP device app, you can use the printer extension library that is included with the Microsoft Store device app printer samples. The printer extension library wraps the COM implementation of the COM interface
PrinterExtensionLib. This enables code sharing between printer extensions and your UWP device app.
Within the PrinterExtensionLibrary project that is included with the printer samples, there are two C# files. These files wrap the contents of PrinterExtensionLib. But additional classes could be added at this layer in order to enable code sharing between printer extensions and UWP device apps .
PrinterExtensionTypes.cs specifies a number of helpful enumerations, constants and interfaces that wrap the COM PrinterExtensionLib APIs.
PrinterExtensionAdapters.cs specifies all of the constructable classes used to wrap the COM PrinterExtensionLib APIs.
You can augment this project with any necessary C# files that describe common model layer code necessary to build your printer extension and/or UWP device app. However, we don't recommend updating the existing classes, as this will make it more difficult to incorporate any bug fixes that made available through updates to the samples.
An additional project named DeviceAppForPrintersLibrary, provides helper classes and methods for C# apps that you can use to access printers from your UWP device app.
PrinterNotificationHelper.cs demonstrates how to show toast UI for notifications.
The Output type for the PrinterExtensionHelperLibrary assembly is specified on Application page of the project properties window.