Hopding / pdf-lib

Create and modify PDF documents in any JavaScript environment
https://pdf-lib.js.org
MIT License
7.01k stars 676 forks source link

error TS2502: 'provider' is referenced directly or indirectly in its own type annotation. #1654

Open tandy077 opened 4 months ago

tandy077 commented 4 months ago

What were you trying to do?

1,pdf merge, 2,Does it support merging annotated PDFs

How did you attempt to do it?

A=>Error message: A=>错误信息: ERROR in node_modules/pdf-lib/ts3.4/cjs/api/form/PDFDropdown.d.ts:400:38 - error TS2502: 'provider' is referenced directly or indirectly in its own type annotation. node_modules/pdf-lib/ts3.4/cjs/api/form/PDFDropdown.d.ts:400:38 中的错误 - 错误 TS2502:“provider”在其自己的类型注释中直接或间接引用。

400     updateAppearances(font: PDFFont, provider?: AppearanceProviderFor<PDFDropdown>): void;
                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
i 「wdm」: Failed to compile.

B=>Version information: B=>版本信息: node -v> v14.21.3 节点-v> v14.21.3 npm -v> 6.14.18 npm -v> 2018 年 14 月 6 日 ng -v=> ng-v=> @angular-devkit/architect 0.803.29 @Angular-devkit/建筑师0.803.29 @angular-devkit/build-angular 0.803.29 @angular-devkit/build-optimizer 0.803.29 @Angular-devkit/构建优化器0.803.29 @angular-devkit/build-webpack 0.803.29 @angular-devkit/core 8.3.29 @Angular-devkit/核心 8.3.29 @angular-devkit/schematics 8.3.29 @angular/cdk 8.2.3 @角度/cdk 8.2.3 @angular/cli 8.3.29 @角度/cli 8.3.29 @angular/elements 9.0.0 @角度/元素9.0.0 @angular/material 8.2.3 @角度/材料8.2.3 @ngtools/webpack 8.3.29 @schematics/angular 12.2.18 @schematics/角度12.2.18 @schematics/update 0.803.29 @schematics/更新0.803.29 rxjs 6.4.0 typescript 3.4.3 打字稿 3.4.3 webpack 4.39.2 网页包 4.39.2

What actually happened?

ERROR in node_modules/pdf-lib/ts3.4/cjs/api/form/PDFDropdown.d.ts:400:38 - error TS2502: 'provider' is referenced directly or indirectly in its own type annotation.

What did you expect to happen?

Speculation is that the merge error is caused by the TS version being too high

How can we reproduce the issue?

Merge individual PDFs into one PDF

Version

"pdf-lib": "^1.17.1", "typescript": "3.4.3", "rxjs": "6.4.0", "@angular/core": "8.2.14",

What environment are you running pdf-lib in?

Node

Checklist

Additional Notes

Merge individual PDFs into one PDF,Does it support merging annotated PDFs

lsy934127847 commented 4 months ago

I recently encountered a requirement to compress PDF files to below 4M? What should I do? Please provide a complete example of using it on the browser side. For example, can you specify the maximum compression value and compression quality?