import java.awt.Color;
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();
float[] widths = { 1, 4 };
PdfPTable table = new PdfPTable(widths);
table.setWidthPercentage(30);
PdfPCell cell = new PdfPCell(new Paragraph("fox"));
cell.setBackgroundColor(Color.YELLOW);
table.addCell(cell);
table.addCell("asdf");
document.add(table);
document.close();
}
}