Custom handling on Viewer popup messages
Whilst using our Viewer object there are several messages that are displayed as popups to inform the user of actions or events to which they should be made aware.
However there are cases where you may require that these popups are not displayed or displayed in a different manner. In order to allow this we have included an interface that you may implement and use in place of our default message handler.
CustomMessageHandler is an interface that, when implemented and passed into the Viewer object, will handle all message popups in a manner that you have specified.
The JPedal jar includes an implementation of the CustomMessageHandler interface called ExampleCustomMessageHandler. This implementation is intended as an example that can you used as a starting point for those wishing to handle the Viewers popup messages. What the implementation does is to suppress the message popups and instead output the messages to the console.
When writing your own version the interface provided you with the messages that the Viewer wishes to display, your implementation should take the input handle it how ever you desire then return a given value so the Viewer know how to proceed. The values for these are detailed in the JavaDoc for CustomMessageHandler.
How to add a CustomMessageHandler to the Java PDF viewer
Your own CustomMessageHandler should be added to the viewer before Viewer.setUpViewer() is called, if it is not the Viewers user inteface will use the default option.
The CustomMessageHandler can be added with the following code.
PdfDecoderInt pdfDecoder = viewer.getPdfDecoder();
ExampleCustomMessageHandler messageHandler = new ExampleCustomMessageHandler();