Hi,
I am not sure if I encountered a bug or I am just using this library in a wrong way.
This is the piece of css, that should take html code wrapped in <page></page> tags and turn them into A4 page.
page {
background: white;
width: 21cm;
height: 29.7cm;
display: block;
margin: 0 auto;
padding: 20px;
margin-bottom: 0.5cm;
box-shadow: 0 0 0.5cm rgba(0,0,0,0.5);
display: flex;
flex-direction: column;
}
When I open my html page in browser, it works just fine, but when I pass the same html into ITextRenderer, this particular part of css is completely ignored and whole document is scrambled. Is this part of code not enought and when I try to do this kind of formatting I need to use something else?
val fileOutputStream = FileOutputStream(pdfFilePath)
val renderer = ITextRenderer()
val lines = object {}.javaClass.getResourceAsStream("template.html")?.bufferedReader()?.readLines()
renderer.setDocumentFromString(lines?.joinToString("\n"))
renderer.layout()
renderer.createPDF(fileOutputStream, false)
renderer.finishPDF()
Thanks in advance for replies!