Example: The following example shows how to create an Button and Add it to the page.
import com.cete.dynamicpdf.*; import com.cete.dynamicpdf.pageelements.forms.*; 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 Button Button button = new Button( "btn", 50, 50, 100, 50 ); button.setAction( new JavaScriptAction( "app.alert('Hello');" ) ); button.setBackgroundColor(RgbColor.getAliceBlue()); button.setBehavior(Behavior.createPush( "downLabel", "rolloverLabel" )); button.setBorderColor( RgbColor.getBlueViolet() ); button.setBorderStyle( BorderStyle.BEVELED ); button.setLabel( "Push" ); button.setTextColor( RgbColor.getDarkGreen() ); button.setToolTip( "Click" ); // Add the Button to the page page.getElements().add( button ); // Add pages to the document document.getPages().add( page ); // Save the PDF document document.draw("[PhysicalPath]/MyDocument.pdf"); } }