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);
PdfPCell cell;
Paragraph p = new Paragraph(".");
cell = new PdfPCell(p);
cell.setIndent(20);
table.addCell(cell);
table.addCell("extra indentation (paragraph)");
p.setFirstLineIndent(10);
cell = new PdfPCell();
cell.addElement(p);
table.addCell(cell);
document.add(table);
document.close();
}
}
|