Add custom button to the Menu

Which product are you using?
PDF.js Express Plus

PDF.js Express Version
8.0.1

Detailed description of issue
Is it possible to add a custom button to the Menu? (the one that has the full-screen, dark mode, and print links)
We’re only able to add a custom button to the main bar so far.

Thank you.

Hey! This code should do the trick:

  instance.UI.settingsMenuOverlay.add({
    type: 'actionButton',
    className:"row",
    img: 'IMG_SRC_HERE',
    onClick: () => {
      // action here
    },
    dataElement: 'UNIQUE ID HERE',
    label:'Button Label'
  });

If you want to change the order of the items, you can call getItems, then rearrange the array how you wish, then pass the new array to update

Thanks,
Logan

1 Like

Thanks @Logan it worked, that was exactly what we were looking for.

Thanks again!

1 Like