ADF 2.6.0: pdfjsLib is not defined

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Customer

ADF 2.6.0: pdfjsLib is not defined

Jump to solution

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 Solution

Accepted Solutions
Highlighted
Alfresco Employee

Re: ADF 2.6.0: pdfjsLib is not defined

Jump to solution

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 solution in original post

4 Replies
Highlighted
Alfresco Employee

Re: ADF 2.6.0: pdfjsLib is not defined

Jump to solution

Remove those two lines, they are not needed anymore 

Highlighted
Customer

Re: ADF 2.6.0: pdfjsLib is not defined

Jump to solution

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

Highlighted
Alfresco Employee

Re: ADF 2.6.0: pdfjsLib is not defined

Jump to solution

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 solution in original post

Highlighted
Customer

Re: ADF 2.6.0: pdfjsLib is not defined

Jump to solution

This worked for me too.

Thank you!