1👍
✅
The html2pdf package comes with the functionality to handle the generated pdf instead of directly downloading them. It’s outputPdf function takes the desired data format as input and returns the output.
Currently supported data-formats are:
- arraybuffer
- blob
- bloburi
- datauristring
- datauri
It can be used as followed:
const elem = document.getElementById('html'); //element whose pdf is to be made
html2pdf().from(elem).outputPdf('arraybuffer').then((result) => {
// write your desired code here for sendin results to django views
});
Now in order to send this data to backend, you can simply use AJAX post request in this function.
Source:stackexchange.com