Hey there,
I am having some problems with printing elements that have position set to absolute. I am using Chrome.
Is this intended?
Thanks,
I have the same issue. My element has position: absolute and left position set to be off the screen, as it's a temporary element that would be used only for capturing into an image using this lib. However, the image rendered never includes my element, just empty pixels.
I am using a similar implementation, with the temporary off-screen element to render the nodes I want to capture. Using this configuration, I can call domtoimage.toPng() on nodes that are dynamically appended to the #viz-container element and everything works as expected.
<!-- css
#viz-containment{
position:relative;
overflow:hidden;
height:0;
width:0;
}
#viz-container{
width:100vw;
position:absolute;
left:-10000vw;
}
-->
<!-- body -->
<div id="viz-containment">
<div id="viz-container"></div>
</div>
<!-- /body -->
Had the same issue as @tafs7 , my solution was to simply set the z-index below the rest of my content. Opacity 0 seemed to work as well as this library doesn't take it into account.
css
#nodeToTransform {
height: 0px;
z-index: -99;
}
solved my issues to generate the image from an element outside of view.
Most helpful comment
I am using a similar implementation, with the temporary off-screen element to render the nodes I want to capture. Using this configuration, I can call
domtoimage.toPng()on nodes that are dynamically appended to the#viz-containerelement and everything works as expected.