html2pdf.js
html2pdf.js copied to clipboard
PDF format broken with elements having position absolute
Hi there,
I am working form builder. It provides the facility of adding different HTML components anywhere in the given canvas. These HTML elements can be of any height/width and the user can decide it according to his need. In order to achieve this, I am using a library named "react-grid-layout". It perfectly serves my purpose. However, there is one important thing which this library does is that except the parent HTML element (which is at position relative) all children elements are at position absolute.
I am using "html2pdf" library to print the form made the library explained above. I am also using the "avoid-all" param of "html2pdf" library in order to break sections from the end of one page and move them to the next page. This param works as expected however due to the fact that children elements are at position absolute the sections get overlapped together at the start of the new page.
Any idea how can I fix this issue? PS: I am attaching a screenshot of the issue as well. In the screenshot please note the section "Valuation of Coverage" section was moved to the next page but it gets overlapped with the next section.

I ran into the same problem since a few days. I even tried margin-top and margin-left to offset the div elements but no effect.
Before it worked just fine. Maybe this has to do with a Chrome update or PDF-plugin update?
For me i am facing issue with position fixed elements. They are not at all getting rendered
Some news?
news about this problem?
I am having a similar issue, my elements have their position property set to "absolute" and the saved PDF is blank.
I am having a similar issue, my elements have their position property set to "absolute" and the saved PDF is blank.
i am having same issue did you find any slotion ?
For me i am facing issue with position fixed elements. They are not at all getting rendered
same here
same issue
same here, we can't use this library if it doesn't support absolute positions
Same problem encountered, but fixed with this CSS rules on parent div (because we need a position for parent div to print correctly) :
.parentDiv {
position: absolute;
}