Example: The following example will display text on the page.
import com.cete.dynamicpdf.*;
import com.cete.dynamicpdf.pageelements.*;
import com.cete.dynamicpdf.text.*;
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);
//Assign some text to a string
String text = "To and WA are examples of when kerning would be used.";
// Create a textarea
TextArea textArea = new TextArea(text, 10, 10, 400, 700, Font.getTimesRoman());
// Must be enabled before kern values can be read
textArea.setKerningEnabled( true);
// Create a KerningValues
KerningValues kernValues = textArea.getKerningValues();
// Assign positive value for making the space between chars closer and negative value for making the space further
for (int i = 0; i < kernValues.getSpacing().length; i++) {
kernValues.getSpacing()[i]= (short)(kernValues.getSpacing()[i]- 400);
}
// Add the text area to the page
page.getElements().add( textArea );
// Save the PDF
document.draw("[PhysicalPath]/MyDocument.pdf" );
}
}