I have encountered an issue with my HTML code where I have two spans aligned left and right, which displays correctly in the browser. However, when I convert it to PDF using iText7, the left-aligned text disappears and is replaced by the right-aligned text (refer to image 1 for HTML view and image 2 for PDF view).
image 1 (HTML):
https://i.sstatic.net/T4RuO.png
image 2 (PDF):
https://i.sstatic.net/V9jLV.png
This is the HTML code snippet causing the issue:
<li id="row1">
<span class="left bold">left-aligned text</span>
<span class="right bold">right-aligned text</span>
</li>
CSS:
#row1 {
position:relative;
max-width: 6.8in;
}
.left {
position: absolute;
}
.right {
position: absolute;
right: 0;
}
It seems like iText7 has issues interpreting CSS properly, so I am looking for a solution either within CSS or a workaround to ensure that the alignment renders correctly in the PDF.