Custom button with text in main toolbar of professional viewer

Posted by: mark on 30 December 2024, 6:00 pm EST

    • Post Options:
    • Link

    Posted 30 December 2024, 6:00 pm EST

    The code in the demo for adding a custom button to the main toolbar only seems to allow a 24x24 svg icon button. The main toolbar does contain a button with text - the document title button - but it is styled differently and the viewer.toolbar.addItem function does not appear to allow for setting text or custom styles. I have not been able to create a custom button that matches the document title button. Is there any way in the client API to add a button like that?

    I see that the secondary toolbar has a demo for adding textual buttons, but that seems to be a completely different object with the ability to customize the render function. I just want to add a textual button to the main toolbar.

  • Posted 30 December 2024, 6:30 pm EST

    I posted too soon. I found the toolbarItem type definition in the toolbar.d.ts file and see that there is a text property. Is this in the client api documentation and I just missed it? I couldn’t locate the toolbar or toolbarItem object in the docs. At any rate, the api does allow for my use case so my thanks to the developers.

  • Posted 31 December 2024, 2:31 am EST

    Hi,

    Apologies for the inconvenience caused.

    You are correct that the text property can be used to add textual buttons to the main toolbar, and the API supports this functionality. However, at this time, the text property and related customizations are not explicitly documented in our client API and documentation. We understand the importance of having comprehensive documentation and are working on enhancing the same.

    Meanwhile, you can refer to the attached sample project, which illustrates how to customize the appearance of custom button text using CSS - TextualButton.zip

    In addition, we would like you to know that any image (PNG/JPEG/SVG…) can be used as an icon for the toolbar item. However, the icon size should be 24*24 pixels for proper rendering inside the toolbar.

    Please feel free to reach out if you encounter any further issues or require additional guidance.

    Best Regards,

    Kartik

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels