Print a document from a Surface application RRS feed

  • Question

  • Hi,

    I'm trying to print a document from a Surface application. I got this working with a PrintDocument, but when the unit is set to UserMode the application hangs when I hit the printbutton. I'm guessing the reason for that is the progressdialog, I think the Surface shell doesn't like it because it's a Windows dialog.

    So the question is: How can I print something (in this case an image) from a Surface application when the unit is set to UserMode?

    Kind regards, Rick

    I've tried something completely different: I generated an XPS file that contains the stuff I want to print. When I try to print this document using the following code, it prints perfectly without displaying any UI:

    PrintQueue defaultPrintQueue;
    LocalPrintServer localPrintServer;
    localPrintServer = new LocalPrintServer();
    defaultPrintQueue = LocalPrintServer.GetDefaultPrintQueue();
        PrintSystemJobInfo xpsPrintJob = defaultPrintQueue.AddJob("My print job", fileName, true);

    And still, when I try to print this way in UserMode, the application seems to freeze. Any ideas?

    Kind regards, Rick
    Wednesday, February 24, 2010 8:39 AM


  • Rick, you are correct about the popup dialog. The Surface Shell completely supresses all windows dialog boxes when in User Mode. So, if your application is waiting for user input from a windows dialog it will appear to hang.

    When you run in User Mode you are running under the TableUser account. Which probably does not have it's default printer settings configured. Here is a section of the documentation from Concierge on how to configure the default printer for the TableUser account...

    Setting Up the Printer

    To set up a printer

    1. In administration mode on the Microsoft Surface unit, install the driver for the printer that you want to set up.

      Note: By installing the printer driver as an administrator, you prevent User Access Control dialog boxes.

    2. On the Windows desktop, double-click the Enter User Mode shortcut.
    3. In the confirmation window, select the Enable troubleshooting and debugging in user mode check box, and then click Yes.
    4. In user mode, press CTRL+SHIFT+ESC on your keyboard to open the Windows Task Manager.
    5. In the Windows Task Manager, click File, and then click New Task (Run).
    6. Enter Control Printers, and then press ENTER.
    7. In the window that opens, select the printer that you are setting up, click Set as default or click Add a printer, and then follow the steps in the Add Printer wizard.

      Note: Concierge supports only physical printers and not software printers, such as Microsoft XPS Document Writer. We recommend that you do not set up a software printer as your default printer.

    8. Log off user mode, and then log on by using an administrator account.
    9. Open the Concierge Administration tool, and then enable the print feature and configure the print settings in Concierge.
    10. Double-click the Enter User Mode desktop shortcut, but do not select the Enable troubleshooting and debugging in user mode check box in the confirmation window.
    11. From Launcher, open Concierge, and then verify that the print directions feature works properly.

    Josh Curry (jcurry) | Sr. Support Escalation Engineer | Microsoft Surface Support
    Wednesday, February 24, 2010 10:15 PM