We are integrating the WebView on an Angular 8 application, and in a particular case we would like to display all pages of a document without scrolling (a document is only 2-6 pages long at most).
We are using the Page Canvas mode and setting after document loaded the height of the viewer roughly equal to the sum of heights of the pages.
This works well… often. Randomly, we observe that one or two pages (never the first one) is not rendered, remains blank - and indeed the pageComplete event is not fired for this page, and sometimes there is an error “cannot find page XX - 0” but not every time pages disappear and not for the right indexes.
We have been trying the “recalculateLayout” or “updateView” or “updateVisiblePages” to no avail.
We have also tried the Viewport Canvas mode, and in this case the pages are all always rendered, but the first opening of the document is readable but blurry, many new errors are fired in the browser console and the height of the viewer could not be set properly.
What would you suggest to implement our use case ?
Thank you very much,
Would it be possible for you to provide a sample project that can reproduce this issue? Maybe you could fork and update our Angular sample repo https://github.com/PDFTron/webviewer-angular-sample and then we can investigate on our side from there.
One note, I wouldn’t recommend using the viewport canvas mode as we’re planning to remove it in the next version.
PDFTron Systems Inc.
Thank you for the advice about the viewport canvas mode!
I forked and updated the repo but so far I can’t reproduce the bug : our real app is a great deal more complex and I am trying to add the potential culprits - do you think that local vs server-side rendering could have an impact ?
Since WebViewer will execute completely client side I don’t think the initial local vs server side rendering should make a difference for reproducing the issue. I’m assuming you mean server side rendering of your application and not using something like WebViewer Server https://www.pdftron.com/documentation/web/guides/wv-server-deployment/
PDFTron Systems Inc.