Get Text Format - RichTextArea

Hello. Is there any form to get the format of the text written in a RichTextArea?

For example, I want to get the font type, size, and so forth. I need those values to pass them to a PDF writer, so that the text of the PDF is in the same format than in the RichTextArea.

I am using iText and this is an example:

Paragraph paragraph = new Paragraph();

//The value of font should be the font of the text written in the RichTextArea
paragraph.add(new Chunk(text,font));
document.add(paragraph);

Thank you.

Hi,

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

https://code.google.com/archive/p/flying-saucer/

HTH
Sebastien