We are an existing PDFTron Mobile SDK client, and would like to start using the annotation tools in the iOS mobile library, including search, highlighting, note taking etc. do you have a how to guide or something we can look at?
Since you have a PDFNet license, I assume you’ve downloaded the Tools source code? I would suggest you start with the included tools, and modify them as necessary. Let me explain how the tool system works.
You set the initial tool by assigning a tool to PDFViewCtrl’s tool property. (This is done in the sample app at the end of the initalSetup selector.) This tool, which like all tools is a UIView that conforms to the ToolDelegate protocol defined in PDFViewCtrl.h, is added as a subview to PDFViewCtrl’s public ivar “ContainerView”. The ContainerView is the view that is contained by a UIScrollView that the user uses to view the PDF document. Therefore if the tool wants to position itself at a particular place over the document it does so by setting its frame property appropriately. Likewise if the tool is to display something, it does so by using normal UIView drawing methods.
When PDFViewCtrl has its Tool property set to a valid Tool object, it forwards it the events defined by the ToolDelegate. The tool therefore has the opportunity to respond to user input, typically used so that the user can interact with the underlying PDF in some manner. Examples would include reading the target of a hyperlink (and responding appropriately), changing an annotation’s location or other property, selecting text, etc. (All of these behaviours are implemented in the standard set of tools that ships with PDFNet.)
The event type ToolDelegate selectors (OnTouchesBegan, etc.) return a boolean value. This is used to allow PDFViewCtrl to switch tools automatically. If the tool returns YES, this indicates that it has dealt with the event. However if the tool returns NO, then PDFViewCtrl will remove that tool and instantiate a new tool that is returned by the required ToolDelegate selector getNewTool. Taking the default tools as an example, the PanTool, which is used for standard document scrolling/navigation, will handle a tap event by looking to see if the user has tapped on an annotation. If not, then it returns YES (because there is nothing more to do) and PDFViewCtrl’s tool remains the PanTool. If however the tap occurred over an annotation, it sets its nextToolType to AnnotEditTool, and returns NO. PDFViewCtrl will then instantiate the AnnotEditTool, add it to the ContainerView and immediately call its handleTap selector. The AnnotEditTool then takes an appropriate action, such as selecting the annotation or following a hyperlink.