Why do I get an "Uncaught TypeError" when trying to embed the Viewer in my web application?

Question

I’m receiving the error “Uncaught TypeError: Cannot read property ‘viewer’ of undefined” when trying to embed the PrizmDoc Viewer in my web application. What could be the issue?

Answer

This indicates that the template property in the viewer initialization has not been specified or is undefined.

To fix this, ensure you are loading viewerCustomizations.js.

If the version you are working with predates viewerCustomizations.js, you can get a copy of viewerCustomizations.js from the viewer assets, hosted here, and update your viewer initialization code.