{"action":"created","issue":{"url":"https://api.github.com/repos/tsayen/dom-to-image/issues/36","repository_url":"https://api.github.com/repos/tsayen/dom-to-image","labels_url":"https://api.github.com/repos/tsayen/dom-to-image/issues/36/labels{/name}","comments_url":"https://api.github.com/repos/tsayen/dom-to-image/issues/36/comments","events_url":"https://api.github.com/repos/tsayen/dom-to-image/issues/36/events","html_url":"https://github.com/tsayen/dom-to-image/issues/36","id":153210765,"number":36,"title":"Printing node not currently attached to DOM","user":{"login":"rhmg","id":142207,"avatar_url":"https://avatars.githubusercontent.com/u/142207?v=3","gravatar_id":"","url":"https://api.github.com/users/rhmg","html_url":"https://github.com/rhmg","followers_url":"https://api.github.com/users/rhmg/followers","following_url":"https://api.github.com/users/rhmg/following{/other_user}","gists_url":"https://api.github.com/users/rhmg/gists{/gist_id}","starred_url":"https://api.github.com/users/rhmg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhmg/subscriptions","organizations_url":"https://api.github.com/users/rhmg/orgs","repos_url":"https://api.github.com/users/rhmg/repos","events_url":"https://api.github.com/users/rhmg/events{/privacy}","received_events_url":"https://api.github.com/users/rhmg/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-05-05T11:04:31Z","updated_at":"2016-06-30T15:43:58Z","closed_at":null,"body":"I have got your excellent module working when I am printing an element found by its Id (as per your documentation) however I have a requirement to print HTML provided to me by an external service.\r\n\r\nMy attempt currently looks like this:\r\n\r\n\r\n```\r\n    var fromHtml = function (html) {\r\n        var promise = $q(function(resolve, reject) {\r\n            var node = document.createElement('div');\r\n            node.innerHTML = html;\r\n\r\n            domtoimage.toPng(node)\r\n            .then(function (dataUrl) {\r\n                // Trim meta information\r\n                var trimmed = dataUrl.replace('data:image/png;base64,', '');\r\n                resolve(trimmed);\r\n            })\r\n            .catch(function (e) {\r\n                reject('Error converting HTML to canvas for printing: ' + e);\r\n            });\r\n        });\r\n\r\n        return promise;\r\n    };\r\n\r\n```\r\n\r\nThe behaviour I am seeing is... nothing happens; it doesn't even hit my \"catch\".\r\n\r\nI've had a look through the code and can't see anything obvious requiring the html passed into the .toPng(...) function be attached to the DOM however if I embed the HTML in my DOM and pass an Id as your docs it does work?\r\n\r\nHave you got any ideas on this? I cannot easily embed the HTML into the DOM for every case."},"comment":{"url":"https://api.github.com/repos/tsayen/dom-to-image/issues/comments/229699798","html_url":"https://github.com/tsayen/dom-to-image/issues/36#issuecomment-229699798","issue_url":"https://api.github.com/repos/tsayen/dom-to-image/issues/36","id":229699798,"user":{"login":"croll83","id":11348238,"avatar_url":"https://avatars.githubusercontent.com/u/11348238?v=3","gravatar_id":"","url":"https://api.github.com/users/croll83","html_url":"https://github.com/croll83","followers_url":"https://api.github.com/users/croll83/followers","following_url":"https://api.github.com/users/croll83/following{/other_user}","gists_url":"https://api.github.com/users/croll83/gists{/gist_id}","starred_url":"https://api.github.com/users/croll83/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/croll83/subscriptions","organizations_url":"https://api.github.com/users/croll83/orgs","repos_url":"https://api.github.com/users/croll83/repos","events_url":"https://api.github.com/users/croll83/events{/privacy}","received_events_url":"https://api.github.com/users/croll83/received_events","type":"User","site_admin":false},"created_at":"2016-06-30T15:43:58Z","updated_at":"2016-06-30T15:43:58Z","body":"Hi, I have the same problem.\r\n\r\nWhen I try to render a node not attached to any element of the tree I get a generic error in the catch clause. \r\n\r\nIf I try to attach the node on the DOM tree, but I set the visibility to 'hidden' the resulting image is empty. Is there a way to just render an html parsed code into a png image?\r\n\r\nThanks! Great job by the way!"}}
{"actor":{"display_login":"croll83"}}