Windows 8 如何从Windows 8应用程序实现对特定打印机的打印

Windows 8 如何从Windows 8应用程序实现对特定打印机的打印,windows-8,winjs,Windows 8,Winjs,在遵循中的一些指导原则之后,我有了一些WinJS代码,使我能够检索所有连接到Windows 8机器的打印设备的枚举。我的问题是,如果我有这些信息,是否可以在不打开选择打印机的UI的情况下调用与特定打印机的打印合同 以下是用于枚举connect打印机的代码: logDevices: function () { // This is the GUID for printers var printerInterfaceClass="{0ecef634-6ef0-472

在遵循中的一些指导原则之后,我有了一些WinJS代码,使我能够检索所有连接到Windows 8机器的打印设备的枚举。我的问题是,如果我有这些信息,是否可以在不打开选择打印机的UI的情况下调用与特定打印机的打印合同

以下是用于枚举connect打印机的代码:

logDevices: function () {

        // This is the GUID for printers
        var printerInterfaceClass="{0ecef634-6ef0-472a-8085-5ad023ecbccd}";
        var selector="System.Devices.InterfaceClassGuid:=\"" + printerInterfaceClass + "\"";

        // By default, findAllAsync does not return the containerId 
        // for the device it queries.
        // We have to add it as an additonal property to retrieve.
        var containerIdField = "System.Devices.ContainerId";
        var propertiesToRetrieve = [containerIdField];

        // Asynchronously find all printer devices.
        Windows.Devices.Enumeration.DeviceInformation.findAllAsync(selector, propertiesToRetrieve)
            .done(function (devInfoCollection) {

                console.log("\n[DEV DASH] :   -------------------------------------------------------------------------------------------");
                devInfoCollection.forEach(function (deviceInfo) {

                    console.log("[DEV DASH] :   Printer : " + deviceInfo['name']);
                    console.log("[DEV DASH] :   ID      : " + deviceInfo['id']);
                    console.log("[DEV DASH] :   Enabled : " + deviceInfo['isEnabled']);
                    console.log("[DEV DASH] :   * * * * * * * * * * * * * * * * * * ");

                });
                console.log("[DEV DASH] :   -------------------------------------------------------------------------------------------");


            }, function (e) {

                console.log("[DEV DASH] : Error in obtaining device information: " + e.message);

            });

    }
我使用下面的代码来打开用户界面,允许用户选择打印设备,但是有没有办法用WinJS编程实现打印机的选择

Windows.Graphics.Printing.PrintManager.showPrintUIAsync();

谢谢

我猜这是Windows8世界里的一个鬼城?运气好吗?我想做一些类似的事情。没有。没有微软的代表试图回答这个问题。我想我可以跳上MSDN论坛,但是呃。好吧我有一封邮件给我在微软认识的一个人。我们会看看有没有结果。是的!我问“我可以绕过打印机选择并打印到默认打印机吗?”回答=否。我问“在用户选择打印机以确保它是允许的打印机类型(即不允许打印到pdf)后,我可以取回打印机详细信息吗?”回答=否。