#StackBounty: #javascript #pdf Attach a file to a PDF using client-side javascript

Bounty: 50

How can an arbitrary file (eg a xlsx) be attached/embedded to a PDF file using only client-side browser Javascript?

If it matters, the xlsx is given by the user using a input file button and the PDF received from an external web service and encoded in base64.

I am not looking for a complete solution (it would be great if it exists), but how would you approach this problem in a higher level way

Edit:

Files are attached using binary file streams, that looks like this in the pdf file:

32 0 obj
 <</Type /EmbeddedFile /Subtype /{mimetype} /Length 72>>
 stream
 {file data}
 endstream
 endobj


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.