com.cete.dynamicpdf.pageelements.forms
Class TextField



Example: The following example shows how to create an TextField and Add it to the page.

import com.cete.dynamicpdf.*;
import com.cete.dynamicpdf.pageelements.forms.TextField;
 
public class MyClass{
      public static void main(String args[]) {
        // Create a PDF Document
        Document document = new Document();
        
        // Create a PDF Page
        Page page = new Page( PageSize.LETTER );
        
        // Create an Text Field
        TextField textField = new TextField( "txt", 50, 75, 150, 100 );
        textField.setAlign( Align.CENTER );
        textField.setBackgroundColor( RgbColor.getAliceBlue() );
        textField.setBorderColor( RgbColor.getDeepPink() );
        textField.setFont( Font.getTimesItalic() );
        textField.setFontSize( 16.0f );
        textField.setTextColor( RgbColor.getBrown() );
        textField.setDefaultValue( "Hello World." );
        textField.setMultiLine( true );
        textField.setToolTip( "Text" );
        
        // Add the Text Field to the page
        page.getElements().add( textField );
        
        // Add pages to the document
        document.getPages().add( page );
        
        // Save the PDF document
        document.draw("[PhysicalPath]/MyDocument.pdf");
    }
 }