
- HTML Tutorial
- HTML - Home
- HTML - Overview
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Formatting
- HTML - Phrase Tags
- HTML - Meta Tags
- HTML - Comments
- HTML - Images
- HTML - Tables
- HTML - Lists
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML - Frames
- HTML - Iframes
- HTML - Blocks
- HTML - Backgrounds
- HTML - Colors
- HTML - Fonts
- HTML - Forms
- HTML - Embed Multimedia
- HTML - Marquees
- HTML - Header
- HTML - Style Sheet
- HTML - Javascript
- HTML - Layouts
- HTML References
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- HTML - Fonts Ref
- HTML - Events Ref
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
Can you take a screenshot of the page using HTML5 Canvas?
Html2Canvas is a JavaScript library that can take screenshot of the whole web page or specific part. It doesn’t take the screenshot but creates the view based on the page information.
Example
Below given is an example code. Here, html2canvas.js script is included at the <head>. The html2canvas() method is called. Returns the base64 value, which eventually creates image source or an image file.
<!DOCTYPE html> <html> <head> <script src="html2canvas-master/dist/html2canvas.js"></script> </head> <body> <h1>Take screenshot</h1> <div class="container" id='container' > <imgsrc='images/one.jpg' width='50' height='50'> <imgsrc='images/two.jpg' width='50' height='50'> </div> <input type='button' id='but_screenshot' value='Take screenshot' onclick='screenshot();'><br/> <script> function screenshot(){ html2canvas(document.body).then(function(canvas) { document.body.appendChild(canvas); }); } </script> </body> </html>
- Related Articles
- Best way to take screenshot of a web page into Selenium?
- Take screenshot of full page with Selenium Python with chromedriver.
- Make HTML5 Canvas fill the whole page
- How to take a screenshot of the window using Python?(Tkinter)
- Unable to take a photo from webcam using HTML5 and on the first page load
- How to take a screenshot programmatically in Android using Kotlin?
- How can I alter the color of an HTML5 canvas element using jQuery?
- Can the HTML5 Canvas element be created from the Canvas constructor?
- How to take screenshot of a div with JavaScript
- How to capture the screenshot of a specific element rather than entire page using Selenium Webdriver?
- How to programmatically take a screenshot in android?
- How to programmatically take a screenshot on iOS?
- Take screenshot of the options in dropdown in selenium c#.
- How to draw a star by using canvas HTML5?
- How to get the complete screenshot of a page in Selenium with python?

Advertisements