Using PDF js in an ionic application creates laggy scroll experience


Hi guys,

We’re trying to add the default mozilla pdf.js pdf viewer inside an ionic application. The idea was to separate concerns: Pdf.js in an iframe loaded on a ionic template. But unfortunately the pdf.js suddenly gets this slow and laggy scrolling experience. Something it doesn’t have if we add it to a cordova app without the Ionic framework.

Maybe ionic is somehow messing with the scrolling, but disabling scroll on the ion-content directives doesn’t change the behavior.

Besides laggy behavior the app sometimes crashes after several memory warnings. (also something it does not do with Pdf.js on its own. Without the ionic framework)

Pdf.js is quite a heavy application, so maybe it’s just too much side by side. But just to be sure, I’m asking. Maybe anyone has an idea how this can be possibly tuned into a better experience.

hope to hear from you.



The problem disappears when using WKWebview. So probably using pdf.js and ionic at the same time is just a bit too heavy for the standard uiwebview, as it doesn’t use the nitroJS engine.



Maybe you could use PDF.js just with the InAppBrowser plugin? Or do you need to have it embedded right in the UI of the app?


It would need to be embedded yes…


The problem with this approach is that it would not work on Android.


Well, yeah. But did I mention that the laggy experience as only noticed on iOS? (I didn’t test android as we’re not publishing to that os)