Add PDF printing support (issue #1478).

This commit is contained in:
Alexei Bykov
2015-03-24 18:40:08 +03:00
committed by Marshall Greenblatt
parent b6e5310bce
commit 85f83680d7
42 changed files with 1039 additions and 24 deletions

View File

@@ -832,6 +832,27 @@ void CefBrowserHostImpl::Print() {
}
}
void CefBrowserHostImpl::PrintToPDF(const CefString& path,
const CefPdfPrintSettings& settings,
CefRefPtr<CefPdfPrintCallback> callback) {
if (CEF_CURRENTLY_ON_UIT()) {
if (!web_contents_)
return;
printing::PrintViewManager::PdfPrintCallback pdf_callback;
if (callback.get()) {
pdf_callback = base::Bind(&CefPdfPrintCallback::OnPdfPrintFinished,
callback.get(), path);
}
printing::PrintViewManager::FromWebContents(web_contents_.get())->
PrintToPDF(base::FilePath(path), settings, pdf_callback);
} else {
CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserHostImpl::PrintToPDF, this, path, settings,
callback));
}
}
void CefBrowserHostImpl::Find(int identifier, const CefString& searchText,
bool forward, bool matchCase, bool findNext) {
if (CEF_CURRENTLY_ON_UIT()) {