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 printing of form widgets. 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.CustomPrintHintingHandler allows the user to take control of hinting used for printing. Methods are called before and after printing. Object newHandler needs to implement org.jpedal.external.CustomPrintHintingHandler.
- Options.FormFactory allows the user to replace forms widgets with their own. Object newHandler needs to implementorg.jpedal.objects.acroforms.creation.FormFactory .
- Options.ImageHandler allows the user to access the image decoding functions. Object newHandler needs to implementorg.jpedal.external.ImageHandler. There is an example at org.jpedal.examples.handlers.ExampleImageHandler.java and code to enable it in the Viewer example.
- Options.LinkHandler allows the user to link their own code into link handlingcode. Object newHandler needs to implement org.jpedal.external.LinkHandler.
- 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