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

@@ -230,6 +230,27 @@ typedef struct _cef_navigation_entry_visitor_t {
} cef_navigation_entry_visitor_t;
///
// Callback structure for cef_browser_host_t::PrintToPDF. The functions of this
// structure will be called on the browser process UI thread.
///
typedef struct _cef_pdf_print_callback_t {
///
// Base structure.
///
cef_base_t base;
///
// Method that will be executed when the PDF printing has completed. |path| is
// the output path. |ok| will be true (1) if the printing completed
// successfully or false (0) otherwise.
///
void (CEF_CALLBACK *on_pdf_print_finished)(
struct _cef_pdf_print_callback_t* self, const cef_string_t* path,
int ok);
} cef_pdf_print_callback_t;
///
// Structure used to represent the browser process aspects of a browser window.
// The functions of this structure can only be called in the browser process.
@@ -346,6 +367,17 @@ typedef struct _cef_browser_host_t {
///
void (CEF_CALLBACK *print)(struct _cef_browser_host_t* self);
///
// 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
// cef_print_handler_t::GetPdfPaperSize function.
///
void (CEF_CALLBACK *print_to_pdf)(struct _cef_browser_host_t* self,
const cef_string_t* path,
const struct _cef_pdf_print_settings_t* settings,
struct _cef_pdf_print_callback_t* callback);
///
// Search for |searchText|. |identifier| can be used to have multiple searches
// running simultaniously. |forward| indicates whether to search forward or