Class RemoteControl

  • public class RemoteControl
    extends ViewerFeature
    The RemoteControl feature provides remote control of the PDFViewer. The exact mechanism is not defined; it's set by configuring the provider by calling setProvider(java.lang.String). By default there is no provider, and this class adds no functionality to the viewer.
    • Constructor Detail

      • RemoteControl

        public RemoteControl()
    • Method Detail

      • setDebug

        public void setDebug​(boolean debug)
      • setProvider

        public boolean setProvider​(String providerClass)
        Set the Provider for this class.
        providerClass - the fully qualfied classname of an instance of RemoteControlProvider with a public constructor
        true if the provider could be instantiated and set, false otherwise
      • setProvider

        public void setProvider​(RemoteControl.RemoteControlProvider p)
        Set the Provider for this class.
        p - the provider, or null to remove the current provider.
      • setPreferences

        public void setPreferences​(Preferences prefs)
      • debug

        protected void debug​(String s)
      • send

        public void send​(String action,
                         String data,
                         byte[] binaryData)
        Send a message to current the RemoteControlProvider. If none is set, this is a no-op
        action - the action to send
        data - the data to send
        binaryData - the binary data to send
      • receive

        public void receive​(String action,
                            String data,
                            byte[] binaryData)
        Receive a message and act on it. Called by the RemoteControlProvider
        action - the action to perform. If null, the action will be retrieved from the JSON field "action"
        data - the text data, which will be parsed as JSON.
        binaryData - the binary data, which will be parsed as JSON/CBOR only if "data" is null.