Example: The following example shows a paragraph of HTML 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 HTML style
HtmlTextAreaStyle style = new HtmlTextAreaStyle(FontFamily.getHelvetica(), 12, false);
// Create the text and the HTML text area
String htmlText = "<p>HTML 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>";
HtmlTextArea htmlTextArea = new HtmlTextArea(htmlText, 0, 0, 256, 400, style);
// Add the HTML text area to the page
page.getElements().add(htmlTextArea);
// Save the PDF
document.draw("[PhysicalPath]/MyDocument.pdf");
}
}