On 23/08/2013 12:59, Harsha Kaundinya wrote:
Ok.
In other words: avoid nested tables. You can always find an alternative to nesting.
The example in attachment doesn't have the problem you describe.
<<attachment: smiley.png>>
image_table.pdf
Description: Adobe PDF document
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 TableImage {
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_table.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;
for (int i = 0; i < 20; i++) {
cell = new PdfPCell();
cell.addElement(img);
table.addCell(cell);
}
document.add(table);
// step 5
document.close();
}
}
------------------------------------------------------------------------------ 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
