JPedal includes a method to allow users to replace certain aspects of the program with their own functionality for specialised situations. JPedal provides a method call and a set of interfaces to achieve this.
How it works
The addExternalHandler(Object newHandler,int type) method in PdfDecoder allows the user to pass in their own object which implements a predefined interface.
If this object is set, it will be called internally by JPedal at specific points allowing the object to replace or augment certain functions.
Some values are used internally and not listed here. Recommended values are:
- Options.CustomMessageOutput Gives the developer control over the general messages in Viewer which can all be disabled. Object newHandler needs to implement org.jpedal.external.CustomMessageHandler. There is an example in Viewer code
- Options.CustomFormPrint allows the user to take control of the printing of form widgets. The method is called for each value and boolean value is returned telling JPedal if it should print the widget. Object newHandler needs to implement org.jpedal.external.CustomFormPrint.
- Options.FormFactory allows the user to replace forms widgets with their own. Object newHandler needs to implement org.jpedal.objects.acroforms.creation.FormFactory .
- Options.ImageHandler allows the user to access the image decoding functions. Object newHandler needs to implement org.jpedal.external.ImageHandler. There is an example at org.jpedal.examples.handlers.ExampleImageHandler.java and code to enable it in the Viewer example.
- Options.ShapeTracker provides a way to access the Shapes in a PDF as they are created. Object newHandler needs to implement org.jpedal.external.ShapeTracker.
- Options.RenderChangeListener provides a way to monitor when the page is rendered or updated. This listener is also a useful way to monitor when a page change happens. Object newHandler needs to implement org.jpedal.external.RenderChangeListener.
This feature is provided as a service for commercial clients. It is not part of the official API and subject to change. It should only be used in consultation with IDRsolutions Ltd