Depends on your requirements to some extent. For a lot of use cases, asciidoctorpdf via asciidoctorJ works well.
Use a templating language of choice to generate the asciidoc and convert to PDF from there.
You could also look into PdfBox and Apache FOP.