forked from chromiumembedded/java-cef
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCefPrintHandler.java
More file actions
63 lines (54 loc) · 2.25 KB
/
CefPrintHandler.java
File metadata and controls
63 lines (54 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
package org.cef.handler;
import java.awt.Dimension;
import org.cef.browser.CefBrowser;
import org.cef.callback.CefNative;
import org.cef.callback.CefPrintDialogCallback;
import org.cef.callback.CefPrintJobCallback;
import org.cef.misc.CefPrintSettings;
/**
* Implement this interface to handle printing on Linux. The methods of this
* class will be called on the browser process UI thread.
*/
public interface CefPrintHandler extends CefNative {
/**
* Called when printing has started for the specified |browser|. This method
* will be called before the other onPrint*() methods and irrespective of how
* printing was initiated (e.g. CefBrowser::print(), JavaScript window.print()
* or PDF extension print button).
*/
void onPrintStart(CefBrowser browser);
/**
* Synchronize |settings| with client state. If |get_defaults| is true then
* populate |settings| with the default print settings. Do not keep a
* reference to |settings| outside of this callback.
*/
void onPrintSettings(CefPrintSettings settings, boolean get_defaults);
/**
* Show the print dialog. Execute |callback| once the dialog is dismissed.
* Return true if the dialog will be displayed or false to cancel the
* printing immediately.
*
*/
boolean onPrintDialog(boolean has_selection, CefPrintDialogCallback callback);
/**
* Send the print job to the printer. Execute |callback| once the job is
* completed. Return true if the job will proceed or false to cancel the job
* immediately.
*/
boolean onPrintJob(String document_name, String pdf_file_path, CefPrintJobCallback callback);
/**
* Reset client state related to printing.
*/
void onPrintReset();
/**
* Called when PrintToPDF is requested for a browser. Returns the page size
* (as measured in microns) to use.
* @param deviceUnitsPerInch The DPI of the print. Use this to calculate
* the page size to use.
* @return The page size
*/
Dimension getPdfPaperSize(int deviceUnitsPerInch);
}