Example: The following example will display TextWatermark 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();
// Set PDF version to 1.6
document.setPdfVersion(PdfVersion.v1_6);
// Create a Page and add it to the document
Page page = new Page();
document.getPages().add(page);
// Create the string and Text Watermark
String text = "This is a text watermark.";
TextWatermark textwm = new TextWatermark(text);
// Add the TextWatermark to the page
page.getElements().add(textwm);
// Save the PDF
document.draw("[physicalpath]/MyDocument.pdf" );
}
}