Getting reference to pdfjsLib using the @types/pdfjs-dist in Angular

I am trying to use the pdf.js library in a pre-compiled Angular 9 project.

I install using npm i --save pdfjs-dist and npm i --save @types/pdfjs-dist

Then from what I see online, I should be able to use import * as pdfjsLib from 'pdfjs-dist'; to access it within my component. The problem is I get this error in my compiler:

error message

I have tried many other ways to get a reference, but they either can't get the reference, or throw the same error message.

I have also tried what is suggested here: Importing namespace and interface with methods in TypeScript (TSX) in pdfjs-dist (PDFJS) however, I get errors telling me that PDFJSStatic is not an exported member.

error 2

Any help at all would be appreciated!

My goal is to be able to use the getDocument() function.

Read more here:

Content Attribution

This content was originally published by Benito at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: