Using Custom Annotation Toolbar

Hello, we are using latest version of PDFTron.
But we handle drawing in our way and I would like to change that with your PTFreeHandCreate PTErase etc tools.
Screen Shot 2021-10-25 at 18.49.21

here are some codes that how we are planning to make that changes.

  • for setting tool
let tool = self.toolManager.changeTool(PTEraser.self)
tool.backToPanToolAfterUse = false
  • for changing style, I called commitAnnotation before changing it otherwise it changes the strokes, annotations… too.
if let tool = toolManager.tool as? PTFreeHandHighlightCreate {
   tool.commitAnnotation()
}
PTColorDefaults.setDefaultColor(color, for: toolManager.tool?.annotType ?? .freeText, attribute: ATTRIBUTE_STROKE_COLOR, colorPostProcessMode: e_ptpostprocess_none)

PTColorDefaults.setDefaultBorderThickness(Double(thickness), for: toolManager.tool?.annotType ?? .freeText)

Q1: Is there a way to disable finger drawing, I tried setting pencilInteractionMode but it allows drawing with finger until pencil touches the screen.

Q2: is it ok to using custom toolbar that way, your opinion really matters for our team. did I miss any part etc.

Thanks for your valuable support
Warm Regards

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:

Guides:APIs:Forums:

Hi @ogito,

Thank you for getting in touch with us about this.
Could you clarify a little what you mean by this:

for changing style, I called commitAnnotation before changing it otherwise it changes the strokes, annotations… too.

As for the finger and Pencil issue:

Is there a way to disable finger drawing, I tried setting pencilInteractionMode but it allows drawing with finger until pencil touches the screen.

We are investigating the best approach to resolve this.

As for this query:

is it ok to using custom toolbar that way, your opinion really matters for our team. did I miss any part etc.

The SDK is designed to be as flexible as possible so you can implement its capabilities in any way you like. We do have some guides which should be useful in implementing specific workflows:
https://www.pdftron.com/documentation/ios/guides/

Our Tools code (and sample apps) are also open source and available in the SDK download if you wanted to take a closer look at any of our implementations directly.

If you run into any specific issues then we are always happy to answer questions and try to resolve things.