那么经过一番研究,我发现这个video,如果你可以添加这些开关:“--kiosk --kiosk-printing”,给chrome驱动启动,它会自动跳过打印预览提示,就像视频中所示。 另外,我在最新版本的SRWare铁(铬叉)上测试了它,并且它工作正常。
如果您正在使用C#来使你的程序,然后有一个简单的解决方案:
private void Button1_Click(object sender, EventArgs e)
{
PrintHelpPage();
}
private void PrintHelpPage()
{
// Create a WebBrowser instance.
WebBrowser webBrowserForPrinting = new WebBrowser();
// Add an event handler that prints the document after it loads.
webBrowserForPrinting.DocumentCompleted +=
new WebBrowserDocumentCompletedEventHandler(PrintDocument);
// Set the Url property to load the document.
webBrowserForPrinting.Url = new Uri(@"http://www.google.com"); //This is what you want to change
}
private void PrintDocument(object sender,
WebBrowserDocumentCompletedEventArgs e)
{
// Print the document now that it is fully loaded.
((WebBrowser)sender).Print();
// Dispose the WebBrowser now that the task is complete.
((WebBrowser)sender).Dispose();
}
发现在Here答案,这使用WebBrowser控件导航到一个特定的URL,可以是本地网址或来自互联网,并使用您的默认打印机进行打印。
非常感谢,我今天在这个问题上苦苦挣扎了3个小时,并没有意识到要深入c#的webbrowswer控制,就像在你手中拿着眼镜一边搜索眼镜一样。我按“接受”,这是我需要做的吗?我在回答,编辑评论和接受答案方面是新的。 – user3150255
是的,你做得很好:) – Paripsky