Product: Apryse Webviewer
Product Version: 11.9.0
Please give a brief summary of your issue:
Hi there,
We need to use a config file in our deployment of apryse because we need to serve the static assets from a different URL. When we do this, we have found that the standard instructions don’t appear to be working with a config file. The app throws the following error after our initApryse function is called - ReferenceError: instance is not defined. How are we supposed to access the instance if not using a global instance property as suggested in the docs?
Note: We did add an entrypoint in our webpack.config in order to add the config file to our bundle. Could this be the source of the issue and if so, how do you recommend we package the app with webpack when using a config file.
Please describe your issue and provide steps to reproduce it:
Please provide a link to a minimal sample where the issue is reproducible:
// src/apryse/apryse.config.ts
declare const instance: any
instance.UI.addEventListener(instance.UI.Events.VIEWER_LOADED, () => {
console.log("this should work"); // it doesn't - throws a "instance is undefined" error in the browser
});
// webpack.config.js
{
entry: {
app: "./src/index.tsx",
apryseConfig:"./src/apryse/apryse.config.ts"
...},
}
// calling function
initApryse = (viewer: HTMLElement) => {
logger.info("Initializing apryse");
return WebViewer({
licenseKey: // license-key //
path: path,
config: "/apryseConfig.js"
}, viewer)
.then(() => logger.info("Initialized Apryse successfully")