Printing an XPS document directly


  • Hi there,

    I am wondering how to print an XPS document from a Metro app. I've been looking into Win32 and COM for windows store apps, but I can't really figure out how to get the printer an XPS document. I'm assuming I have to go through the Windows.Graphics.Printing API somehow, but I'm not entirely clear how it works.

    I understand how printing works in general, and I've managed to set up a temporary solution where I generate bitmaps that I feed the printer. Clearly, this isn't ideal and I would very much like to be able to just generate an XPS document (I can currently generate XPS files quite easily) and just give it to the printer.



    Tuesday, September 11, 2012 5:26 PM

All replies

  • Looking into this currently as I'm not finding much documented on this without using D2D.

    David Lamb

    Thursday, September 13, 2012 1:58 AM
  • Thanks :)
    Friday, September 14, 2012 11:15 PM
  • Hi Tomas,

    I wanted to clarify your scenario. Are you using D2D in your app? The published guidance and samples were focused on this use scenario, using D2D to print XPS documents.

    Is this approach problematic in your scenario? If so, any details you can share as to why it is not preferred would be a huge help in our understanding of your needs.

    The samples:

    Direct2Dapp printing sample

    Direct2D printing images and effects sample


    David Lamb

    Friday, September 21, 2012 5:54 PM
  • Thanks for the reply.

    I am not directly using D2D. I am working on an app that displays documents. The core for the app is already written in C/C++ and one of it's functionalities is that it can convert a document to XPS. Basically, we're just creating and manipulating XML tags.

    Let me know if you need any other information.



    Friday, September 21, 2012 11:16 PM
  • What are you using for the UI? Is it a XAML only app, DirectX, or combination?

    David Lamb

    Friday, September 21, 2012 11:46 PM
  • The app is created using XAML, but the main tool extends Control, and consists of bitmaps rendered from the underlying document (using a completely different rendering engine).  The core that produces these images is not using D2D or DirectX at all.

    This scenario should be very close to what the Reader is dealing with (unless of course they do render their documents with DirectX or something).

    I hope this helps.

    Tuesday, October 2, 2012 11:25 PM