PDF.js isnt working with my Angular 1 6 frontend app [closed]

So I am creating a store to sell digital files, where the user can edit the purchased files, by adding text, lists, images, shapes.. and save these edits
I am using Angular 16 for the frontend and Laravel 11 for the backend.
The problem is that every library I tried gave me errors and I found it difficult to integrate, especially since I am a beginner in Angular, I tried fabricJs, Konva, Pdf-lib, pdf.js
i decided to stick with these 2 libraries; pdf.js for displaying and konva.js for editing, what ever i tried i get the same errors :

Error: node_modules/@napi-rs/canvas/index.d.ts:301:17 – error TS2591:
Cannot find name ‘Buffer’. Do you need to install type definitions for
node? Try npm i --save-dev @types/node and then add ‘node’ to the
types field in your tsconfig.

301 getContent(): Buffer
~~~~~~

Error: node_modules/@napi-rs/canvas/index.d.ts:365:58 – error TS2591:
Cannot find name ‘Buffer’. Do you need to install type definitions for
node? Try npm i --save-dev @types/node and then add ‘node’ to the
types field in your tsconfig.

365 encodeSync(format: ‘webp’ | ‘jpeg’, quality?: number): Buffer
~~~~~~

Error: node_modules/@napi-rs/canvas/index.d.ts:366:30 – error TS2591:
Cannot find name ‘Buffer’. Do you need to install type definitions for
node? Try npm i --save-dev @types/node and then add ‘node’ to the
types field in your tsconfig.

366 encodeSync(format: ‘png’): Buffer
~~~~~~

Error: node_modules/@napi-rs/canvas/index.d.ts:367:49 – error TS2591:
Cannot find name ‘Buffer’. Do you need to install type definitions for
node? Try npm i --save-dev @types/node and then add ‘node’ to the
types field in your tsconfig.

367 encodeSync(format: ‘avif’, cfg?: AvifConfig): Buffer
~~~~~~

Error: node_modules/@napi-rs/canvas/index.d.ts:368:62 – error TS2591:
Cannot find name ‘Buffer’. Do you need to install type definitions for
node? Try npm i --save-dev @types/node and then add ‘node’ to the
types field in your tsconfig.

368 encode(format: ‘webp’ | ‘jpeg’, quality?: number):
Promise
~~~~~~

Error: node_modules/@napi-rs/canvas/index.d.ts:369:34 – error TS2591:
Cannot find name ‘Buffer’. Do you need to install type definitions for
node? Try npm i --save-dev @types/node and then add ‘node’ to the
types field in your tsconfig.

369 encode(format: ‘png’): Promise
~~~~~~

Error: node_modules/@napi-rs/canvas/index.d.ts:370:53 – error TS2591:
Cannot find name ‘Buffer’. Do you need to install type definitions for
node? Try npm i --save-dev @types/node and then add ‘node’ to the
types field in your tsconfig.

370 encode(format: ‘avif’, cfg?: AvifConfig): Promise
~~~~~~

Error: node_modules/@napi-rs/canvas/index.d.ts:372:32 – error TS2591:
Cannot find name ‘Buffer’. Do you need to install type definitions for
node? Try npm i --save-dev @types/node and then add ‘node’ to the
types field in your tsconfig.

372 toBuffer(mime: ‘image/png’): Buffer
~~~~~~

Error: node_modules/@napi-rs/canvas/index.d.ts:373:66 – error TS2591:
Cannot find name ‘Buffer’. Do you need to install type definitions for
node? Try npm i --save-dev @types/node and then add ‘node’ to the
types field in your tsconfig.

373 toBuffer(mime: ‘image/jpeg’ | ‘image/webp’, quality?: number):
Buffer
~~~~~~

Error: node_modules/@napi-rs/canvas/index.d.ts:374:51 – error TS2591:
Cannot find name ‘Buffer’. Do you need to install type definitions for
node? Try npm i --save-dev @types/node and then add ‘node’ to the
types field in your tsconfig.

374 toBuffer(mime: ‘image/avif’, cfg?: AvifConfig): Buffer
~~~~~~

Error: node_modules/@napi-rs/canvas/index.d.ts:376:11 – error TS2591:
Cannot find name ‘Buffer’. Do you need to install type definitions for
node? Try npm i --save-dev @types/node and then add ‘node’ to the
types field in your tsconfig.

376 data(): Buffer
~~~~~~

Error: node_modules/@napi-rs/canvas/index.d.ts:402:18 – error TS2591:
Cannot find name ‘Buffer’. Do you need to install type definitions for
node? Try npm i --save-dev @types/node and then add ‘node’ to the
types field in your tsconfig.

402 register(font: Buffer, nameAlias?: string): boolean
~~~~~~

Error: node_modules/@napi-rs/canvas/index.d.ts:444:43 – error TS2591:
Cannot find name ‘Buffer’. Do you need to install type definitions for
node? Try npm i --save-dev @types/node and then add ‘node’ to the
types field in your tsconfig.

444 export function convertSVGTextToPath(svg: Buffer | string): Buffer
~~~~~~

Error: node_modules/@napi-rs/canvas/index.d.ts:444:61 – error TS2591:
Cannot find name ‘Buffer’. Do you need to install type definitions for
node? Try npm i --save-dev @types/node and then add ‘node’ to the
types field in your tsconfig.

444 export function convertSVGTextToPath(svg: Buffer | string): Buffer
~~~~~~

Error: node_modules/@napi-rs/canvas/index.d.ts:449:27 – error TS2307:
Cannot find module ‘http’ or its corresponding type declarations.

449 requestOptions?: import(‘http’).RequestOptions
~~~~~~

Error: node_modules/@napi-rs/canvas/index.d.ts:453:26 – error TS2591:
Cannot find name ‘Buffer’. Do you need to install type definitions for
node? Try npm i --save-dev @types/node and then add ‘node’ to the
types field in your tsconfig.

453 source: string | URL | Buffer | ArrayBufferLike | Uint8Array |
Image | import(‘stream’).Readable,
~~~~~~

Error: node_modules/@napi-rs/canvas/index.d.ts:453:81 – error TS7016:
Could not find a declaration file for module ‘stream’.
‘C:/laragon/www/Angular_Laravel/frontend-app/node_modules/stream/index.js’
implicitly has an ‘any’ type. Try npm i --save-dev @types/stream
if it exists or add a new declaration (.d.ts) file containing declare module 'stream';

453 source: string | URL | Buffer | ArrayBufferLike | Uint8Array |
Image | import(‘stream’).Readable,
~~~~~~~~

Error: node_modules/pdfjs-dist/types/src/display/api.d.ts:732:18 –
error TS2315: Type ‘Uint8Array’ is not generic.

732 initialData: Uint8Array | null;
~~~~~~~~~~~~~~~~~~~~~~~~~~~

Error:
node_modules/pdfjs-dist/types/src/display/cmap_reader_factory.d.ts:11:19

  • error TS2315: Type ‘Uint8Array’ is not generic.

11 cMapData: Uint8Array;
~~~~~~~~~~~~~~~~~~~~~~~~~~~

Error:
node_modules/pdfjs-dist/types/src/display/cmap_reader_factory.d.ts:24:31

  • error TS2315: Type ‘Uint8Array’ is not generic.

24 _fetch(url: any): Promise<Uint8Array>;
~~~~~~~~~~~~~~~

Error:
node_modules/pdfjs-dist/types/src/display/editor/stamp.d.ts:35:19 –
error TS2315: Type ‘Uint8ClampedArray’ is not generic.

35 data: Uint8ClampedArray;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Error: node_modules/pdfjs-dist/types/src/display/node_utils.d.ts:1:46

  • error TS2315: Type ‘Uint8Array’ is not generic.

1 export function fetchData(url: any):
Promise<Uint8Array>;
~~~~~~~~~~~~~~~~~~~~~~~

Error: node_modules/pdfjs-dist/types/src/display/node_utils.d.ts:12:31

  • error TS2315: Type ‘Uint8Array’ is not generic.

12 _fetch(url: any): Promise<Uint8Array>;
~~~~~~~~~~~~~~~~~~~~~~~

Error: node_modules/pdfjs-dist/types/src/display/node_utils.d.ts:20:31

  • error TS2315: Type ‘Uint8Array’ is not generic.

20 _fetch(url: any): Promise<Uint8Array>;
~~~~~~~~~~~~~~~~~~~~~~~

Error:
node_modules/pdfjs-dist/types/src/display/standard_fontdata_factory.d.ts:8:17

  • error TS2315: Type ‘Uint8Array’ is not generic.

8 }): Promise<Uint8Array>;
~~~~~~~~~~~~~~~~~~~~~~~~~~~

Error:
node_modules/pdfjs-dist/types/src/display/standard_fontdata_factory.d.ts:19:31

  • error TS2315: Type ‘Uint8Array’ is not generic.

19 _fetch(url: any): Promise<Uint8Array>;
~~~~~~~~~~~~~~~

Error: node_modules/pdfjs-dist/types/src/shared/util.d.ts:351:42 –
error TS2315: Type ‘Uint8Array’ is not generic.

351 export function stringToBytes(str: any): Uint8Array;
~~~~~~~~~~~~~~~

my code is basic i didnt do much:

import { Component, ElementRef, AfterViewInit } from '@angular/core';
import * as pdfjsLib from 'pdfjs-dist';
import 'pdfjs-dist/web/pdf_viewer';
@Component({
  selector: 'app-editor',
  templateUrl: './editor.component.html',
  styleUrls: ['./editor.component.css']
})

export class EditorComponent implements AfterViewInit {
  constructor(private el: ElementRef) { }

  ngAfterViewInit(): void {
    this.loadPdfViewer();
  }

  loadPdfViewer() {
    const pdfUrl = '/assets/sample.pdf';
    const viewerContainer = this.el.nativeElement.querySelector('#viewerContainer');
    const viewer = new (pdfjsLib as any).PDFViewer({
      container: viewerContainer,
    });

    pdfjsLib.GlobalWorkerOptions.workerSrc = `https://cdnjs.cloudflare.com/ajax/libs/pdf.js/${pdfjsLib.version}/pdf.worker.min.js`;

    const loadingTask = pdfjsLib.getDocument(pdfUrl);
    loadingTask.promise.then((pdfDocument: any) => {
      viewer.setDocument(pdfDocument);
    });
  }
}

can anyone tell me how to solve this problem?
ps: i already tried adding,
“types”: [
“node”
] to my tsconfig.json file

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật