More Secure Printing in Windows Forms

Windows Forms applications frequently include printing abilities. The .NET Framework uses the PrintingPermission class to control access to printing capabilities and the associated PrintingPermissionLevel enumeration value to indicate the level of access. By default, printing is enabled by default in the Local Intranet and Internet zones; however, the level of access is restricted in both zones. Whether your application can print, requires user interaction, or cannot print depends upon the permission value granted to the application. By default, the Local Intranet zone receives DefaultPrinting access and the Intranet zone receives SafePrinting access.

The following table shows the functionality available at each printing permission level.

PrintingPermissionLevel Description
AllPrinting Provides full access to all installed printers.
DefaultPrinting Enables programmatic printing to the default printer and safer printing through a restrictive printing dialog box. DefaultPrinting is a subset of AllPrinting.
SafePrinting Provides printing only from a more-restricted dialog box. SafePrinting is a subset of DefaultPrinting.
NoPrinting Prevents access to printers. NoPrinting is a subset of SafePrinting.

See also