Search code examples
windowsprintingwindows-store-appswinjs

WinJS Windows App - When I print a page, Is there a way to specify the printer?


To print my pages, I have something like that:

function onPrintTaskRequested(printEvent) {
    var printTask = printEvent.request.createPrintTask("Print Page", function (args) {

        // Get the print document source
        var src = MSApp.getHtmlPrintDocumentSource(document);
        args.setSource(src); 

        // Register the handler for print task completion event
        printTask.oncompleted = onPrintTaskCompleted;
    });
}

I would like specify the printer for the user does not need to choose the printer and print automatticly. Can I do that?


Solution

  • No. The user is always involved in the printing workflow in a straight Windows Store app. The app can offer the print UI, and it can suggest default general settings, but it can't pick a specific printer or print without the user's confirmation.

    If you have a side-loaded app (in a kiosk, for example), then you can create a Brokered Windows Runtime Component and use desktop printing API on the desktop side of the brokered component.