XPS Filters

Important

The modern print platform is Windows' preferred means of communicating with printers. We recommend that you use Microsoft's IPP inbox class driver, along with Print Support Apps (PSA), to customize the print experience in Windows 10 and 11 for printer device development.

For more information, see Modern print platform and the Print support app design guide.

For the XPS print path, filters are the primary way that a driver prepares print data for the printer. In versions of the Microsoft Windows operating system before Windows Vista, print processors and rendering modules did the work of filters.

An XPS filter is a DLL that exports DllGetClassObject and DllCanUnloadNow functions. The filter pipeline manager calls these functions when it loads and unloads the XPS filter DLL. After loading the filter DLL, the filter pipeline manager does the following:

Before unloading the filter DLL, the filter pipeline manager calls DllCanUnloadNow.

In some older XPS filters, the DllGetClassObject function retrieves a reference to the filter's IPrintPipelineFilter interface instead of to an IClassFactory interface. For backward compatibility, the filter pipeline manager in Windows Vista and later versions of Windows will continue to support these filters. However, for new filter designs, DllGetClassObject should retrieve a reference to an IClassFactory interface.

XPS filters make the printing subsystem more robust, because the filters run in a process different from the spooler. This "sandboxing" both protects against failures and allows a plug-in to run with different security permissions. XPSDrv also enables you to reuse filters across families of printers to lower costs and development time.

For maximum flexibility and reuse, each filter should perform a specific print processing function. For example, one filter would only apply a watermark, while another would only perform accounting.

For more information about the filter pipeline manager, see XPSDrv Render Module.

For more information about implementing filters, see Implementing XPS Filters.

For more information about asynchronous notifications in print filters, see Asynchronous Notifications in Print Filters.

You must configure filters by using the filter pipeline configuration file.

For information about how to debug the print filter pipeline service, see Attaching a Debugger to the Print Filter Pipeline Service.

In Windows 7, XPS filters can use the XPS rasterization service to convert fixed pages in XPS documents to bitmaps.

For information about the way Windows uses GPU acceleration for XPS rasterization, see XPSRas GPU Usage Decision Tree.