当前位置:网站首页>How to save the contents of div as an image- How to save the contents of a div as a image?
How to save the contents of div as an image- How to save the contents of a div as a image?
2022-07-04 15:52:00 【Bustling city 】
problem :
Basically, I am doing what the heading states, attempting to save the contents of a div as an image. Basically , I'm doing what the title says , Attempt to div The content of is saved as an image .
I plan on making a small online application for the iPad. I plan to iPad Make a small online application .
One function that is a must is having a 'Save' button that can save the full webpage as an image, and save that image to the iPad's camera roll. A necessary function is to have a “ preservation ” Button , You can save the entire web page as an image , And save the image to iPad In my camera film .I wish to save the full contents of a div, not just the visible area. I want to save div The whole content of , Not just visible areas .
I have searched briefly online, but couldn't find much documentation on anything. I did a short search on the Internet , But I can't find any documents about anything .I found a lot on HTML5 Canvas. I am here HTML5 Canvas Found a lot on .Here is some code I put together: Here are some codes I put together :
<script>function saveimg(){ var c = document.getElementById('mycanvas'); var t = c.getContext('2d'); window.location.href = image; window.open('', document.getElementById('mycanvas').toDataURL());}</script><div id="mycanvas">This is just a test<br />12344<br /></div><button onclick="saveimg()">Save</button>
Although, I am getting this error: although , I received this error :
TypeError: c.getContext is not a function
This application will be built only with HTML, CSS and jQuery (or other Javascript libraries). This application will only use HTML、CSS and jQuery( Or others Javascript library ) structure .
Solution :
Reference resources : https://stackoom.com/en/question/1Fxrf边栏推荐
- [Dalian University of technology] information sharing of postgraduate entrance examination and re examination
- Dry goods | fMRI standard reporting guidelines are fresh, come and increase your knowledge
- Unity脚本API—Component组件
- Logstash~Logstash配置(logstash.yml)详解
- Nine CIO trends and priorities in 2022
- Unity脚本介绍 Day01
- Case sharing | integrated construction of data operation and maintenance in the financial industry
- 谈SaaS下如何迅速部署应用软件
- The per capita savings of major cities in China have been released. Have you reached the standard?
- Detailed explanation of MySQL composite index (multi column index) use and optimization cases
猜你喜欢
Redis sentinel mode realizes one master, two slave and three Sentinels
压力、焦虑还是抑郁? 正确诊断再治疗
Deep learning network regularization
How did the beyond concert 31 years ago get super clean and repaired?
数据湖治理:优势、挑战和入门
AI has surpassed Dr. CS in question making?
C1 certification learning notes 3 -- Web Foundation
這幾年爆火的智能物聯網(AIoT),到底前景如何?
Audio and video technology development weekly | 252
Stress, anxiety or depression? Correct diagnosis and retreatment
随机推荐
Unity animation day05
How can floating point numbers be compared with 0?
宽度精度
2022年九大CIO趋势和优先事项
Unity script introduction day01
MySQL index optimization
I plan to teach myself some programming and want to work as a part-time programmer. I want to ask which programmer has a simple part-time platform list and doesn't investigate the degree of the receiv
Nine CIO trends and priorities in 2022
Lombok使用引发的血案
[learning notes] matroid
Enter the width!
【读书会第十三期】FFmpeg 查看媒体信息和处理音视频文件的常用方法
怎么判断外盘期货平台正规,资金安全?
%s格式符
深入JS中几种数据类型的解构赋值细节
MySQL组合索引(多列索引)使用与优化案例详解
The four most common errors when using pytorch
在芯片高度集成的今天,绝大多数都是CMOS器件
重排数组
AI has surpassed Dr. CS in question making?