0

Looking for a way to add a user-uploaded PDF file to a Word document generated in the browser.

The user fills out a questionnaire and has the option to upload a document. At the end, the user clicks on a button and a Word document is generated with the gathered data (using docxtemplater).

The JSON data used for the doc generation is not stored anywhere after these steps.

Is there

a) a library that allows the uploaded file (which will be a PDF) to be added to/embedded in the generated Word document in the front end or b) a way to display the file in the Word document by referencing the data URL in the template?

Example JSON (after generating the document):

"attachmentUpload": [
{
"name": "Example.pdf",
"type: "application/pdf",
"content": "data:application/pdf;base64,[.......]" 
}
]

All I have found so far are libraries to merge two or more PDF files.

Any pointers would be highly appreciated!

Thanks!

edi9999
  • 19,701
  • 13
  • 88
  • 127
Jenny_cgn21
  • 33
  • 1
  • 6

0 Answers0