当前位置:网站首页>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边栏推荐
- Redis' optimistic lock and pessimistic lock for solving transaction conflicts
- Go deep into the details of deconstruction and assignment of several data types in JS
- . Net delay queue
- The per capita savings of major cities in China have been released. Have you reached the standard?
- 十六进制
- Halcon knowledge: NCC_ Model template matching
- %F format character
- C1 certification learning notes 3 -- Web Foundation
- 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
- 深入JS中几种数据类型的解构赋值细节
猜你喜欢
Building intelligent gray-scale data system from 0 to 1: Taking vivo game center as an example
Scientific research cartoon | what else to do after connecting with the subjects?
Stress, anxiety or depression? Correct diagnosis and retreatment
直播预告 | PostgreSQL 内核解读系列第二讲:PostgreSQL 体系结构
Unity script lifecycle day02
How did the beyond concert 31 years ago get super clean and repaired?
Summer Review, we must avoid stepping on these holes!
MySQL learning notes - data type (numeric type)
Redis哨兵模式实现一主二从三哨兵
压力、焦虑还是抑郁? 正确诊断再治疗
随机推荐
进制形式
左右对齐!
Understand Alibaba cloud's secret weapon "dragon architecture" in the article "science popularization talent"
Redis' optimistic lock and pessimistic lock for solving transaction conflicts
Decimal, exponential
Common API day03 of unity script
2022 financial products that can be invested
[learning notes] matroid
十六进制
Unity脚本API—GameObject游戏对象、Object 对象
Data Lake Governance: advantages, challenges and entry
mysql 联合主键_Mysql 创建联合主键[通俗易懂]
unity update 协程_Unity 协程的原理
文本挖掘工具的介绍[通俗易懂]
Audio and video technology development weekly | 252
LeetCode 1184. 公交站间的距离 ---vector顺逆时针
. Net delay queue
夜天之书 #53 Apache 开源社群的“石头汤”
Stress, anxiety or depression? Correct diagnosis and retreatment
Unity script API - GameObject game object, object object