On 23/08/2013 12:59, Harsha Kaundinya wrote:
Ok.
By the way. You can also choose to nest the table in a different way.See attachment. The result looks identical to the output of the example that doesn't use nested tables.
package examples.tables;
import java.io.FileOutputStream;
import java.io.IOException;
import com.itextpdf.text.Document;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.Image;
import com.itextpdf.text.pdf.PdfPCell;
import com.itextpdf.text.pdf.PdfPTable;
import com.itextpdf.text.pdf.PdfWriter;
public class TableImage2 {
public static void main(String[] args) throws IOException,
DocumentException {
// step 1
Document document = new Document();
// step 2
PdfWriter writer = PdfWriter.getInstance(document, new
FileOutputStream("image_table2.pdf"));
writer.setFullCompression();
// step 3
document.open();
// step 4
Image img = Image.getInstance("smiley.png");
img.scalePercent(200);
PdfPTable table = new PdfPTable(1);
PdfPCell cell;
PdfPTable inner;
for (int i = 0; i < 20; i++) {
cell = new PdfPCell();
cell.addElement(img);
inner = new PdfPTable(1);
inner.addCell(cell);
table.addCell(new PdfPCell(inner));
}
document.add(table);
// step 5
document.close();
}
}
image_table2.pdf
Description: Adobe PDF document
------------------------------------------------------------------------------ Introducing Performance Central, a new site from SourceForge and AppDynamics. Performance Central is your source for news, insights, analysis and resources for efficient Application Performance Management. Visit us today! http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions iText(R) is a registered trademark of 1T3XT BVBA. Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php
