{ "key_pair_value_system": true, "answer_rating_count": "", "question_feedback_html": { "html_star": "", "html_star_feedback": "" }, "answer_average_rating_value": "", "answer_date_js": "2024-09-26T00:14:52-04:00", "answer_date": "2024-09-26 00:14:52", "is_docs_available": "", "is_excel_available": "", "is_pdf_available": "", "count_file_available": 0, "main_page": "student_question_view", "question_id": "13570639", "url": "\/study-help\/questions\/i-try-to-download-a-png-file-when-there-is-13570639", "question_creation_date_js": "2024-09-26T00:14:52-04:00", "question_creation_date": "Sep 26, 2024 12:14 AM", "meta_title": "[Solved] I try to download a png file. When there | SolutionInn", "meta_description": "Answer of - I try to download a png file. When there is a image on canvas, I add an image to canvas and call toDataURL it shows me | SolutionInn", "meta_keywords": "download,png,file,image,canvas,add,call,todataurl,shows,blank,page,data", "question_title_h1": "I try to download a png file. When there is a image on canvas, I add an image to canvas and call toDataURL it shows", "question_title": "I try to download a png file. When there is a image", "question_title_for_js_snippet": "I try to download a png file When there is a image on canvas, I add an image to canvas and call toDataURL it shows me a blank page, and data url is also blank downloadCanvasAsPng (elementId, link, smiles, itemName) I let canvas canvas document getElementById(elementId) link href canvas toDataURL) link download smiles itemName png link document createElement('a') const fileName smiles ' itemName ' png link download fileName const fileUrl canvas toDataURL() link href fileUrl link target self' link click()", "question_description": "
I try to download a png file.<\/strong><\/p> When there is a image on canvas, I add an image to canvas and call toDataURL it shows me a blank page, and data url is also blank.<\/strong><\/p> <\/p> downloadCanvasAsPng (elementId, link, smiles, itemName) I let canvas; canvas