Do you have an issue with a specific file(s)? No, all files fail.
Can you reproduce using one of our samples or online demos? No
Are you using the WebViewer server? No
Does the issue only happen on certain browsers? No
Is your issue related to a front-end framework? Yes
Is your issue related to annotations? No
Please give a brief summary of your issue:
loadDocument function of WebViewer is not working inside angular material tab (mat-tab-group) when I visit another tab and comes back.
Please describe your issue and provide steps to reproduce it:
I am trying to load WebViewer inside an tab (name: docPreview). It loads fine using this function loadDocument. But if I go to another tab and come back to docPreview tab, same function loadDocument doesnât work. I am not getting any error also.
(The more descriptive your answer, the faster we are able to help you)
Two tabs and one tab has webviewer
mat-tab-group â
A. mat-tab label=âDocument Previewâ
â app-document-preview
//this tab has web viewer component. It shows document fine when I load it first time.
B. mat-tab label=âOtherTabâ
â app-OtherTab-view
2. Web Viewer code (inside app-document-preview). It instantiates a variable named wvIns.
ngAfterViewInit(): void {
My function getDocument loads document. it gets a blob and calls it. I can see document is loaded properly.
getDocument(obj: any): void {
âŚ
this.wvIns.UI.loadDocument(res);
},
âŚ
}
But this function doesnât work if I go to another tab and comes back. I can see it is calling below function but nothing is happening. I tried it with valid hardcode PDF link too and it is not working with that either
Please provide a link to a minimal sample where the issue is reproducible:
I believe this is because when you switch tabs the instance is destroyed when rendering the other viewer, I would suggest moving the WebViewer instance outside the tabs logic outside itâs tab, and then pass it in.
Best regards,
Tyler Gordon
Web Development Support Engineer
PDFTron