
- Javascript Basics Tutorial
- Javascript - Home
- Javascript - Overview
- Javascript - Syntax
- Javascript - Enabling
- Javascript - Placement
- Javascript - Variables
- Javascript - Operators
- Javascript - If...Else
- Javascript - Switch Case
- Javascript - While Loop
- Javascript - For Loop
- Javascript - For...in
- Javascript - Loop Control
- Javascript - Functions
- Javascript - Events
- Javascript - Cookies
- Javascript - Page Redirect
- Javascript - Dialog Boxes
- Javascript - Void Keyword
- Javascript - Page Printing
- JavaScript Objects
- Javascript - Objects
- Javascript - Number
- Javascript - Boolean
- Javascript - Strings
- Javascript - Arrays
- Javascript - Date
- Javascript - Math
- Javascript - RegExp
- Javascript - HTML DOM
- JavaScript Advanced
- Javascript - Error Handling
- Javascript - Validations
- Javascript - Animation
- Javascript - Multimedia
- Javascript - Debugging
- Javascript - Image Map
- Javascript - Browsers
- JavaScript Useful Resources
- Javascript - Questions And Answers
- Javascript - Quick Guide
- Javascript - Functions
- Javascript - Resources
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.
- Related Articles
- How to save DIV as Image with HTM5 canvas to image with the extension?
- How to save HTML Canvas as an Image with canvas.toDataURL()?
- How to Save an HTML Element With Filters to an Image?
- How to save an image with matplotlib.pyplot?
- How to save an array as a grayscale image with Matplotlib/Numpy?
- How can I save HTML locally with JavaScript?
- How to save a plot as SVG created with ggplot2 in R?
- How to create an unordered list with image bullets in HTML?
- How to save a Librosa spectrogram plot as a specific sized image?
- How to copy files with the specific extension in PowerShell?
- Replace HTML div into text element with JavaScript?
- How to wrap and unwrap HTML control with a div dynamically using jQuery?
- How to specify an image as a client-side image-map in HTML?
- Center Triangle at Bottom of Div in HTML with CSS
- How to use an image as a link in HTML?

Advertisements