Reputation: 1686
So I'm creating an Angular 2 - typescript application and I want to be able to explore PDFs using Mozilla's PDFJS library. I have installed the depenedencies like so:
npm install pdfjs-dist @types/pdfjs-dist --save
Then in my app.modules.ts I attempt to import it like so:
import { PDFJS } from "pdfjs-dist";
And I'm met with the following error when trying to run tsc
I get the following output:
src-ng/csm/app/app.module.ts(27,10): error TS2305: Module '"pdfjs-dist"' has no exported member 'PDFJS'.
I'm at a loss because it appears that the pdfjs-dist typing appears to be in order. Is there something else I should include?
Upvotes: 4
Views: 7121
Reputation: 35857
You have to import it like this:
import * as PDFJS from "pdfjs-dist";
// or individual members
import { getDocument } from "pdfjs-dist";
Upvotes: 8