Hi,
I am using Aspose.pdf 11.8.
I have a table with two columns and multiple rows. In first cell I am inserting image and in second cell some text. In some cases image is getting squished when there is no room for it instead of moving to next page. How can I fix
this.
Here is sample code.
Table table = new Table();
table.setColumnWidths(“3% 97%”);
for(int i=0;i
Row row = table.getRows().add();
row.setRowBroken(true);
Cell cell = row.getCells().add();
cell.setMargin(new MarginInfo(-25,15,0,10));
cell.setVerticalAlignment(VerticalAlignment.Top);
Image logoimg = new Image();
logoimg.setImageStream(new FileInputStream(“d:/pdf/weight.png”));
logoimg.setFixHeight(37.44);
logoimg.setFixWidth(37.44);
cell.setAlignment(HorizontalAlignment.Right);
cell.setVerticalAlignment(VerticalAlignment.Top);
cell.getParagraphs().add(logoimg);
cell = row.getCells().add();
cell.setMargin(new MarginInfo(0,0,0,10));
cell.setAlignment(HorizontalAlignment.Left);
cell.setVerticalAlignment(VerticalAlignment.Top);
TextFragment fgmt = new TextFragment(“Weight”);
fgmt.setMargin(new MarginInfo(0,10,0,15));
fgmt.getTextState().setFontStyle(FontStyles.Bold);
fgmt.getTextState().setFontSize(12.5f);
fgmt.getTextState().setFont(FontRepository.findFont(“Palatino Linotype”));
cell.getParagraphs().add(fgmt);
HtmlFragment fgmt1 = new HtmlFragment(“
Testing hksjkjyskds khkjhk kjhkjhjhhh kjhkjhkhkhk dkhfjkdhfjhdfhd Testing hksjkjyskds khkjhk kjhkjhjhhh kjhkjhkhkhk kjhkjhjhhh kjhkjhkhkhk dkhfjkdhfjhdfhd fdfdfdfdf dfdfdfdfdf dfdfdfdfdf
cell.getParagraphs().add(fgmt1);
}
page.getParagraphs().add(table);
I have included pdf also. If you notice image is squished on page 2.
Thanks
Mamatha