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
77 lines (68 loc) · 2.98 KB
/
CefPrintHandler.java
File metadata and controls
77 lines (68 loc) · 2.98 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// 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 org.cef.browser.CefBrowser;
import org.cef.callback.CefNative;
import org.cef.callback.CefPrintDialogCallback;
import org.cef.callback.CefPrintJobCallback;
import org.cef.misc.CefPrintSettings;
import java.awt.Dimension;
/**
* 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. 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).
*
* @param browser The corresponding browser.
*/
void onPrintStart(CefBrowser browser);
/**
* Called to get print settings.
*
* @param browser The corresponding browser.
* @param settings Populate with the desired print settings. Do not keep a reference to this
* object outside of this callback.
* @param getDefaults If true |settings| should be populated with the default print settings.
*/
void onPrintSettings(CefBrowser browser, CefPrintSettings settings, boolean getDefaults);
/**
* Called to show the print dialog.
*
* @param browser The corresponding browser.
* @param hasSelection True if the user has selected a region of the page to print.
* @param callback Callback to execute after the dialog is dismissed.
* @return True if the dialog will be displayed or false to cancel the printing immediately.
*/
boolean onPrintDialog(
CefBrowser browser, boolean hasSelection, CefPrintDialogCallback callback);
/**
* Called to send the print job to the printer.
*
* @param browser The corresponding browser.
* @param documentName Name of the document that is printing.
* @param pdfFilePath Path to the PDF file that contains the document contents.
* @param callback Callback to execute after the print job has completed.
* @return True if the job will proceed or false to cancel the printing immediately.
*/
boolean onPrintJob(CefBrowser browser, String documentName, String pdfFilePath,
CefPrintJobCallback callback);
/**
* Called to reset client state related to printing.
*
* @param browser The corresponding browser.
*/
void onPrintReset(CefBrowser browser);
/**
* Called to retrieve the page size when printToPDF is requested for a browser.
*
* @param browser The corresponding browser.
* @param deviceUnitsPerInch The DPI of the print. Use this to calculate the page size to use.
* @return The page size in microns.
*/
Dimension getPdfPaperSize(CefBrowser browser, int deviceUnitsPerInch);
}