那麼經過一番研究,我發現這個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