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

@@ -234,6 +234,23 @@ class CefNavigationEntryVisitor : public virtual CefBase {
};
///
// Callback interface for CefBrowserHost::PrintToPDF. The methods of this class
// will be called on the browser process UI thread.
///
/*--cef(source=client)--*/
class CefPdfPrintCallback : public virtual CefBase {
public:
///
// Method that will be executed when the PDF printing has completed. |path|
// is the output path. |ok| will be true if the printing completed
// successfully or false otherwise.
///
/*--cef()--*/
virtual void OnPdfPrintFinished(const CefString& path, bool ok) =0;
};
///
// Class used to represent the browser process aspects of a browser window. The
// methods of this class can only be called in the browser process. They may be
@@ -389,6 +406,17 @@ class CefBrowserHost : public virtual CefBase {
/*--cef()--*/
virtual void Print() =0;
///
// Print the current browser contents to the PDF file specified by |path| and
// execute |callback| on completion. The caller is responsible for deleting
// |path| when done. For PDF printing to work on Linux you must implement the
// CefPrintHandler::GetPdfPaperSize method.
///
/*--cef(optional_param=callback)--*/
virtual void PrintToPDF(const CefString& path,
const CefPdfPrintSettings& settings,
CefRefPtr<CefPdfPrintCallback> callback) =0;
///
// Search for |searchText|. |identifier| can be used to have multiple searches
// running simultaniously. |forward| indicates whether to search forward or