Java 如何在由GWT应用程序创建的chrome打包应用程序中实现打印。?
我已经在DirectLinkedIn的帮助下将GWT应用程序与Chrome打包应用程序集成,如下代码所示:Java 如何在由GWT应用程序创建的chrome打包应用程序中实现打印。?,java,javascript,google-chrome,gwt,google-chrome-app,Java,Javascript,Google Chrome,Gwt,Google Chrome App,我已经在DirectLinkedIn的帮助下将GWT应用程序与Chrome打包应用程序集成,如下代码所示: public class CSPCompatibleLinker extends DirectInstallLinker { @Override protected String getJsInstallLocation(LinkerContext context) { return "com/google/gwt/core/ext/linker/impl/
public class CSPCompatibleLinker extends DirectInstallLinker {
@Override
protected String getJsInstallLocation(LinkerContext context) {
return "com/google/gwt/core/ext/linker/impl/installLocationMainWindow.js";
}
}
但现在我想调用Chrome打包应用程序的打印功能。当我调用window.print()
时,它允许我打印当前窗口,但我需要打开一个新的单独窗口并打印它
有谁能帮我一下吗?关于GWT或DirectLinkerinstaller,我无法回答任何问题,但这里有一个关于Chrome应用程序的答案,假设这就是你要问的: 您可以使用chrome.app.window.create API创建窗口。然后,您可以调用该窗口的print方法 在我的应用程序中,我很少想打印窗口中的内容,而是我专门为打印而生成的内容。为此,我使用jsPDF(谷歌it)创建了一个PDF,效果很好。然后我将PDF显示在窗口中,让用户打印(或保存)PDF。Star了解有关在Chrome应用程序中打印的更多信息。