source: imaps-frontend/node_modules/html2canvas/README.md

main
Last change on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 3.7 KB
Line 
1html2canvas
2===========
3
4[Homepage](https://html2canvas.hertzen.com) | [Downloads](https://github.com/niklasvh/html2canvas/releases) | [Questions](https://github.com/niklasvh/html2canvas/discussions/categories/q-a)
5
6[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/niklasvh/html2canvas?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
7![CI](https://github.com/niklasvh/html2canvas/workflows/CI/badge.svg?branch=master)
8[![NPM Downloads](https://img.shields.io/npm/dm/html2canvas.svg)](https://www.npmjs.org/package/html2canvas)
9[![NPM Version](https://img.shields.io/npm/v/html2canvas.svg)](https://www.npmjs.org/package/html2canvas)
10
11#### JavaScript HTML renderer ####
12
13 The script allows you to take "screenshots" of webpages or parts of it, directly on the users browser. The screenshot is based on the DOM and as such may not be 100% accurate to the real representation as it does not make an actual screenshot, but builds the screenshot based on the information available on the page.
14
15
16### How does it work? ###
17The script renders the current page as a canvas image, by reading the DOM and the different styles applied to the elements.
18
19It does **not require any rendering from the server**, as the whole image is created on the **client's browser**. However, as it is heavily dependent on the browser, this library is *not suitable* to be used in nodejs.
20It doesn't magically circumvent any browser content policy restrictions either, so rendering cross-origin content will require a [proxy](https://github.com/niklasvh/html2canvas/wiki/Proxies) to get the content to the [same origin](http://en.wikipedia.org/wiki/Same_origin_policy).
21
22The script is still in a **very experimental state**, so I don't recommend using it in a production environment nor start building applications with it yet, as there will be still major changes made.
23
24### Browser compatibility ###
25
26The library should work fine on the following browsers (with `Promise` polyfill):
27
28* Firefox 3.5+
29* Google Chrome
30* Opera 12+
31* IE9+
32* Safari 6+
33
34As each CSS property needs to be manually built to be supported, there are a number of properties that are not yet supported.
35
36### Usage ###
37
38The html2canvas library utilizes `Promise`s and expects them to be available in the global context. If you wish to
39support [older browsers](http://caniuse.com/#search=promise) that do not natively support `Promise`s, please include a polyfill such as
40[es6-promise](https://github.com/jakearchibald/es6-promise) before including `html2canvas`.
41
42To render an `element` with html2canvas, simply call:
43` html2canvas(element[, options]);`
44
45The function returns a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) containing the `<canvas>` element. Simply add a promise fulfillment handler to the promise using `then`:
46
47 html2canvas(document.body).then(function(canvas) {
48 document.body.appendChild(canvas);
49 });
50
51### Building ###
52
53You can download ready builds [here](https://github.com/niklasvh/html2canvas/releases).
54
55Clone git repository:
56
57 $ git clone git://github.com/niklasvh/html2canvas.git
58
59Install dependencies:
60
61 $ npm install
62
63Build browser bundle
64
65 $ npm run build
66
67### Examples ###
68
69For more information and examples, please visit the [homepage](https://html2canvas.hertzen.com) or try the [test console](https://html2canvas.hertzen.com/tests/).
70
71### Contributing ###
72
73If you wish to contribute to the project, please send the pull requests to the develop branch. Before submitting any changes, try and test that the changes work with all the support browsers. If some CSS property isn't supported or is incomplete, please create appropriate tests for it as well before submitting any code changes.
Note: See TracBrowser for help on using the repository browser.