java - How to show two PDFTables next to each other in iText -


i need in showing 2 pdftables next each other in itext. first table above second table need keep them next each other short space. here code:

//first table dfptable table = new pdfptable(2); font earningstitlefont = new font(font.times_roman,12, font.bold); pdfpcell c1 = new pdfpcell(new phrase("earnings description",earningstitlefont)); table.addcell(c1); c1 = new pdfpcell(new phrase("earnings amount",earningstitlefont)); table.addcell(c1);  (int = 0; < listearnings.size(); i++) {     string temp1 = listearnings.get(i).getearningsdescriptionss();     string temp2 = listearnings.get(i).getearningsamountss();      table.addcell(temp1);      table.addcell(temp2); }  //second table dfptable tabledeductions = new pdfptable(2); font fonttitledeductions = new font(font.times_roman,12, font.bold); pdfpcell c2= new pdfpcell(new phrase("deductions description",fonttitledeductions )); tabledeductions.addcell(c2); c2 = new pdfpcell(new phrase("deductions amount",fonttitledeductions)); tabledeductions.addcell(c2);  (int = 0; < listdeductionss.size(); i++) {     string temp3 = listdeductions.get(i).getdeductionssdescriptionss();     string temp4 = listdeductions.get(i).getdeductionssamountss();      tabledeductions.addcell(temp3);      tabledeductions.addcell(temp4); } doc.add(table); doc.add(chunk.newline); doc.add(tabledeductions); 

(side side tables) i'm not sure check it.

   // main table     pdfptable maintable = new pdfptable(2);     maintable.setwidthpercentage(100.0f);     // first table     pdfpcell firsttablecell = new pdfpcell();     firsttablecell.setborder(pdfpcell.no_border);     pdfptable firsttable = new pdfptable(2);     ......... add cells here ...........     firsttablecell.addelement(firsttable);     maintable.addcell(firsttablecell);     // second table     pdfpcell secondtablecell = new pdfpcell();     secondtablecell.setborder(pdfpcell.no_border);     pdfptable secondtable = new pdfptable(2);     ......... add cells here ...........     secondtablecell.addelement(secondtable);     maintable.addcell(secondtablecell);     paragraph.add(maintable);     document.add(paragraph); 

Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

php - How do you embed a video into a custom theme on WordPress? -