在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:cburgmer/rasterizeHTML.js开源软件地址:https://github.com/cburgmer/rasterizeHTML.js开源编程语言:JavaScript 92.2%开源软件介绍:rasterizeHTML.jsRenders HTML into the browser's canvas. See the API. Install
Then include a script tag with Examplevar canvas = document.getElementById("canvas");
rasterizeHTML.drawHTML('Some ' +
'<span style="color: green; font-size: 20px;">HTML</span>' +
' with an image <img src="someimg.png">',
canvas); See the examples page. The code also ships with examples, make sure to run How does it workFor security reasons rendering HTML into a canvas is severly limited. Firefox offers such a function via As described in http://robert.ocallahan.org/2011/11/drawing-dom-content-to-canvas.html and https://developer.mozilla.org/en/HTML/Canvas/Drawing_DOM_objects_into_a_canvas however it is possible by embedding the HTML into an SVG image as a In addition SVG is not allowed to link to external resources and so rasterizeHTML.js will load external images, fonts and stylesheets and store them inline via data: URIs (or inline style elements respectively). LimitationsAll resources (HTML page, CSS, images, fonts and JS) that are needed for drawing the page can only be loaded if from the same origin, unless techniques like CORS are used. I.E. The code is tested under Firefox, Chrome & Safari. There's basic support for Microsoft Edge, however it will not work under any version of Internet Explorer. Also the individual browsers still have some issues when rendering SVGs with embedded HTML to the canvas. The full list of limitations is here. TypeScriptImport type definitions as follows: import * as rasterizeHTML from 'rasterizehtml'; DevelopmentRun For tests against individual browsers run Where is it used?
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论