import java.io.FileOutputStream;
import java.io.IOException;
import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.Element;
import com.lowagie.text.Paragraph;
import com.lowagie.text.pdf.PdfPCell;
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.getInstance(document, new FileOutputStream("2.pdf"));
document.open();
PdfPTable table = new PdfPTable(2);
table.addCell("blah\nblah\nblah\nblah\nblah\nblah\nblah\nblah\nblah\n");
table.getDefaultCell().setVerticalAlignment(Element.ALIGN_BOTTOM);
table.addCell("bottom");
table.addCell("blah\nblah\nblah\nblah\nblah\nblah\nblah\nblah\nblah\n");
table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
table.addCell("middle");
table.addCell("blah\nblah\nblah\nblah\nblah\nblah\nblah\nblah\nblah\n");
table.getDefaultCell().setVerticalAlignment(Element.ALIGN_TOP);
table.addCell("top");
document.add(table);
document.close();
}
}
|