![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to save DIV as Image with canvas2image with extension in HTML?
DIV content can be saved as image with the help of html2canvas function in javascript.
DIV tag defines a section in HTML document.
Example:
<div id=”cpimg” style=”padding: 20px ; ” > <h4>Hello world</h4> </div>
This shows division area named as cpimg.
Html2canvas function saves div as an image with following code:
html2canvas(document.querySelector(“#cpimg”)).then(canvas { document.body.appendChild(canvas) });
It saves the referred div section “cpimg” into the image.
Advertisements