mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Use new PrintViewManagerBase::PrintToPdf method (fixes issue #3377)
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
#include "libcef/browser/context.h"
|
||||
#include "libcef/browser/image_impl.h"
|
||||
#include "libcef/browser/navigation_entry_impl.h"
|
||||
#include "libcef/browser/printing/print_util.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
#include "libcef/common/frame_util.h"
|
||||
#include "libcef/common/net/url_util.h"
|
||||
@@ -348,6 +349,37 @@ void CefBrowserHostBase::DownloadImage(
|
||||
max_image_size, callback));
|
||||
}
|
||||
|
||||
void CefBrowserHostBase::Print() {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefBrowserHostBase::Print, this));
|
||||
return;
|
||||
}
|
||||
|
||||
auto web_contents = GetWebContents();
|
||||
if (!web_contents)
|
||||
return;
|
||||
|
||||
const bool print_preview_disabled =
|
||||
!platform_delegate_ || !platform_delegate_->IsPrintPreviewSupported();
|
||||
print_util::Print(web_contents, print_preview_disabled);
|
||||
}
|
||||
|
||||
void CefBrowserHostBase::PrintToPDF(const CefString& path,
|
||||
const CefPdfPrintSettings& settings,
|
||||
CefRefPtr<CefPdfPrintCallback> callback) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefBrowserHostBase::PrintToPDF, this,
|
||||
path, settings, callback));
|
||||
return;
|
||||
}
|
||||
|
||||
auto web_contents = GetWebContents();
|
||||
if (!web_contents)
|
||||
return;
|
||||
|
||||
print_util::PrintToPDF(web_contents, path, settings, callback);
|
||||
}
|
||||
|
||||
bool CefBrowserHostBase::SendDevToolsMessage(const void* message,
|
||||
size_t message_size) {
|
||||
if (!message || message_size == 0)
|
||||
|
Reference in New Issue
Block a user