{"_id":"@bojagi/dom-to-image-more","_rev":"3-b96ab34f90807ab6a1ee705dc603c7a3","name":"@bojagi/dom-to-image-more","dist-tags":{"latest":"2.8.7"},"versions":{"2.8.5":{"name":"@bojagi/dom-to-image-more","version":"2.8.5","private":false,"description":"Generates an image from a DOM node using HTML5 canvas and SVG","main":"dist/@bojagi/dom-to-image-more.min.js","devDependencies":{"chai":"^4.2.0","grunt":"^1.0.4","grunt-cli":"^1.3.2","grunt-contrib-jshint":"^2.1.0","grunt-contrib-uglify":"^4.0.1","grunt-contrib-watch":"^1.1.0","grunt-karma":"^3.0.2","js-yaml":"^3.13.1","karma":"^4.1.0","karma-chai":"^0.1.0","karma-chrome-launcher":"^2.2.0","karma-firefox-launcher":"^1.1.0","karma-mocha":"^1.3.0","karma-mocha-reporter":"^2.2.5","mocha":"^6.1.4"},"scripts":{"publish":"./bin/publish.sh","test":"./node_modules/.bin/grunt test","build":"./node_modules/.bin/grunt"},"repository":{"type":"git","url":"git+https://github.com/1904labs/dom-to-image-more.git"},"keywords":["dom","image","raster","render","html","canvas","svg"],"contributors":[{"name":"Marc Brooks","email":"idisposable@gmail.com"},{"name":"Anatolii Saienko","email":"anatoly.sayenko@gmail.com"},{"name":"Marc Brooks","email":"idisposable@gmail.com"},{"name":"Daniel Fischer","email":"daniel.fischer@iqdoq.de"},{"name":"Aidas Klimas"},{"name":"Edgardo Di Gesto"},{"name":"樊冬 Fan Dong","email":"CG-man@outlook.com"}],"license":"MIT","bugs":{"url":"https://github.com/bojagi/dom-to-image-more/issues"},"homepage":"https://github.com/bojagi/dom-to-image-more#readme","licenseText":"The MIT License (MIT)\n\nCopyright 2018 Marc Brooks\nhttps://about.me/idisposable\n\nCopyright 2015 Anatolii Saienko\nhttps://github.com/tsayen\n\nCopyright 2012 Paul Bakaus\nhttp://paulbakaus.com/\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\nLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\nOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\nWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","_id":"@bojagi/dom-to-image-more@2.8.5","dist":{"shasum":"77151e41799ddf1cd0387b55bc17583cc4c8ade8","integrity":"sha512-l73bUB/s0eKwx/uQ4jWt8EkPMSgMOp2aP4cuCckv4mU0lPslB3o6liPuRq7cYBt5zVnFRGoC/CoP3F71m5UMxA==","tarball":"https://registry.npmjs.org/@bojagi/dom-to-image-more/-/dom-to-image-more-2.8.5.tgz","fileCount":167,"unpackedSize":3521908,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgIXE/CRA9TVsSAnZWagAA034P/AvT9GqKOKvXVNN6+XLa\nZPDag15nxOHAtkFi5Ys0ENHbv9kOlBtDkVl+GULAWsl0zjfo1UvgA8WcPYcQ\nqgUFfEc5P3PIolQO8PZ60Jz5gWqLuyMpLlMX0hKIZHqp2+ry9qKIyCxhmmRn\n670LBRqc2Xei3m/whBlHYwtWm8R1d/qeDi4oCv4uvh9Euj934tMDT59GKmcn\nEEuPlBzChw9y/qaH+Rc05/O/WR28ElZpuwimbXEV3eCzTUUvBi+Ql4ZgolZp\nqayyVirWrGFTCPTnJvtyDbf0aMGw69T00SuvNa/9AYsu7s3RuGcjSCxYfRNP\nXafDHyPxrU/Kj2/Zt9KimxdwlI7rxPxbgz8fPnWhhmJn4KY7HeOys6/joUEI\nJXnml+IDJyKCEyMpMnrkhCS/Y/C/qbsLfxP7DVxV2N5kTP9d9q5rIkGdOMsu\n6RLZ7n5H+srrWj27l+Xfg3J3wHHpmbUUzu3lZCcv4bROAHtY6ZaKFpyFm+n1\n711XJ94I4gXwrOUUpnxPoS4Jo5J3Rx8m1sgwQHhMZiht183Plu+doIZYopyE\nUAy0JKWFlAG1Cb0zPA5zauGZUfnU18Z6L2lvthOxE5FHokVh38hai+kCbboN\nU8g7v2DhlbG5CIYWSgHl920g29e2pTCs5+Xo9t4x1BuwI9zxtc/ghsy7zknP\nMKJn\r\n=uEwM\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC37y/AxqXRaUBtaEPq8wQtRBCjw6lDsUhd9D7o9ZUABwIgeUpolzJ6CGc6mRgHhX4KjKmk8nC9XLDh2LkKHRGwI5s="}]},"_npmUser":{"name":"hyphe","email":"accounts@bojagi.io"},"directories":{},"maintainers":[{"name":"hyphe","email":"accounts@bojagi.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/dom-to-image-more_2.8.5_1612804414700_0.40676476238526016"},"_hasShrinkwrap":false},"2.8.6":{"name":"@bojagi/dom-to-image-more","version":"2.8.6","private":false,"description":"Generates an image from a DOM node using HTML5 canvas and SVG","main":"dist/@bojagi/dom-to-image-more.min.js","devDependencies":{"chai":"^4.2.0","grunt":"^1.0.4","grunt-cli":"^1.3.2","grunt-contrib-jshint":"^2.1.0","grunt-contrib-uglify":"^4.0.1","grunt-contrib-watch":"^1.1.0","grunt-karma":"^3.0.2","js-yaml":"^3.13.1","karma":"^4.1.0","karma-chai":"^0.1.0","karma-chrome-launcher":"^2.2.0","karma-firefox-launcher":"^1.1.0","karma-mocha":"^1.3.0","karma-mocha-reporter":"^2.2.5","mocha":"^6.1.4"},"scripts":{"publish":"./bin/publish.sh","test":"./node_modules/.bin/grunt test","build":"./node_modules/.bin/grunt"},"repository":{"type":"git","url":"git+https://github.com/1904labs/dom-to-image-more.git"},"keywords":["dom","image","raster","render","html","canvas","svg"],"contributors":[{"name":"Marc Brooks","email":"idisposable@gmail.com"},{"name":"Anatolii Saienko","email":"anatoly.sayenko@gmail.com"},{"name":"Marc Brooks","email":"idisposable@gmail.com"},{"name":"Daniel Fischer","email":"daniel.fischer@iqdoq.de"},{"name":"Aidas Klimas"},{"name":"Edgardo Di Gesto"},{"name":"樊冬 Fan Dong","email":"CG-man@outlook.com"}],"license":"MIT","bugs":{"url":"https://github.com/bojagi/dom-to-image-more/issues"},"homepage":"https://github.com/bojagi/dom-to-image-more#readme","licenseText":"The MIT License (MIT)\n\nCopyright 2018 Marc Brooks\nhttps://about.me/idisposable\n\nCopyright 2015 Anatolii Saienko\nhttps://github.com/tsayen\n\nCopyright 2012 Paul Bakaus\nhttp://paulbakaus.com/\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\nLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\nOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\nWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","_id":"@bojagi/dom-to-image-more@2.8.6","dist":{"shasum":"cb47ca6fac0bd3c21a63495ba82de1d34e266d4d","integrity":"sha512-tY2kJFobwMeykVLKDDdyUe7wUpOPGzP4yD+vtbqX8yfS0iEkKZj6osHmNZu+2XtGUlwdDF3Vs0Rvr+cOcZSJeg==","tarball":"https://registry.npmjs.org/@bojagi/dom-to-image-more/-/dom-to-image-more-2.8.6.tgz","fileCount":167,"unpackedSize":3522236,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgJS5vCRA9TVsSAnZWagAAlWIP/ju7xF8RdEx0sONIEXbT\nZiSWbamnwrlHFr72zsEtPeMMj3xxuY/kVNNdwoU+bWZ9Du1Grwi3hU2NOXVA\nvPmHLzQfb3dzIcWtiT7RptLBqXeKLRcYMlHL+BO2zzJQAdnI/bpWPXhzhSCI\nWXYRPU6p/DJMUROx3agtzDz7hKsgpicpBBbZVdcKOmtMsRwwgYWHiZHxKyiE\n5hz3pg4TOeofmM02AJiyeOHjO1AmV3egW3G50n3sWfuLZV+IJUaHvoCdeAEc\n/CmtSIo9PrXa5Ef5n608FseKN/nkgklwt0NK4w/5a3y3lqWNk+2Rl15Ey96H\nNRqlO6TpdAsow1HmuXWfskwtBePTmxl43hBp4+FCjYKbsk2CLnnf4lBoZXdc\ncjXAoc3E1imwdx62PlgMEgIFNofUzQbMGoq2P12BBIqwy0B4gUNO78br3Jqz\n2/kAYHiY2HABwOl+yVqE+GmxBQpdihDLW+D04d+pIzAYUfIiOS/Gzipq3h4w\nstO7QaQPCT1xglb1Tn5iXL9SWJN2A6e+4viJiZK5Jyk63xFo2+6bDX/9PLGT\nYy60GZnrV6FAh7TOU9FCgxUb3DxDQz5r8MWxgBzdGn2twi1RSmfvEGLAXhfg\ngO39S9/kRVPZTDM9WQ6Cqwlja3dQeieoOqanWx21bEFGdE8+U1gHx6x+ike8\nr0YQ\r\n=9LIY\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCPN1xuUVhxvJ4s4UlDm6MOxEf2W4qrEJ2CHdhbnI9QNAIgEYo7RT/ejmmKF1mMiAeAEvLsPDrVTE9i1ueU2UoSPTg="}]},"_npmUser":{"name":"hyphe","email":"accounts@bojagi.io"},"directories":{},"maintainers":[{"name":"hyphe","email":"accounts@bojagi.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/dom-to-image-more_2.8.6_1613049454968_0.9814154013435077"},"_hasShrinkwrap":false},"2.8.7":{"name":"@bojagi/dom-to-image-more","version":"2.8.7","private":false,"description":"Generates an image from a DOM node using HTML5 canvas and SVG","main":"dist/@bojagi/dom-to-image-more.min.js","devDependencies":{"chai":"^4.2.0","grunt":"^1.0.4","grunt-cli":"^1.3.2","grunt-contrib-jshint":"^2.1.0","grunt-contrib-uglify":"^4.0.1","grunt-contrib-watch":"^1.1.0","grunt-karma":"^3.0.2","js-yaml":"^3.13.1","karma":"^4.1.0","karma-chai":"^0.1.0","karma-chrome-launcher":"^2.2.0","karma-firefox-launcher":"^1.1.0","karma-mocha":"^1.3.0","karma-mocha-reporter":"^2.2.5","mocha":"^6.1.4"},"scripts":{"publish":"./bin/publish.sh","test":"./node_modules/.bin/grunt test","build":"./node_modules/.bin/grunt"},"repository":{"type":"git","url":"git+https://github.com/1904labs/dom-to-image-more.git"},"keywords":["dom","image","raster","render","html","canvas","svg"],"contributors":[{"name":"Marc Brooks","email":"idisposable@gmail.com"},{"name":"Anatolii Saienko","email":"anatoly.sayenko@gmail.com"},{"name":"Marc Brooks","email":"idisposable@gmail.com"},{"name":"Daniel Fischer","email":"daniel.fischer@iqdoq.de"},{"name":"Aidas Klimas"},{"name":"Edgardo Di Gesto"},{"name":"樊冬 Fan Dong","email":"CG-man@outlook.com"}],"license":"MIT","bugs":{"url":"https://github.com/bojagi/dom-to-image-more/issues"},"homepage":"https://github.com/bojagi/dom-to-image-more#readme","licenseText":"The MIT License (MIT)\n\nCopyright 2018 Marc Brooks\nhttps://about.me/idisposable\n\nCopyright 2015 Anatolii Saienko\nhttps://github.com/tsayen\n\nCopyright 2012 Paul Bakaus\nhttp://paulbakaus.com/\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\nLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\nOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\nWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","_id":"@bojagi/dom-to-image-more@2.8.7","dist":{"shasum":"9c391d3b805d30e9e92f2b2d3b33e52b5d0ce5ae","integrity":"sha512-ZwT+M6g+X8NheU4Dn3X/DwMXsxIJYGCYCr0DLXfEcFXFSu1epefZMP8sGXj5SJToHMlB1p8MpLoQISeo6YLLAQ==","tarball":"https://registry.npmjs.org/@bojagi/dom-to-image-more/-/dom-to-image-more-2.8.7.tgz","fileCount":167,"unpackedSize":3522236,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgJS72CRA9TVsSAnZWagAAiPwP/26wCL+lPaAkrRZe/DQn\nSrJOJ+AhjtgQ/cQjqCbiZhoxWKbcFjJDETaYKYLjhY/V0H0d+rx59aOqFk2f\nIOk/IYNV8QFcrBp5Xg6DJAtglboOLEiI2+zPRqKCG4er7w5WNQOWfWj2lemn\nUYEE9NHstoHb0dlF2g54iTNApmTX8/dvDzLVuK8nZfW7oYdKYdELpMQzDHkd\nCn6ATr8Ii3ZQjL1zYDg5IbxSZ2cn/cfiBzyheinO4lW6bf5yVPgOnFEx+9Cq\nfFO1nTV1WK1ObwP6LubsD14oUoAz5u/j3Ihpse566FOz8sPdGhMzWhg6r300\nV9DKAd2wC4nA87cKrxhbToBrveoovFscKsOQCImtIAvchEiLG/x05nrjre+r\nDsqRr1il8kM6Z6pHV2nZqyNKtykdPhQW90cCaISDbs92toFz0ofE1pEanxk9\niu8jzFSCakGUjAB/6XGnKypT0qL1U8m9YdcL9pw8b8LOiP5cA6dSuqBiFv6L\n+O0p+CNbeHgYAn02w/dFIaAVYnmjRn4/ThS24VmBJfPmRYoAq1s12MkTPRZ7\nC2SFdBsftzqFKb3ISYRuKvaGB7WfVBDzXZ7Lin4aAN/EVfafZhsRNJ0Y4+jb\nFB1ZWVgCOQ8sLsPTVVftA5hdhJLwPJD8P133YEueOAVInn9j0Yg97KF+ysQJ\nuItD\r\n=xsLT\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDIhkZgZTkufz7x/u36dumXJwyZORIne5/TlolinGg5bQIgMmTfV4fT9by97Rg5Wgk0rmsElTOeREospZKHg7j0egQ="}]},"_npmUser":{"name":"hyphe","email":"accounts@bojagi.io"},"directories":{},"maintainers":[{"name":"hyphe","email":"accounts@bojagi.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/dom-to-image-more_2.8.7_1613049589546_0.48190008029780906"},"_hasShrinkwrap":false}},"time":{"created":"2021-02-08T17:13:34.526Z","2.8.5":"2021-02-08T17:13:35.008Z","modified":"2022-04-04T19:59:19.460Z","2.8.6":"2021-02-11T13:17:35.175Z","2.8.7":"2021-02-11T13:19:49.835Z"},"maintainers":[{"name":"hyphe","email":"accounts@bojagi.io"}],"description":"Generates an image from a DOM node using HTML5 canvas and SVG","homepage":"https://github.com/bojagi/dom-to-image-more#readme","keywords":["dom","image","raster","render","html","canvas","svg"],"repository":{"type":"git","url":"git+https://github.com/1904labs/dom-to-image-more.git"},"contributors":[{"name":"Marc Brooks","email":"idisposable@gmail.com"},{"name":"Anatolii Saienko","email":"anatoly.sayenko@gmail.com"},{"name":"Marc Brooks","email":"idisposable@gmail.com"},{"name":"Daniel Fischer","email":"daniel.fischer@iqdoq.de"},{"name":"Aidas Klimas"},{"name":"Edgardo Di Gesto"},{"name":"樊冬 Fan Dong","email":"CG-man@outlook.com"}],"bugs":{"url":"https://github.com/bojagi/dom-to-image-more/issues"},"license":"MIT","readme":"# DOM to Image\n## What is it\n\n**dom-to-image-more** is a library which can turn arbitrary DOM node into\na vector (SVG) or raster (PNG or JPEG) image, written in JavaScript.\n\nThis fork of a fork (yay!) of https://github.com/1904labs/dom-to-image-more and [dom-to-image by Anatolii Saienko (tsayen)](https://github.com/tsayen/dom-to-image)\nwith some important fixes merged. \n\nAnatolii's version was based on [domvas by Paul Bakaus](https://github.com/pbakaus/domvas)\nand has been completely rewritten, with some bugs fixed and some new\nfeatures (like web font and image support) added.\n\nForked again due to inactivity.\n\nMoved to [1904labs organization](https://github.com/1904labs/) from my repositories 2019-02-06 as of version 2.7.3\n\n## Installation\n\n### NPM\n\n`npm install dom-to-image-more`\n\nThen load\n\n```javascript\n/* in ES 6 */\nimport domtoimage from 'dom-to-image-more';\n/* in ES 5 */\nvar domtoimage = require('dom-to-image-more');\n```\n\n### Bower\n\n`bower install dom-to-image-more`\n\nInclude either `src/dom-to-image-more.js` or `dist/dom-to-image-more.min.js` in your page\nand it will make the `domtoimage` variable available in the global scope.\n\n```html\n<script src=\"path/to/dom-to-image-more.min.js\" />\n<script>\n  domtoimage.toPng(node)\n  //...\n</script>\n```\n\n## Usage\n\nAll the top level functions accept DOM node and rendering options,\nand return promises, which are fulfilled with corresponding data URLs.  \nGet a PNG image base64-encoded data URL and display right away:\n\n```javascript\nvar node = document.getElementById('my-node');\n\ndomtoimage.toPng(node)\n    .then(function (dataUrl) {\n        var img = new Image();\n        img.src = dataUrl;\n        document.body.appendChild(img);\n    })\n    .catch(function (error) {\n        console.error('oops, something went wrong!', error);\n    });\n```\n\nGet a PNG image blob and download it (using [FileSaver](https://github.com/eligrey/FileSaver.js/),\nfor example):\n\n```javascript\ndomtoimage.toBlob(document.getElementById('my-node'))\n    .then(function (blob) {\n        window.saveAs(blob, 'my-node.png');\n    });\n```\n\nSave and download a compressed JPEG image:\n\n```javascript\ndomtoimage.toJpeg(document.getElementById('my-node'), { quality: 0.95 })\n    .then(function (dataUrl) {\n        var link = document.createElement('a');\n        link.download = 'my-image-name.jpeg';\n        link.href = dataUrl;\n        link.click();\n    });\n```\n\nGet an SVG data URL, but filter out all the `<i>` elements:\n\n```javascript\nfunction filter (node) {\n    return (node.tagName !== 'i');\n}\n\ndomtoimage.toSvg(document.getElementById('my-node'), {filter: filter})\n    .then(function (dataUrl) {\n        /* do something */\n    });\n```\n\nGet the raw pixel data as a [Uint8Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array)\nwith every 4 array elements representing the RGBA data of a pixel:\n\n```javascript\nvar node = document.getElementById('my-node');\n\ndomtoimage.toPixelData(node)\n    .then(function (pixels) {\n        for (var y = 0; y < node.scrollHeight; ++y) {\n          for (var x = 0; x < node.scrollWidth; ++x) {\n            pixelAtXYOffset = (4 * y * node.scrollHeight) + (4 * x);\n            /* pixelAtXY is a Uint8Array[4] containing RGBA values of the pixel at (x, y) in the range 0..255 */\n            pixelAtXY = pixels.slice(pixelAtXYOffset, pixelAtXYOffset + 4);\n          }\n        }\n    });\n```\n\nGet a canvas object:\n\n```javascript\ndomtoimage.toCanvas(document.getElementById('my-node'))\n    .then(function (canvas) {\n        console.log('canvas', canvas.width, canvas.height);\n    });\n```\n\n* * *\n\n_All the functions under `impl` are not public API and are exposed only\nfor unit testing._\n\n* * *\n\n### Rendering options\n\n#### filter\n\nA function taking DOM node as argument. Should return true if passed node\nshould be included in the output (excluding node means excluding it's\nchildren as well). Not called on the root node.\n\n#### bgcolor\n\nA string value for the background color, any valid CSS color value.\n\n#### height, width\n\nHeight and width in pixels to be applied to node before rendering.\n\n#### style\n\nAn object whose properties to be copied to node's style before rendering.\nYou might want to check [this reference](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Properties_Reference)\nfor JavaScript names of CSS properties.\n\n#### quality\n\nA number between 0 and 1 indicating image quality (e.g. 0.92 => 92%) of the\nJPEG image. Defaults to 1.0 (100%)\n\n#### cacheBust\n\nSet to true to append the current time as a query string to URL requests to enable cache busting. Defaults to false\n\n#### imagePlaceholder\n\nA data URL for a placeholder image that will be used when fetching an image fails. Defaults to undefined and will throw an error on failed images\n\n## Browsers\n\nIt's tested on latest Chrome and Firefox (49 and 45 respectively at the time\nof writing), with Chrome performing  significantly better on big DOM trees,\npossibly due to it's more performant SVG support, and the fact that it supports\n `CSSStyleDeclaration.cssText` property.  \n\n_Internet Explorer is not (and will not be) supported, as it does not support\nSVG `<foreignObject>` tag_  \n\n_Safari [is not supported](https://github.com/tsayen/dom-to-image/issues/27), as it uses a stricter security model on `<foreignObject`> tag. Suggested workaround is to use `toSvg` and render on the server._`\n\n## Dependencies\n\n### Source\n\nOnly standard lib is currently used, but make sure your browser supports:  \n\n- [Promise](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Promise)  \n- SVG `<foreignObject>` tag\n\n### Tests\n\nMost importantly, tests depend on:\n\n- [js-imagediff](https://github.com/HumbleSoftware/js-imagediff),\n    to compare rendered and control images\n\n- [ocrad.js](https://github.com/antimatter15/ocrad.js), for the\n    parts when you can't compare images (due to the browser\n    rendering differences) and just have to test whether the text is rendered\n\n## How it works\n\nThere might some day exist (or maybe already exists?) a simple and standard\nway of exporting parts of the HTML to image (and then this script can only\nserve as an evidence of all the hoops I had to jump through in order to get\nsuch obvious thing done) but I haven't found one so far.  \n\nThis library uses a feature of SVG that allows having arbitrary HTML content\ninside of the `<foreignObject>` tag. So, in order to render that DOM node\nfor you, following steps are taken:  \n\n1. Clone the original DOM node recursively\n\n1. Compute the style for the node and each sub-node and copy it to\n   corresponding clone\n\n    - and don't forget to recreate pseudo-elements, as they are not\n      cloned in any way, of course\n\n1. Embed web fonts\n\n    - find all the `@font-face` declarations that might represent web fonts\n\n    - parse file URLs, download corresponding files\n\n    - base64-encode and inline content as `data:` URLs\n\n    - concatenate all the processed CSS rules and put them into one `<style>`\n        element, then attach it to the clone\n\n1. Embed images\n\n    - embed image URLs in `<img>` elements\n\n    - inline images used in `background` CSS property, in a fashion similar to\n      fonts\n\n1. Serialize the cloned node to XML\n\n1. Wrap XML into the `<foreignObject>` tag, then into the SVG, then make it a\n   data URL\n\n1. Optionally, to get PNG content or raw pixel data as a Uint8Array, create an\n   Image element with the SVG as a source, and render it on an off-screen\n   canvas, that you have also created, then read the content from the canvas\n\n1. Done!  \n\n## Things to watch out for\n\n- if the DOM node you want to render includes a `<canvas>` element with\n    something drawn on it, it should be handled fine, unless the canvas is\n    [tainted](https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image) -\n    in this case rendering will rather not succeed.  \n\n- at the time of writing, Firefox has a problem with some external stylesheets\n    (see issue #13). In such case, the error will be caught and logged.  \n\n## Authors\n\nMarc Brooks, Anatolii Saienko (original dom-to-image), Paul Bakaus (original idea),\nAidas Klimas (fixes), Edgardo Di Gesto (fixes), 樊冬 Fan Dong (fixes)\n\n## License\n\nMIT\n","readmeFilename":"README.md"}