import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Iterator;
import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.Paragraph;
import com.lowagie.text.pdf.PdfContentByte;
import com.lowagie.text.pdf.PdfPRow;
import com.lowagie.text.pdf.PdfPTable;
import com.lowagie.text.pdf.PdfWriter;
public class MainClass {
public static void main(String[] args) throws Exception {
Document document = new Document();
PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("2.pdf"));
document.open();
PdfContentByte cb = writer.getDirectContent();
PdfPTable table = new PdfPTable(2);
float[] rows = { 50f, 250f };
table.setTotalWidth(rows);
for (int k = 0; k < 200; ++k) {
table.addCell("row " + k);
table.addCell("blah " + k);
}
document.add(new Paragraph("row 0 - 50"));
table.writeSelectedRows(0, 50, 150, 820, cb);
document.close();
}
}
|