Package org.cef.handler
Class CefPrintHandlerAdapter
- java.lang.Object
-
- org.cef.callback.CefNativeAdapter
-
- org.cef.handler.CefPrintHandlerAdapter
-
- All Implemented Interfaces:
CefNative
,CefPrintHandler
public abstract class CefPrintHandlerAdapter extends CefNativeAdapter implements CefPrintHandler
An abstract adapter class for receiving print events on Linux. The methods in this class are empty. This class exists as convenience for creating handler objects.
-
-
Constructor Summary
Constructors Constructor Description CefPrintHandlerAdapter()
-
Method Summary
All Methods Instance Methods Concrete 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 class org.cef.callback.CefNativeAdapter
getNativeRef, setNativeRef
-
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.cef.callback.CefNative
getNativeRef, setNativeRef
-
-
-
-
Method Detail
-
onPrintStart
public void onPrintStart(CefBrowser browser)
Description copied from interface:CefPrintHandler
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).- Specified by:
onPrintStart
in interfaceCefPrintHandler
- Parameters:
browser
- The corresponding browser.
-
onPrintSettings
public void onPrintSettings(CefBrowser browser, CefPrintSettings settings, boolean getDefaults)
Description copied from interface:CefPrintHandler
Called to get print settings.- Specified by:
onPrintSettings
in interfaceCefPrintHandler
- 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
public boolean onPrintDialog(CefBrowser browser, boolean hasSelection, CefPrintDialogCallback callback)
Description copied from interface:CefPrintHandler
Called to show the print dialog.- Specified by:
onPrintDialog
in interfaceCefPrintHandler
- 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
public boolean onPrintJob(CefBrowser browser, java.lang.String documentName, java.lang.String pdfFilePath, CefPrintJobCallback callback)
Description copied from interface:CefPrintHandler
Called to send the print job to the printer.- Specified by:
onPrintJob
in interfaceCefPrintHandler
- 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
public void onPrintReset(CefBrowser browser)
Description copied from interface:CefPrintHandler
Called to reset client state related to printing.- Specified by:
onPrintReset
in interfaceCefPrintHandler
- Parameters:
browser
- The corresponding browser.
-
getPdfPaperSize
public java.awt.Dimension getPdfPaperSize(int deviceUnitsPerInch)
Description copied from interface:CefPrintHandler
Called to retrieve the page size when printToPDF is requested for a browser.- Specified by:
getPdfPaperSize
in interfaceCefPrintHandler
- Parameters:
deviceUnitsPerInch
- The DPI of the print. Use this to calculate the page size to use.- Returns:
- The page size in microns.
-
-