javascript - UWP getHtmlPrintDocumentSourceAsync 问题(与 x-ms-webview 一起使用时)
问题描述
我的应用程序使用 x-ms-webview 来满足其他要求。我们创建 HTML 元素 x-ms-webview 并将其添加到 DOM。在其功能完成后,我们将其从 DOM 中移除。
我的应用程序还使用 Windows 文档打印。它使用 Windows.Graphics.Printing(PrintManager.ShowPrintUIAsync)。使用 API MSApp.getHtmlPrintDocumentSourceAsync(page) 将要打印的数据转换为 HTMLDocumnentSource
我注意到这个错误,每当从 DOM 中删除 x-ms-webview 时,MSApp.getHtmlPrintDocumentSourceAsync(page) 都会
在 res://edgehtml.dll/preview.js 的第 357 行第 1 列抛出以下错误未处理异常0x8000ffff - JavaScript 运行时错误:意外调用方法或属性访问
这是示例代码
1. Create a sample Cordova UWP app.
2. Add the x-ms-webview for example on button click as shown below
var wv = document.createElement('x-ms-webview'); // Use CSS to set width, height and other styles
wv.navigate("https://www.example.com");
wv.id = "test145";
3. Now remove the web view on another action as shown below:
var obj1= document.getElementById(“test145”)
obj1.parentNode.removeChild(obj1)
4. Try to perform printing, invoke as shown below:
Windows.Graphics.Printing.PrintManager.showPrintUIAsync()
从 DOM 中删除 x-ms-webview 会导致此问题。如果我隐藏 webview,则看不到问题。有谁知道这些打印机 API 对 webview 的依赖关系。有什么解决方法吗?
解决方案
推荐阅读
- apache-spark - how to best structure my linear programming using Spark
- php - $.scrollTo 在 Chrome 中不起作用
- qt - Why does my QGraphicsWidget disappear when it's bounding box is still in view?
- javascript - plugin cordova-file-transfer methode download returns code error 3
- javascript - How to avoid IE page freezing
- arrays - How can we check the content of two different arrays and fetch the corresponding index value from the third array and sum up them?
- hyperledger-fabric - Error while creating and joining a channel on Fabric "Build your first network tutorial"
- python - 从 Python 中的数组初始化实例列表
- android - Android Studio Firebase 依赖与 appcompat 不兼容
- express - 每次我注册一个新用户时,jwt 有效负载都是相同的