【问题标题】:Print button in Windows 8 Store app HTML + JS for Split Template appWindows 8 Store 应用程序中的打印按钮 HTML + JS for Split Template 应用程序
【发布时间】:2013-05-09 17:57:46
【问题描述】:

我有一个用 WinJS 制作的适用于 Windows 8 应用商店的应用,并且我使用拆分页面模板。因此,在拆分页面上,我有两列名为 List column 的列和名为 Item detail column 的列。用于菜谱,列表中是图片和小细节,物品详情块右侧是带有细节和图片的菜谱。我想要一个打印按钮,它只打印带有详细信息的右列,而不是带有列表等的整个窗口。

谁能给我一个比 msdn 更好的例子?

【问题讨论】:

    标签: list windows-8 printing split winjs


    【解决方案1】:

    取自 codeshow.codeplex.com 以打印片段:

    
     function printFrag(printEvent) {
            var printTask = printEvent.request.createPrintTask("codeSHOW Print Frag", function (args) {
                var frag = document.createDocumentFragment();
                frag.appendChild(q(".print #printFromApp").cloneNode(true));
                args.setSource(MSApp.getHtmlPrintDocumentSource(frag));
                // Register the handler for print task completion event
                printTask.oncompleted = printTaskCompleted;
            });
        }
    
    

    这又是克隆这个 html 节点然后打印它

    <div id="printFromApp">
        <h2>Invoke print</h2>
        <p>Wow, printing is fun.</p>
        <button id="invokePrint">Print</button>
    </div>

    所有的打印样本大部分都可以从那里剪切和粘贴,检查一下。它也可在 Windows 应用商店中获得,并且是 Windows 应用商店应用必不可少的 HTML/JS 开发工具。

    【讨论】:

      猜你喜欢
      • 2014-03-21
      • 2023-03-14
      • 2023-03-10
      • 2013-07-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-10-12
      • 2014-02-11
      相关资源
      最近更新 更多