原創|產品更新|編輯:李顯亮|2021-03-04 10:56:42.670|閱讀 453 次
概述:DotNetBrowser更新至v2.4版本,打印API進行了改進和重新設計,支持.NET 5,以及更多改進和修復,歡迎下載體驗。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
DotNetBrowser是一個.NET庫,允許將基于Chromium的WPF和WinForms組件嵌入到.NET應用程序中,以顯示使用HTML5,CSS3,JavaScript,Silverlight等構建的現代網頁。
DotNetBrowser更新至v2.4版本,打印API進行了改進和重新設計,支持.NET 5,以及更多改進和修復,還沒有使用過可以點擊下方鏈接下載哦~
DotNetBrowser迎來v2.4版本更新,為了方便大家盡可能順利過度新版本,我們特意準備了本指南將幫助您了解新版本都要哪些新增與改動。
新功能
// Tell the Chromium engine to perform the printing programmatically. browser.RequestPrintHandler = new Handler<RequestPrintParameters, RequestPrintResponse>(p => { return RequestPrintResponse.Print(); }); // This handler is used for printing regular web pages programmatically. browser.PrintHtmlContentHandler = new Handler<PrintHtmlContentParameters, PrintHtmlContentResponse>(p => { string pdfFilePath = Path.GetFullPath("result.pdf"); // Get the print job for the built-in PDF printer. IPrintJob<PdfPrinter.IHtmlSettings> printJob = p.Printers.Pdf.PrintJob; // Subscribe to its PrintCompleted event and show a message box when it's done. printJob.PrintCompleted += (sender, args) => { BeginInvoke((Action) (() => { MessageBox.Show("Printing completed: \n"+pdfFilePath); })); }; // Apply the necessary print settings printJob.Settings.Apply(s => { // Enable printing header and footer. s.PrintingHeaderFooterEnabled = true; // Specify the path to save the result. s.PdfFilePath = pdfFilePath; }); // Tell Chromium to use the built-in PDF printer for printing. return PrintHtmlContentResponse.Print(p.Printers.Pdf); }); // Load the web page and wait until it is loaded completely. browser.Navigation.LoadUrl("teamdev.com").Wait(); // Initiate printing. browser.MainFrame.Print();
改進
問題修復
如果你對我們的產品感興趣,想咨詢正版授權折扣價格,請聯系咨詢~
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn