highkite / pdfAnnotate

Javascript library for creating annotations in PDF documents
MIT License
543 stars 90 forks source link

Not working in an Angular 12 app #49

Open aquisio opened 3 years ago

aquisio commented 3 years ago

Hi there,

I am attempting to use pdfAnnotate in an Angular 12 app, in conjunction with ng2-pdf-viewer (which is an Angular wrapper for pdf.js).

I have followed your documented procedure for installing the pdfAnnotate package and the required Angular 9 changes to package.json ...

{
...
        "browser": {
                "fs": false
        }
...
}

... but I am seeing the following error message:

./node_modules/annotpdf/lib/annotation.js:121:25-38 - Error: Module not found: Error: Can't resolve 'fs' in 'C:\Samples\pdfAnnotate\node_modules\annotpdf\lib'

Am I doing something wrong, or is a different configuration required for later Angular versions?

Thanks, in advance.

OldShaterhan commented 2 years ago

Same issue for me.

VincentRoth commented 2 years ago

Hello, I had the same issue for Angular v12.2.5. As far as I dig into the issue, it seems to come from webpack and angular configuration and is not on annotpdf side.

I ugrade to Angular 13 and annotpdf works.

juqing27 commented 9 months ago

@VincentRoth and @aquisio - Hi! I'm working on an Angular (Angular17) app and am hoping to use pdfAnnotate together with ng2-pdfjs-viewer. Haven't got it work so far but it sounds possible in theory, since ngs-pdfjs-viewer is exposing pdf.js as it states. Wonder if you may show me how to integrate these two libraries? For now I'm just trying to create simple annotations, for example using the pdfFactory.createSquareAnnotation() function. Thanks so much!