Hi all,
I have recently started using Flyingsaucer with Thymeleaf.
I have troubles adding Raleway font with something like:
try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) {
ITextRenderer renderer = new ITextRenderer();
renderer.getFontResolver().addFont("fonts/Raleway-Regular.ttf", BaseFont.IDENTITY_H, true);
renderer.setDocumentFromString(htmlContent);
renderer.layout();
renderer.createPDF(outputStream, true);
return outputStream.toByteArray();
} catch (DocumentException e) {
throw new RuntimeException(e);
}
Locally it seems it works, but once I build docker image I get error:
com.lowagie.text.ExceptionConverter: Index 4100 out of bounds for length 1068
I figured it might be that Maven is messing around with ttf, and I tried adding:
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<encoding>UTF-8</encoding>
<nonFilteredFileExtensions>
<nonFilteredFileExtension>ttf</nonFilteredFileExtension>
</nonFilteredFileExtensions>
</configuration>
</plugin>
but this does not help.
I am using flying-saucer-pdf:9.11.4
Does anyone have any idea what could be the cause?
Thanks,
Aleksandar