Freigeben über


XPS Rasterization Service (on the WDK Documentation Blog)

An area that we received a lot of feedback on when we originally introduced the XPS Print Path was support for rasterization. In this context, rasterization is the process of converting from the page description language used in the print system to raster data that can be easily consumed by a printer. For (what I’ll call here) ‘enterprise’ class devices, the PDL is transmitted to the device and rasterization is performed by an embedded print controller. (Typically these are network connected devices where the bandwidth improvements enabled by using XPS as the PDL are beneficial and the last thing you want to do is create large amounts of raster data on the host PC and ship that over the network.) However, for many, often inkjet-based USB-connected, devices at lower price points,  it’s not possible to consume the PDL directly on the device. Instead they rely on the host PC to generate print ready raster data that’s been created from the PDL and appropriately color managed and processed ready to drive the print heads.

One of the problems implementers faced with the XPS Print Path was that although XPS provided a number of benefits, we didn’t deliver platform support for all of those capabilities to the same level as we had in the GDI print path. Not providing support for XPS rasterization, when this was provided when working with the GDI print path, was something that we’d wanted to do, but weren’t able to in the Windows Vista timeframe.

Hence, the XPS Rasterization Service, a Windows 7 component that can be used by driver developers to create raster data for printers. The component is designed for use within the filter pipeline of the XPS Print Path, and can be used alongside existing filters or used as the basis for new XPSDrv development. Seth McEvoy, an programming writer on the WDK team, has posted details of the XPS Rasterization Service on the WDK Documentation Blog and you’ll also find an overview and links to reference documentation on MSDN.

The concept for using the component is straightforward: you pass XPS content into the rasterizer in the form of an IXpsOMPage and it gives you back raster data in the form of an IWICBitmap. The component also provides control for rasterization resolution, anti-aliasing mode, and the region of the FixedPage to rasterize.

Internally, the XPS Rasterization component builds on a number of Windows 7 APIs. The most important of which are:

  • Direct2D: provides high quality, high performance, 2D rendering and is compatible with the imaging model underlying XPS (see Tom’s overview)
  • DirectWrite: provides high quality text support (see Worachai’s E7 post)
  • WIC: a framework for working with images (see MSDN), and
  • XPS Document API: provides support, and an object model, for XPS Documents

Direct2D, DirectWrite and the XPS Document API are also new in Windows 7.

Finally, if you’re not developing drivers but still want to rasterize XPS, easily, don’t forget RenderTargetBitmap in .Net.