Package org.cef.handler
Interface CefPrintHandler
-
- All Superinterfaces:
CefNative
- All Known Implementing Classes:
CefPrintHandlerAdapter
public interface CefPrintHandler extends CefNative
Implement this interface to handle printing on Linux. The methods of this class will be called on the browser process UI thread.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.awt.Dimension
getPdfPaperSize(int deviceUnitsPerInch)
Called to retrieve the page size when printToPDF is requested for a browser.boolean
onPrintDialog(CefBrowser browser, boolean hasSelection, CefPrintDialogCallback callback)
Called to show the print dialog.boolean
onPrintJob(CefBrowser browser, java.lang.String documentName, java.lang.String pdfFilePath, CefPrintJobCallback callback)
Called to send the print job to the printer.void
onPrintReset(CefBrowser browser)
Called to reset client state related to printing.void
onPrintSettings(CefBrowser browser, CefPrintSettings settings, boolean getDefaults)
Called to get print settings.void
onPrintStart(CefBrowser browser)
Called when printing has started.-
Methods inherited from interface org.cef.callback.CefNative
getNativeRef, setNativeRef
-
-
-
-
Method Detail
-
onPrintStart
void onPrintStart(CefBrowser browser)
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).- Parameters:
browser
- The corresponding browser.
-
onPrintSettings
void onPrintSettings(CefBrowser browser, CefPrintSettings settings, boolean getDefaults)
Called to get print settings.- Parameters:
browser
- The corresponding browser.settings
- Populate with the desired print settings. Do not keep a reference to this object outside of this callback.getDefaults
- If true |settings| should be populated with the default print settings.
-
onPrintDialog
boolean onPrintDialog(CefBrowser browser, boolean hasSelection, CefPrintDialogCallback callback)
Called to show the print dialog.- Parameters:
browser
- The corresponding browser.hasSelection
- True if the user has selected a region of the page to print.callback
- Callback to execute after the dialog is dismissed.- Returns:
- True if the dialog will be displayed or false to cancel the printing immediately.
-
onPrintJob
boolean onPrintJob(CefBrowser browser, java.lang.String documentName, java.lang.String pdfFilePath, CefPrintJobCallback callback)
Called to send the print job to the printer.- Parameters:
browser
- The corresponding browser.documentName
- Name of the document that is printing.pdfFilePath
- Path to the PDF file that contains the document contents.callback
- Callback to execute after the print job has completed.- Returns:
- True if the job will proceed or false to cancel the printing immediately.
-
onPrintReset
void onPrintReset(CefBrowser browser)
Called to reset client state related to printing.- Parameters:
browser
- The corresponding browser.
-
getPdfPaperSize
java.awt.Dimension getPdfPaperSize(int deviceUnitsPerInch)
Called to retrieve the page size when printToPDF is requested for a browser.- Parameters:
deviceUnitsPerInch
- The DPI of the print. Use this to calculate the page size to use.- Returns:
- The page size in microns.
-
-