Implementing an AnnotationCallback

compared with
Current by Mark Collette
on Jan 27, 2010 18:08.


 
Key
These lines were removed. This word was removed.
These lines were added. This word was added.

View page history


There are 5 changes. View first change.

 \\
 ICEpdf can optionally be configured to support interacting with link annotations. The Viewer RI and Pilot RI by default come configured with their own implementation of the *{{org.icepdf.core.AnnotationCallback}}*. They differ only by how they handle external URI Actions. The Viewer RI will load an external URI with the Operating Systems default web browser. The Pilot RI will load external URI links in a new ICEbrowser viewport.
  \\
 ICEpdf can optionally be configured to support interacting with link annotations. The Viewer RI and Pilot RI, by default, come configured with their own implementations of the {{{*}org.icepdf.core.AnnotationCallback{*}}}. They differ only by how they handle external URI Actions. The Viewer RI will load an external URI with the Operating System's default web browser, while the Pilot RI will load external URI links in a new ICEbrowser viewport.
  
ICEpdf only supports annotations via the mouse pointer; there is no keyboard support at this time. When the mouse is moved over a portion of a PDF document which is marked as an annotation, the mouse cursor will change into a hand pointer. When a user clicks on the annotation, ICEpdf will draw any effect specified by the selected annotation, but it will not execute the annotation action; it instead passes the selected annotation to the AnnotationCallback. It is up to the AnnotationCallback implementation to process the annotation's actions.
  ICEpdf only supports annotations via the mouse pointer; there is no keyboard support at this time. When the mouse is moved over a portion of a PDF document which is marked as an annotation, the mouse cursor will change into a hand with a pointing finger. When a user clicks on the annotation, ICEpdf will draw any effect specified by the selected annotation, but it will not execute the annotation action; it instead passes the selected annotation to the AnnotationCallback. It is up to the AnnotationCallback implementation to process the annotation's actions.
  
A default implementation of an AnnotationCallback can be found in at *{{org.icepdf.core.ri.common.MyAnnotationCallback}}*.
  A default implementation of an AnnotationCallback can be found in {{{*}org.icepdf.core.ri.common.MyAnnotationCallback{*}}}.
  
  
The following code snippet shows how to configure the SwingController with an AnnotationCallback that would allow the user to interact with annotation in a PDF document.
  The following code snippet shows how to configure the SwingController with an AnnotationCallback that would allow the user to interact with annotations in a PDF document.
  
 {code}
 // build a component controller
 SwingController controller = new SwingController();
  
 SwingViewBuilder factory = new SwingViewBuilder(controller);
  
 JPanel viewerComponentPanel = factory.buildViewerPanel();
  
 // add interactive mouse link annotation support via callback
 controller.getDocumentViewController().setAnnotationCallback(
  new org.icepdf.ri.common.MyAnnotationCallback(
  controller.getDocumentViewController()));
  
 JFrame applicationFrame = new JFrame();
 applicationFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 applicationFrame.getContentPane().add(viewerComponentPanel);
  
 // Now that the GUI is all in place, we can try openning a PDF
 controller.openDocument(filePath);
 {code}
  
 \\
 \\
  \\
 \\

© Copyright 2017 ICEsoft Technologies Canada Corp.