New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
html2canvas can not display Svg and Path tags of jsPlumb plugin #1179
Comments
Hi @salehmosleh , I wrote a post about this problem in my blog: http://eatandcode.es/2017/08/12/Soluciones-a-la-captura-de-svg-con-html2canvas/ |
Pls review #95, similar issue. include extrenal library: combine @gifarangw, @steren and @remiremi solution, my solutin as below: function take_second(targetElem){
// First render all SVGs to canvases
var elements = targetElem.find('svg').map(function() {
var svg = $(this);
var canvas = $('<canvas></canvas>').css({position: 'absolute', left:svg.css('left'), top: svg.css('top')});
svg.replaceWith(canvas);
// Get the raw SVG string and curate it
var content = svg.wrap('<p></p>').parent().html();
svg.unwrap();
canvg(canvas[0], content);
return {
svg: svg,
canvas: canvas
};
});
// At this point the container has no SVG, it only has HTML and Canvases.
html2canvas(targetElem[0], {
onrendered: function(canvas) {
// Put the SVGs back in place
elements.each(function() {
this.canvas.replaceWith(this.svg);
});
$("#previewImage").append(canvas);
}
});
} |
This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further. |
Here is that article in English language, thanks to google translator. |
Thank you very much, I have already solved it. After reading your blog, I found the problem that svg has absolute positioning. Thanks again!
I hope I can help others, thank you again. @mhlm71 |
here is real image :
and here is html2canvas capture :
here is html codes of Svg and Path tags that html2canvas can not display it :
The text was updated successfully, but these errors were encountered: