Reputation: 722
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);
Upvotes: 0
Views: 167
Reputation: 801
To get format of the text written in RichTextArea you must to parse component value.
Value of the RichTextArea is html code, on example:
<font face="Arial" size="6">Additional Text</font>
But it is complicated, so to get pdf from html you can use iText HTMLWorker.
See the link: http://www.rgagnon.com/javadetails/java-html-to-pdf-using-itext.html
Upvotes: 1