Class 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 Detail

      • CefPrintHandlerAdapter

        public CefPrintHandlerAdapter()
    • 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 interface CefPrintHandler
        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 interface CefPrintHandler
        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 interface CefPrintHandler
        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 interface CefPrintHandler
        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 interface CefPrintHandler
        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 interface CefPrintHandler
        Parameters:
        deviceUnitsPerInch - The DPI of the print. Use this to calculate the page size to use.
        Returns:
        The page size in microns.