WebViewer Version: "^7.3.2"
Do you have an issue with a specific file(s)? no.
Can you reproduce using one of our samples or online demos? yes for the sample, no for the online demo.
Are you using the WebViewer server? no.
Does the issue only happen on certain browsers? no, on all browsers.
Is your issue related to a front-end framework? yes, GatsbyJS v3.6.1
Is your issue related to annotations? no.
Please give a brief summary of your issue:
The Webviewer works on our local development environment but don’t if we deploy it to Netlify.
We have follow the whole trial tutorial for npm and copy the public folder of node_module/@pdftron/webviewer/public/
into the static folder of Gatsby (which is copied into the public folder of the client app) and we renamed it to webviewer
.
The Webviewer seems to be locked into an infinite loop because we don’t have any errors and nothing happen.
This is the sample code which works in local:
useEffect(() => {
if (data)
import("@pdftron/webviewer").then(WebViewerModule => {
let WebViewer = WebViewerModule.default
WebViewer({
path: "webviewer",
}, viewerDiv.current)
.then(instance => {
// `myBlob` is your blob data which can come
// from sources such as a server or the filesystem
instance.loadDocument(data, {
filename: document.filename,
extension: document.content_type.substr(1).toUpperCase(),
})
const { docViewer } = instance
docViewer.on("documentLoaded", () => {
// perform document operations
})
}).catch(err => {
console.log("ERR ON WEBVIEWER", err)
})
}).catch(err => { console.log("err on import", err) })
}, [data, document.filename, document.content_type])
Best Regards,
Remy Oster, Luca Hermann.
Zenlaw, inc.