To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.
It won't work this way: what about other html tags... ? You will need to parse you html-content. You can do that with your favorite xml parser to get the text and its attributes. Easier, you can use FlyingSaucer to generate PDf from Html source