PDF.js in Ionic: Where and how should I load the webworker?

Solution: In the page constructor:


import * as pdfjsLib from 'pdfjs-dist';
.
.
.

constructor(public navCtrl: NavController, public navParams: NavParams) {

        // Set the Worker Source file
        pdfjsLib.PDFJS.workerSrc = 'assets/pdf.worker.js';
.
.
.
.
}
1 Like