import java.io.FileOutputStream;
import com.lowagie.text.Document;
import com.lowagie.text.Paragraph;
import com.lowagie.text.Phrase;
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.setWidthPercentage(100);
PdfPCell cell = new PdfPCell(new Paragraph(
"Quick brown fox jumps over the lazy dog. Quick brown fox jumps over the lazy dog."));
table.addCell("different padding for left, right, top and bottom");
cell.setPaddingLeft(20);
cell.setPaddingRight(50);
cell.setPaddingTop(0);
cell.setPaddingBottom(5);
table.addCell(cell);
document.add(table);
document.close();
}
}
|