Solution 1 :

Just get your PDF in a File object and send it to your API. Here is anoher thread about it : Send File to API
By the way, there is a more upvoted answer below the one I linked, both are relevant, butthe second may be easier.

Problem :

The following code works fine and generating PDF on the front end and downloading it successfully. But I am confused about how to send it to the server in API using fetch or Axios. Couldn’t find any documentation regarding this to send it though API and save it as PDF from server-side into s3.

                    const input = document.getElementById('divToPrint');
                    .then((canvas) => {
                        const imgData = canvas.toDataURL('image/png');
                        const pdf = new jsPDF();
                        pdf.addImage(imgData, 'PNG', 0, 0);


Leave a Reply

Your email address will not be published. Required fields are marked *