I am using this - https://github.com/danfickle/openhtmltopdf to convert from html to pdf. (Which uses Apache PDFBox internally and that's where I guess the problem is).
Everything works well in development mode - I am using quarkus. When I run - mvn clean quarkus:dev and generate the pdf it display properly (with html table and all) as expected.
However when I build natively (mvn package -Pnative) and than generate pdf, it messes up all display. Everything is just one string and it fails to understand css too.
Hard part is, I don't see any errors so can't figure out what's going wrong.
Htmlto pdf code, its really basic -
PdfRendererBuilder builder = new PdfRendererBuilder();
builder.useFastMode();
builder.withHtmlContent(htmlContent, null);
builder.toStream(os);
builder.run();
Pass any string (Well formatted html) and you will see the difference between two different execution style.
Why is this happening?
Hard to tell without looking into the library code.
Quarkus does its best to integrate libraries and make them work with native mode, by adding the pieces required by native mode. For native mode limitations, please check this link: https://www.graalvm.org/reference-manual/native-image/Limitations/.
Some libraries may work out of the box without additional configuration. Other require additional configuration to comply with the native image rules.
I suspect that the library may be using some sort of reflection that is not registered in the native image. Maybe try to have a look into it first and register additional resources: https://quarkus.io/guides/writing-native-applications-tips