I am trying to create a custom stamp as an image. PDFTron has the PTCheckMarkStampCreate and the PTCrossMarkStampCreate. I essentially want to create my own and add them ad bar button items to the toolManager toolbar. If I could use those default ones and make them default to certain colors and sizes that would be great, but if not how would I create a custom stamp using an image and position it where ever the user taps?
Here is an image that might make it more helpful with what I am trying to do. Currently I am using PDFTron system PTCheckMarkStampCreate and PTCrossMarkStampCreate to create a UIBarButtonItem by calling toolGroupManager.createItem(forToolClass: PTCrossMarkStampCreate.self)
How would I either override those to be my own custom image or how would I create my own stamp to add it to my toolGroupManager.annotateItemGroup .
I would like to make them look like this instead.
Is there a way to override PTCheckMarkStampCreate and PTCrossMarkStampCreate too look like this? Or do you have example of how I can create a new stamp. Thank you
This was very helpful. Thanks @sbehl! I noticed that when I use an Apple Pencil that the new custom stamp is way off? Any ideas on why that might be? It works great without the Pencil but for some reason when I select my custom stamp it is far off where I actually want it.
It looks likes the [-PTCreateToolBase pdfViewCtrl:onTouchesMoved:withEvent: gets called when using the Pencil as it detects tiny bits of movement. This is internally modifying the tool’s self.endPoint property which is causing the annotation to be stamped at the wrong position.
it can be resolved by overriding onTouchesMoved without calling super:
override func pdfViewCtrl(_ pdfViewCtrl: PTPDFViewCtrl, onTouchesMoved touches: Set<UITouch>, with event: UIEvent?) -> Bool {
// Don't call the super call's implementation.
return true.
}