Example: The following example shows a paragraph of Formatted formatted text being displayed on the page
import com.cete.dynamicpdf.*; import com.cete.dynamicpdf.pageelements.*; public class MyClass{ public static void main(String args[]){ // Create a PDF Document Document document = new Document(); // Create a Page and add it to the document Page page = new Page(); document.getPages().add(page); // Create an Formatted style FormattedTextAreaStyle style = new FormattedTextAreaStyle(FontFamily.getHelvetica(), 12, false); // Create the text and the Formatted text area String formattedText = "<p>Formatted text area provide rich formatting support for text that " + "appears in the document. You have complete control over 8 paragraph properties: " + "spacing before, spacing after, first line indentation, left indentation, right " + "indentation, alignment, allowing orphan lines, and white space preservation; 6 " + "font properties: <font face='Times'>font face, </font><font " + "pointSize='6'>font size, </font><font color='FF0000'>color, " + "</font><b>bold, </b><i>italic and </i><u>" + "underline</u> and 2 line properties: leading, and leading type. Text can " + "also be rotated.</p>"; FormattedTextArea formattedTextArea = new FormattedTextArea(formattedText, 0, 0, 256, 400, style); // Add the Formatted text area to the page page.getElements().add(formattedTextArea); // Save the PDF document.draw("[PhysicalPath]/MyDocument.pdf"); } }