0

I'm trying to add text selection in PDFJS using the method renderTextLayer.

Base from this you need to add ui_util.js, though I'm not sure how to add it in an existing Angular 4 Typescript project.

I tried adding it in angular-cli.json like below

"scripts": [
  "../node_modules/pdfjs-dist/lib/web/ui_utils.js"
]

But it doesn't seem to work. Any help will be highly appreciated.

Thanks

Bk Santiago
  • 1,523
  • 3
  • 13
  • 24

1 Answers1

0

Your import to angurla-cli.json looks correct. To use external libraries you also need the typings for the library to make it available in your editor.

For that you have two possibilities:

  1. Import the typings from DefinitelyTyped - if available

  2. Make the library visible in your project by adding some code to typings.d.ts. I have described in a different thread how that can be done.

Hope this helps.

Ludwig
  • 1,242
  • 10
  • 8
  • Actually, angular was able to load the js file, the problem is that it's loading it on the client side rather than the server, and throwing the error `exports` is not defined. – Bk Santiago Dec 06 '17 at 08:18