Example: The following example will place a rectangle and several lines into a group object and then add that group to 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 a group Group group = new Group(); // Add page elements to the group group.add(new Rectangle( 0, 0, 200, 200, 3)); group.add(new Line( 0, 100, 100, 0, 3 )); group.add(new Line( 100, 0, 200, 100, 3)); group.add(new Line( 200, 100, 100, 200, 3)); group.add(new Line( 100, 200, 0, 100, 3)); // Add the group to the page page.getElements().add( group ); // Save the PDF document.draw("[PhysicalPath]/MyDocument.pdf"); } }