Adding custom stamp


Product Version: 9.2.3

Please give a brief summary of your issue:
Custom Stamp as bar button - #5 by jack.knight Trying to do the exact same thing on Android. I need to know where to add the annotation to have it show in the annotation bar.

Please describe your issue and provide steps to reproduce it:

So far we do this:
val toolManagerBuilder = ToolManagerBuilder

val builder = ViewerConfig.Builder()

and the CustomStampClass is here:

class CustomStamp(ctrl: PDFViewCtrl) : BaseTool(ctrl) {
override fun getToolMode(): ToolManager.ToolModeBase {
return MODE

override fun getCreateAnnotType(): Int {
    return Annot.e_Stamp

override fun canDrawLoupe(): Boolean {
    return super.mDrawingLoupe

override fun getLoupeType(): Int {

companion object {
    var MODE: ToolManager.ToolModeBase = ToolManager.ToolMode.addNewMode(Annot.e_Stamp)


I need to find a way to set the annotation icon and add it to the annotation toolbar. With the above code, the annotation bar is showing up, but it is not showing any additional tools.

Hi @jenny.brown

To add your custom stamp tool to the annotation toolbar you will need to create a CustomAnnotationToolbar with the tools you want to see.

From what we can tell from your sample code you are extending the BaseTool class. To create a custom stamp tool you will need to extend the Stamper class instead, otherwise all features of the Stamp tool would not be available. Please see this example of a custom stamp tool.


At what point do I call “setupAnnotationToolbar”, and where do I get the ToolManager to call this function? We are using a custom PdfViewCtrlTabHostFragment, but when I try to call this method in the initViews, we do not have the Fragment Activity yet, so I cannot create a ToolManager using

Hi @jenny.brown

Your initViews call may be happening too early for this method call. You should call setupAnnotationToolbar onDocumentLoaded

mPdfViewCtrlTabHostFragment.addHostListener( new PdfViewCtrlTabHostBaseFragment.TabHostListener() {
            public void onTabDocumentLoaded(String tag) {

You can get a reference to the tool manager by using the following snippet:

ToolManager tm = mPdfViewCtrlTabHostFragment.getCurrentPdfViewCtrlFragment().getToolManager();

Please note getCurrentPdfViewCtrlFragment() can only be called after document is loaded.

You can reference this file for a sample.

Could you give this a try to see if it’ll works for you?