Hi
I am having some troubles with loading documents with loadDocument. We have the use case, that documents have to be loaded from a server. They are protected by Basic Auth. This code gives an error:
let webviewer = new PDFTron.WebViewer({
type: "html5mobile",
path: "assets/js/",
documentId: "xod",
documentType: "xod",
enableAnnotations: true,
streaming: false,
mobileRedirect: false,
enableOffline: false,
autoCreate: true
}, this.pdftron.nativeElement);
let headers = {
'Authorization': 'Basic ' + btoa(this.user.username + ':' + this.user.password),
'Content-Type': 'application/x-www-form-urlencoded'
};
webviewer.loadDocument('/api/v1/asset/128-xod', {customHeaders: headers});
The following error occurs: TypeError: this.getInstance(...) is undefined Stack-Trace: loadDocument@
http://10.0.1.199:8100/assets/js/WebViewer.js:752:9This code works, but it is not very nice to wait 3 seconds
let webviewer = new PDFTron.WebViewer({
type: "html5mobile",
path: "assets/js/",
documentId: "xod",
documentType: "xod",
enableAnnotations: true,
streaming: false,
mobileRedirect: false,
enableOffline: false,
autoCreate: true
}, this.pdftron.nativeElement);
let headers = {
'Authorization': 'Basic ' + btoa(this.user.username + ':' + this.user.password),
'Content-Type': 'application/x-www-form-urlencoded'
};
window.setTimeout(() => {
webviewer.loadDocument('/api/v1/asset/128-xod', {customHeaders: headers});
}, 3000);
I am happy for any advice.
Best Regards
Volker Andres