highkite/pdfAnnotate

Can we use it in Angular 9?

ckvnahsik opened this issue · 1 comments

Hello,

I read your document, And I really appreciated your work.

I have some concern about how to use this library into Angular 9 project

I have install using nmp and import package, that you have suggested in docs but getting compile error'

What I did is,

  1. Import lib in component
    import {AnnotationFactory} from 'annotpdf';

  2. Inject it in providers
    providers:[AnnotationFactory]

  3. Used it in constructor

AnnotationFactory.loadFile(this.fileUrl).then((factory) => {
        this.annotationFactory.createTextAnnotation(0, [50, 50], "Pop up note", "Max")
        this.annotationFactory.download()
})

Thanks,
Your help if highly appreciated

image

Hello @ckvnahsik you need to add
"browser" : { "fs": false }

to the package.json file of your angular project.

Also you should use the factory object provided by the promise to create the text annotation and enact the download. T.i. instead of this.annotationFactory use factory. Its a failure in the documentation, but will be fixed soon.

And do not inject the factory in the providers array.