Custom Interfaces
The commercial version of 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 SimpleViewer which can all be disabled . Object newHandler needs to implement org.jpedal.external.CustomMessageHandler. There is an example in SimpleViewer 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.ExpressionEngine allows the user to link their own code into Javascript validation. Object newHandler needs to implement org.jpedal.objects.javascript.ExpressionEngine.
- 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 SimpleViewer 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.
Important note
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
Related items
Draw additional objects explains how to draw your own objects ontop of the PDF display (ie special Annotations, copyright notice) using a Custom interface.
Implementing custom actions explains how to add your own custom actions to the PDF Viewer.
Return to main PDF support section
Click here for the main PDF support area with lots of java examples, PDF tutorials and useful information to get the most out of the JPedal PDF library








