and I use the hashtable as source for the following. adding images to table cells
Table table2 = new Table(sec1);
//Add the table in paragraphs collection of the desired section
sec1.getParagraphs().add(table2);
//Set with column widths of the table
table2.setColumnWidths(“72 72 72 72 72”);
table2.getDefaultCellTextInfo().setAlignment(AlignmentType.Center);
//Set default cell border using BorderInfo object
table2.setDefaultCellBorder(new BorderInfo(BorderSide.All.getValue(), 0.1F));
//Set table border using another customized BorderInfo object
table2.setBorder(new BorderInfo(BorderSide.All.getValue(), 0.5F));
//Create MarginInfo object and set its left, bottom, right and top margins
MarginInfo margin2 = new MarginInfo();
margin2.Left = 0.5f;
margin2.Right = 0.5f;
margin2.Top = 0.5f;
margin2.Bottom = 0.5f;
//Set the default cell padding to the MarginInfo object
table2.setDefaultCellPadding(margin2);
int imageAddedCount = 0;
String uniqueProducts = “”;
row = table2.getRows().add();
for(int j = 0; j< schedList.size(); j++)
{
sched = (Schedule) schedList.get(j);
if(sched.getGenerationProduct() != null && uniqueProducts.indexOf(sched.getGenerationProduct()) < 0)
{
aspose.pdf.Image img = new aspose.pdf.Image();
String imagePath = imgH.get(sched.getGenerationProduct());
if(imagePath.substring(imagePath.indexOf(".") + 1 , imagePath.length()).compareToIgnoreCase(“jpg”) ==0 )
{
// Specify the Image file type as JPEG
img.getImageInfo().setImageFileType(ImageFileType.Jpeg);
}
else if(imagePath.substring(imagePath.indexOf(".") + 1, imagePath.length()).compareToIgnoreCase(“PNG”) == 0)
{
img.getImageInfo().setImageFileType(ImageFileType.Png);
}
//Set the path of image file
img.getImageInfo().setFile(imagePath);
row.getCells().add(sched.getGenerationProduct() + “\n” + img);
uniqueProducts = uniqueProducts + sched.getGenerationProduct();
imageAddedCount++;
}
if(sched.getDispersionProduct() != null && uniqueProducts.indexOf(sched.getDispersionProduct()) < 0)
{
aspose.pdf.Image img1 = new aspose.pdf.Image();
String imagePath = imgH.get(sched.getDispersionProduct());
if(imagePath.substring(imagePath.indexOf(".") + 1 , imagePath.length()).compareToIgnoreCase(“jpg”) ==0 )
{
// Specify the Image file type as JPEG
img1.getImageInfo().setImageFileType(ImageFileType.Jpeg);
}
else if(imagePath.substring(imagePath.indexOf(".") + 1, imagePath.length()).compareToIgnoreCase(“PNG”) == 0)
{
img1.getImageInfo().setImageFileType(ImageFileType.Png);
}
//Set the path of image file
img1.getImageInfo().setFile(imagePath);
row.getCells().add(sched.getDispersionProduct() + “\n” + img1);
uniqueProducts = uniqueProducts + sched.getDispersionProduct();
imageAddedCount++;
}
if(imageAddedCount % 5 == 0)
{
row = table2.getRows().add();
}
}