I have a DB entity called "Invoices". I save every invoice once an order is made into the system. Some informations are an Identifier of the invoice, amount, currency and the selected items (like 2 apples, 3 avocados...) .
In the ftp I have another entity called "Templates". Inside you can find an FTP/AWS S3 reference of the document template that was created by the user.
Based on this information I should give the possibility to the user to:
Upload a template (DOC? or PDF?) where the user can set the reference field inside the document: EX: "The company Foo is selling the following items for %invoice.price% $"
Generate the document depending on the selected order (connected OneToOne with the Invoice entity) compiled with the correct data: EX: "The company Foo is selling the following items for 5'000 $"
Prevent a possible change in the pdf (Im referring to the PDF form that can be changed before printing)
Platforms: Nestjs (backend), Angular (frontend).
So my question is, what is the best package for this type of work? If I want to prevent as much as possible any modification to the file I think I should compile it in the backend. About the template format. I was thinking about pdf with form but its not a good way to costumize it for the user. Im interested on sharing a good solution for template creation whitout that can be easier for the user.