'html2canvas renders fixed element in wrong position
When I use html2canvas on a page with a fixed header, it renders the header near the bottom of the canvas rather than where it should be at the top. Is there a workaround for this so that it renders fixed elements in the correct position?
Solution 1:[1]
Without seeing your code, it is possible that you need to specify the vertical-align property of the header's children elements to be text-top.
Solution 2:[2]
Setting scrollX and scrollY to 0 sorted the issue.
html2canvas(document.body,{scrollX: 0, scrollY: 0})
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | bordeaux |
| Solution 2 | Luke Seall |
