Focus on the PDF viewer when it loads

Q: How to focus on the PSPDFKit instance when it loads?

A: You can get a reference to the window object of the PSPDFKit for Web viewer frame and call focus() on it after the PSPDFKit.load promise resolves.

1
2
3
PSPDFKit.load(configuration).then(instance => {
  instance.contentWindow.focus();
});

This has been tested with PSPDFKit for Web 2020.5.1.