Closed pkasson closed 2 years ago
This shows promise, and maybe I am not doing it right - but took the example in #67 and got an error:
Node.CloneNode() not a function -dom-to-image.js
It seems that it expects a single div and no children elements ? (https://stackoverflow.com/questions/60238179/node-clonenode-not-a-function-dom-to-image-js)
It seems that more than one element is selected.
How is the element (code) selected?
I opted to have the ability to download the image - but the code matches that on the example in the other issue.
function printFlow()
{
var node = document.getElementById('drawflow');
domtoimage.toBlob(node).then(function (blob)
{
window.saveAs(blob, 'drawflow.png');
// var img = new Image();
// img.src = dataUrl;
// document.body.appendChild(img);
})
.catch(function (error)
{
alert('Oops, something went wrong !');
});
It seems to be correct, unless you have more than one "drawflow" node.
Ask in the developer library. https://github.com/tsayen/dom-to-image
The domToImage will only print the items currently on viewable. If there are items hidden which you would have to scroll to, then it won't print them.
Is there a way today, or a plan to print out the flow to a file (jpeg, etc.) or printer ?