

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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 HTM5 canvas to image with the extension?
DIV content can be saved as an image with the help of html2canvas() function in JavaScript. DIV tag defines a section in HTML document.
Example
<div id = ”cpimg” style = ”padding: 25px ; ” > <h4>Welcome</h4> </div>
This shows the division area named cpimg.
The html2canvas() function save div as an image with the following code −
html2canvas(document.querySelector(“#cpimg”)).then(canvas { document.body.appendChild(canvas) });
It saves the referred div section “cpimg” into the image.
- Related Questions & Answers
- How to save DIV as Image with canvas2image with extension in HTML?
- How to save HTML Canvas as an Image with canvas.toDataURL()?
- How to save an image with matplotlib.pyplot?
- How to save an array as a grayscale image with Matplotlib/Numpy?
- Making an image scale mouse over on HTM5 <canvas>
- How to create a canvas with background image using FabricJS?
- How to Move an Image in Tkinter canvas with Arrow Keys?
- How to save a Librosa spectrogram plot as a specific sized image?
- How can I make a div with irregular shapes with CSS3 and HTM5?
- How to set an image as the list-item marker with JavaScript?
- How to set the image to be used as a border with JavaScript?
- Set background image as fixed with CSS
- How to rotate an image with the canvas HTML5 element from the bottom center angle?
- How to save a canvas as PNG in Selenium?
- How to save an Image in OpenCV using C++?
Advertisements