PrintManager Class
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Provides the entry-point for printing within an application.
public ref class PrintManager sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class PrintManager final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class PrintManager
Public NotInheritable Class PrintManager
- Inheritance
- Attributes
Device family |
Windows 10 (introduced in 10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox)
|
API contract |
Windows.Foundation.UniversalApiContract (introduced in v1.0)
|
The PrintManager class is responsible for orchestrating the printing flow for UWP apps. To use this class, you must first call the GetForCurrentView method. This method returns the PrintManager object that is specific to the current active window. Next, you must add an event listener for the PrintTaskRequested event. This event is raised when the application invokes the printing dialog via the ShowPrintUIAsync method.
When a UWP app registers its "intention" to print, it creates a print contract with the print manager. In the UWP print sample, registration is performed by the RegisterForPrinting
method.
public virtual void RegisterForPrinting()
{
printDocument = new PrintDocument();
printDocumentSource = printDocument.DocumentSource;
printDocument.Paginate += CreatePrintPreviewPages;
printDocument.GetPreviewPage += GetPrintPreviewPage;
printDocument.AddPages += AddPrintPages;
PrintManager printMan = PrintManager.GetForCurrentView();
printMan.PrintTaskRequested += PrintTaskRequested;
}
For more examples involving the print manager and to see some sample code for printing scenarios in UWP apps, see Printing and the UWP print sample..
Windows version | SDK version | Value added |
---|---|---|
1607 | 14393 | IsSupported |
Get |
Retrieves the PrintManager object associated with the current window. |
Is |
Indicates whether or not the app is running on a device that supports printing. |
Show |
Programmatically initiates the user interface for printing content. |
Print |
Raised when a request to print has occurred. This event may be triggered by user action or via programmatic invocation of printing via the ShowPrintUIAsync method. |
Product | Versions |
---|---|
WinRT | Build 10240, Build 10586, Build 14383, Build 15063, Build 16299, Build 17134, Build 17763, Build 18362, Build 19041, Build 20348, Build 22000, Build 22621, Build 26100 |