hisusu32
hisusu32

Reputation: 447

Can I use a nodeJS library in my react project

I have a project that I'm building using React Typescript. I have a react form that on submit I want update a fillable PDF using array values.

I ran into this library here: https://www.npmjs.com/package/pdffiller

Am i able to incorporate this into my react project? If so how?

Would I still use import PDFfiller or would I use var. If not, what would be my best option? I don't see any react libraries that does what I'm looking for.

Basically, I have a react form that user fills out which is a product invoice form. I have an existing fillable PDF in my project. On form submit I want to access the PDF and fill the form from the values in my array to create and return back a PDF with the information.

Upvotes: 0

Views: 303

Answers (2)

Ognjen
Ognjen

Reputation: 144

I am using ReactJS with NodeJS and this is how : On my NodeJS server I am running backend operations. For my ReactJS to communicate with NodeJS, I am using WebSockets that are implemented on client side using Redux (using their store to make my WebSockets) available everywhere.

This is pretty much it, you will need to run them on two different ports but it is do-able.

Upvotes: 1

Nicky McCurdy
Nicky McCurdy

Reputation: 19534

No, not on the frontend at least. This package relies on PDF Toolkit which is a native module.

Your alternatives are to find some browser-compatible library like pdf.js, or make a Node server to use this library in.

Upvotes: 0

Related Questions