I’ve had good success generating PDFs from HTML with openhtmltopdf, a pure-Java PDF renderer with good support and is actively maintained (
https://github.com/danfickle/openhtmltopdf) . A lot of PDF renderers call to native libraries, link with a headless Chrome instance, or some other hacks that are much less portable
For generating excel files, CSV format is much simpler to generate. You shouldn’t even need any libraries, just write that string yourself