Closed ali-mozaffari closed 1 year ago
Note for you additional you can fetch('data:image/png..................')
then use what you read in the link posted below next to see.
cheers
see: https://github.com/rndme/download/pull/117/files
Closed by:
You can use canvas.toBlob() instead of dataURL, then you can use the Blob as a File. This means you won't really need download.js to append the file to your FormData.
here in the wrote the below code for this purpose, but here it download the image and I want to send it to the server?
export const createPDF = async farmId => { const canvas = await html2canvas(document.getElementById('utmPagePdf')); const dataURL = canvas.toDataURL('image/png'); downloadjs(dataURL, 'download.png', 'image/png');
const data = new FormData(); data.append('farm_guid', farmId); data.append('file', '???');
AddUtmReport(data); };
Please guide me to solve this issue.