[英]Printing Div to PNG with html2canvas with background images
I am using html2canvas plugin to print a div to png format. 我正在使用html2canvas插件将div打印为png格式。 Till now, I can print div to png but background images are missing.
到目前为止,我可以将div打印为png,但是缺少背景图像。
My html2canvas jquery code is 我的html2canvas jQuery代码是
html2canvas($(".comp-card-wrapper"), {
onrendered: function (canvas) {
// canvas is the final rendered <canvas> element
var myImage = canvas.toDataURL("image/png");
window.open(myImage);
}
});
Full code is on JsFiddle at http://jsfiddle.net/j2mpetdz/1/ Please if anyone have any idea, what I am missing, it would be a great help. 完整的代码在http://jsfiddle.net/j2mpetdz/1/上的JsFiddle上。如果有人有任何想法,我想念的是什么,那将是很大的帮助。
This appears to be a known bug that will be fixed in html2canvas version 0.5.0. 这似乎是一个已知的错误 ,将在html2canvas版本0.5.0中修复。 However that version is still not available for use.
但是,该版本仍不可用。
Have a look at this answer for a possible work-around (which seems compatible with future version 0.5.0RC). 请查看此答案以获取可能的解决方法(似乎与将来的0.5.0RC版本兼容)。
Hope this helps! 希望这可以帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.