cancel
Showing results for 
Search instead for 
Did you mean: 

ADF 2.6.0: pdfjsLib is not defined

d_moeyersons
Star Contributor
Star Contributor

After generating a new ADF 2.6.0 app with Yeoman, when I try to preview a document I get the following error:

'pdfjsLib' is not defined

main.ts contains the following lines: 

main.ts
import * as pdfjsLib from 'pdfjs-dist';
pdfjsLib.PDFJS.workerSrc = 'pdf.worker.js';

Sticking to 2.5.0 for my app

1 ACCEPTED ANSWER

The following helped me:

- npm install pdfjs-dist@latest

- remove those 2 lines from the main.ts

- update "angular.json" asset, from "pdf.worker.js" to "pdf.worker.min.js"

- npm start

We will update the yeoman generator shortly.

View answer in original post

4 REPLIES 4

dvuika
Star Collaborator
Star Collaborator

Remove those two lines, they are not needed anymore 

The lines are removed, but the error is still active. Smiley Happy

The following helped me:

- npm install pdfjs-dist@latest

- remove those 2 lines from the main.ts

- update "angular.json" asset, from "pdf.worker.js" to "pdf.worker.min.js"

- npm start

We will update the yeoman generator shortly.

This worked for me too.

Thank you!