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

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.