New for Windows 7 - XPS Print Driver Rasterization Service
The new XPS Print Rasterization service has been created to convert XPS documents to bitmaps, simplifying printer driver development by eliminating the need to write your own XPS filter conversion routine. Previous to Windows 7, you had to write extensive code to convert XML-based XPS documents to raster-based bitmaps. By making just a few simple method calls, you can take advantage of this new rasterization service to transform fixed pages in an XPS document to bitmap images suitable for your print device.
How Does It Work?
The XPS Print Driver Rasterization service is easy to use. You need to write only a few lines of COM filter code to access this feature.
The steps for using this service in an XPSDrv COM filter are:
· Get a reference to the Rasterization factory object from the print pipeline property bag. Use the IPrintPipelinePropertyBag::GetProperty method to retrieve the MS_IXpsRasterizationFactory object reference.
· IUnknown::QueryInterface to get the IXpsRasterizationFactory interface.
· Then call the IXpsRasterizationFactory::CreateRasterizer method to create XPS rasterizer objects.
· Create a new rasterizer object for every fixed page you want to render to a bitmap.
· When the factory object is no longer needed, the filter should release the object by calling the Release method on the object's IXpsRasterizationFactory interface.
The interfaces that are provided by the Rasterization service are:
IXpsRasterizationFactory
This interface provides a way to create rasterizer objects. It has one method, IXpsRasterizationFactory::CreateRasterizer, which creates a rasterizer object. You need one object for each XPS page you want to convert to a bitmap.
IXpsRasterizer
This interface does the actual conversion. It has two methods:
· IXpsRasterizer::RasterizeRect, which converts an XPS page to a bitmap.
· IXpsRasterizer::SetMinimalLineWidth, which sets the minimum line width for the conversion.
An XPSDrv filter should also implement the following interface if it needs to cancel an in-progress XPS rasterization operation before the operation completes:
This callback needs to implement one method, IXpsRasterizerNotificationCallback::Continue, which tells the rasterization service whether it should continue the conversion process or not.
Note: Because XPS Print Driver Rasterization service is a new development for Windows 7, it is not available on previous versions of Windows.
Want More Information?
See the following Windows Driver Kit topics:
-- Seth McEvoy [MSFT], WDK Senior Programmer Writer