I am trying to look for a way to generate PDF for a very large complex HTML page(almost 500 PDF pages) that was created using angular 13 view but I am not able to find any proper solution. I tried many Java based Libraries like Openhtmltopdf, Ironpdf, pdfbox, flyingsaucer but as it was a complex page even after cleaning, parsing and trying to fix HTML with the help of JSOUP I was getting exceptions in all, I also tried rendering PDF from HTML from them but same issue.
I also tried to capture an image/screenshot from backend and then convert it to PDF but that also didn't work as instead of the page it captures something else only, I tried this with html2image ava java library but similar issue. I looked into a way to do that using selenium or headless browser but I want it to work on linux cli as this app will be deployed there so without any GUI browser it won't work there as well.
Only thing that worked was html2canvas and jspdf but that also generated blurry pics with high size even after I tried compressing it and maintaining quality. Also it only worked for small HTML pages and failed drastically for medium to large HTML pages.
FYI I am using Angular 13 in front end and Groovy/Java/Grails in backend.
Is there anyway I can achieve what I want to achieve by using a free Java library?
Your help is highly appreciated!