I want to provided printer info (app user store, such as device name, page size ... ) when printing a page
but How to set CefPrintSettings , I look for CefPrintHandler class, but how to do it ?
Can give me a sample,please !
public CefPrintHandler getPrintHandler ()
struct PrintMsg_HostPrinterCapabilities_Params {
PrintMsg_HostPrinterCapabilities_Params();
~PrintMsg_HostPrinterCapabilities_Params();
void Reset();
...
bool need_default_printer_set;
bool should_ask_user_for_settings;
bool result;
};
.h
class Delegate {
...
// If true, the user can be asked to provide print settings.
// The default implementation returns |true|.
virtual bool IsAskPrintSettingsEnabled();
...
};
.cc
bool PrintRenderFrameHelper::Delegate::IsAskPrintSettingsEnabled() {
return true;
}
void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
const blink::WebNode& node,
bool is_scripted) {
...
bool should_ask_user_for_settings = true;
PrintMsg_HostPrinterCapabilities_Params caps_params;
Send(new PrintHostMsg_QueryHostPrintingCapabilities(
routing_id(), routing_id(), &caps_params));
if(caps_params.result) {
if(caps_params.should_ask_user_for_settings) {
should_ask_user_for_settings =
caps_params.should_ask_user_for_settings;
}
}
...
// Ask the browser to show UI to retrieve the final print settings.
if (!should_ask_user_for_settings &&
delegate_->IsAskPrintSettingsEnabled()) {
// PrintHostMsg_ScriptedPrint in GetPrintSettingsFromUser() will reset
// |print_scaling_option|, so save the value here and restore it afterwards.
....
}
}
Users browsing this forum: No registered users and 18 guests