locked
Details of Print document in metro app

    Question

  • Hi,

    I am a C++ developer and this is the first time I am working on Win 8. I am interested to understand how metro app actually prints some document on Printer. Like in case of desktop mode they uses GDI calls to write content, what is the mechanism used by microsoft in case of metro apps.

    Actually I have downloaded the sample print app and tried to understand it but I am not able to understand it completely. Actually my requirement is bit different then just simple print, what I am really interested in is to get the print document detail when any metro application tries to print .

    Is there any callback kind of mechanism or some event handling by which I can fetch the detail about print operation. Any sample code or link or any guidance in this regard is highly appreciated.

    Bishnu

    Friday, October 25, 2013 8:39 AM

Answers

  • This is not possible from a Windows Store app.

    You may be able to monitor this from a desktop app using the normal printer monitoring API, but you'll have to ask in the desktop development forums for more details.

    --Rob

    Wednesday, October 30, 2013 10:17 PM
    Owner

All replies

  • How are you rendering your data? Are you using Xaml or DirectX?

    The basic flow is to register with the PrintManager. When the user prints the app will get a PrintTaskRequested event in which it can create a task to associate a document source which will be called do the actual rendering for each page and page preview.

    If you're using Xaml then you'll end up passing a Xaml UIElement and the Xaml renderer will render it for you. If you're using DirectX you'll render the page image yourself.

    See Direct2D printing from Windows Store apps for DirectX
    See Printing (Windows Store apps using C#/VB/C++ and XAML) for Xaml

    --Rob

    Friday, October 25, 2013 7:16 PM
    Owner
  • You need to transplant the printer sample into your own code.

    I think it is the d2drender part is the basic part.

    Then make a call from that into your 3d rendering software to render the surface.

    If you are just printing a selected area of the screen then your main code will need to set up parameters for the rendering code.

    I did it for a pcb design program and it did take a while how to figure out which bits were needed of the sample and which bits I could throw away.

    I am in the process of reinstalling Windows and VS so don't have the code to hand at the moment.


    n.Wright


    Friday, October 25, 2013 8:51 PM
  • Hey Rob,

    Sorry for late reply, got stuck with some other high priority work.

    I am not planning to write any application which supports prints, what I want is to monitor all other applications in the system, and get the information  what they are printing.

    What I am interested in is to monitor if any metro application is about to print some document on printer then I can fetch its content \ path.

    Wednesday, October 30, 2013 6:18 AM
  • This is not possible from a Windows Store app.

    You may be able to monitor this from a desktop app using the normal printer monitoring API, but you'll have to ask in the desktop development forums for more details.

    --Rob

    Wednesday, October 30, 2013 10:17 PM
    Owner