From 43aa8a35ea1b2b6577d006fafd6098d5b3aae5ce Mon Sep 17 00:00:00 2001 From: amaitland Date: Fri, 10 Mar 2017 14:43:35 +1000 Subject: [PATCH] Remove IBrowserHost.PrintToPdfAsync - code is now implemented in the PrintToPdfAsync extension method --- CefSharp.Core/Internals/CefBrowserHostWrapper.cpp | 9 --------- CefSharp.Core/Internals/CefBrowserHostWrapper.h | 1 - CefSharp/IBrowserHost.cs | 10 ---------- CefSharp/WebBrowserExtensions.cs | 5 ++++- 4 files changed, 4 insertions(+), 21 deletions(-) diff --git a/CefSharp.Core/Internals/CefBrowserHostWrapper.cpp b/CefSharp.Core/Internals/CefBrowserHostWrapper.cpp index 52f6b2590..86895694a 100644 --- a/CefSharp.Core/Internals/CefBrowserHostWrapper.cpp +++ b/CefSharp.Core/Internals/CefBrowserHostWrapper.cpp @@ -72,15 +72,6 @@ void CefBrowserHostWrapper::Print() _browserHost->Print(); } -Task^ CefBrowserHostWrapper::PrintToPdfAsync(String^ path, PdfPrintSettings^ settings) -{ - ThrowIfDisposed(); - - auto printToPdfTask = gcnew TaskPrintToPdfCallback(); - PrintToPdf(path, settings, printToPdfTask); - return printToPdfTask->Task; -} - void CefBrowserHostWrapper::PrintToPdf(String^ path, PdfPrintSettings^ settings, IPrintToPdfCallback^ callback) { ThrowIfDisposed(); diff --git a/CefSharp.Core/Internals/CefBrowserHostWrapper.h b/CefSharp.Core/Internals/CefBrowserHostWrapper.h index c6c4017a6..af0e1a2a2 100644 --- a/CefSharp.Core/Internals/CefBrowserHostWrapper.h +++ b/CefSharp.Core/Internals/CefBrowserHostWrapper.h @@ -41,7 +41,6 @@ namespace CefSharp public: virtual void StartDownload(String^ url); virtual void Print(); - virtual Task^ PrintToPdfAsync(String^ path, PdfPrintSettings^ settings); virtual void PrintToPdf(String^ path, PdfPrintSettings^ settings, IPrintToPdfCallback^ callback); virtual void SetZoomLevel(double zoomLevel); virtual Task^ GetZoomLevelAsync(); diff --git a/CefSharp/IBrowserHost.cs b/CefSharp/IBrowserHost.cs index d75a98035..788ff9190 100644 --- a/CefSharp/IBrowserHost.cs +++ b/CefSharp/IBrowserHost.cs @@ -189,16 +189,6 @@ namespace CefSharp /// void Print(); - /// - /// Asynchronously prints the current browser contents to the Pdf file specified. - /// The caller is responsible for deleting the file when done. - /// - /// Output file location. - /// Print Settings. - /// A task that represents the asynchronous print operation. - /// The result is true on success or false on failure to generate the Pdf. - Task PrintToPdfAsync(string path, PdfPrintSettings settings = null); - /// /// Asynchronously prints the current browser contents to the Pdf file specified. /// The caller is responsible for deleting the file when done. diff --git a/CefSharp/WebBrowserExtensions.cs b/CefSharp/WebBrowserExtensions.cs index 2710e55a0..acba2bea3 100644 --- a/CefSharp/WebBrowserExtensions.cs +++ b/CefSharp/WebBrowserExtensions.cs @@ -547,7 +547,10 @@ namespace CefSharp var host = cefBrowser.GetHost(); ThrowExceptionIfBrowserHostNull(host); - return host.PrintToPdfAsync(path, settings); + var callback = new TaskPrintToPdfCallback(); + host.PrintToPdf(path, settings, callback); + + return callback.Task; } ///