Table in pdf

DynamicPDF Generator for Java (v3 and older) Forum

 Jan 03 2014 5:15 AM
Hi ,
i am ravi. now am developing android application and i'm using ur source for generate pdf. it was very useful. now i need to insert or draw table in pdf. that means i want to show my result in table in pdf.so kindly help me to create table inside pdf asap.
 Jan 03 2014 9:18 AM
Posted by a ceTe Software moderator
Hello Ravi,

Yes, you can add table to PDF without any problem using our version 3 DynamicPDF Generator for Java product. You will need to use the Table page element to do this. You can add columns and rows to the table as per your business needs. Please refer to the documentation on Table page element here.  Below is sample code for adding table to PDF using Table page element.

        Document document=new Document();
        Page page=new Page();
        Table table=new Table(0,0,200,400);
        Column column1=table.getColumns().add(100);
        Column column2=table.getColumns().add(100);

        Row row=table.getRows().add();
        Cell cell=row.getCellList().add("Text1");
        Cell cell1=row.getCellList().add("Text2");

        page.getElements().add(table);
        document.getPages().add(page);
        document.draw("C:/Temp/MyDocument.pdf");

Thanks,
ceTe Software Support Team.

All times are US Eastern Standard time. The time now is 1:29 PM.