Direct2D allows printing via ID2D1Device::CreatePrintControl, which presumably renders an XPS as an intermediate representation. With an XPS Document Writer or other printer, I can create an xps file via redirection from Direct2D. Can I create an ID2D1PrintControl or ID2D1DeviceContext against an XPS document without a print queue?
Is there some ID2D1DeviceMagic::CreatePrintControlOnStream(IStream* ...) or IPrintDocumentPackageTargetFactoryMagic::CreateOnXpsOM(IXpsOMPage* pPage, ...) I'm missing?
It's not magic, but almost. You can implement IPrintDocumentPackageTarget COM interface yourself and use it when calling the ID2D1Device::CreatePrintControl method.
In your implementation you can delegate the work to the IXpsOMObjectFactory::CreatePackageWriterOnStream method, so, it can be something like this:
This is the
CTargetsample class that implementsIPrintDocumentPackageTarget, andIXpsDocumentPackageTarget: