Class ViewerFeature

    • Constructor Detail

      • ViewerFeature

        protected ViewerFeature​(String name)
        Create a new ViewerFeature
        name - the name of the feature
    • Method Detail

      • getAllFeatures

        public static final List<ViewerFeature> getAllFeatures()
        Return a Collection of all the features available, which can be passed to the PDFViewer constructor or used as a base for your own set of features.
        See Also:
      • setFeatureName

        protected final void setFeatureName​(String name)
        Set the feature name. This should only be called in the constructor - normally you would set the name by passing it into the constructor, but if you're overriding a feature that doesn't allow you to do this, this method allows you to change it.
      • initialize

        public void initialize​(PDFViewer viewer)
        Called when the feature is first added to a viewer
      • teardown

        public void teardown()
        Called when the PDFViewer containing this feature is closed
      • isEnabledByDefault

        public boolean isEnabledByDefault()
        Return true if this feature is enabled by default (the default). Disabled features are excluded from the list returned by getAllEnabledFeatures() and by PDFTool
      • getName

        public final String getName()
        Return the name of this Feature
      • getCustomJavaScript

        public String getCustomJavaScript​(String type,
                                          String name)
        Return any custom JavaScript that needs to be run by this feature on the specified JavaScript event. Unlike JavaScript from the document, this JavaScript will be run outside the security sandbox so will have the same permissions as the application. The default implementation returns null.
        type - the Event type : "App", "Doc" etc.
        name - the Event name : "Init", "Open", "WillClose" etc.
      • getFeatureProperty

        public final String getFeatureProperty​(PDFViewer viewer,
                                               String key)

        Get a custom property for this feature, as specified by the viewer. This method provides a convenient, standardised way to access properties for a feature at runtime, by querying the PropertyManager returned by PDFViewer.getPropertyManager(). The key is prefixed by the name of this class, and if no value is found the superclass is specified.

        For example, calling this method from a KeyStoreSignatureProvider class as getFeatureProperty(viewer, "name") will first check the property If no matching value is found, and then are checked. Custom subclasses outside the org.faceless.pdf2.viewer2 package will have their full classnames used - as an example, a subclass of KeyStoreSignatureProvider called com.mycompany.MyProvider would check first.

        viewer - the PDFViewer to get the PropertyManager from
        key - the property key