List of usage examples for com.itextpdf.text TabSettings TabSettings
public TabSettings(float tabInterval)
From source file:kafe.BayarSemuaFrame.java
private static void addContent(Document document, String id_pesanan, String bayar, String kembali) throws DocumentException { Paragraph preface = new Paragraph(); preface.add(new Paragraph("============================================================================\n", smallBold));/* www . ja v a2 s.c o m*/ addEmptyLine(preface, 1); preface.setTabSettings(new TabSettings(250f)); preface.add(Chunk.TABBING); preface.add(new Chunk("---------SEDAP MALAM---------", catFont)); addEmptyLine(preface, 1); preface.setTabSettings(new TabSettings(150f)); preface.add(Chunk.TABBING); preface.add(new Chunk("__________Jalan Informatika No.8__________", smallBold)); addEmptyLine(preface, 1); preface.add(new Paragraph("============================================================================\n", smallBold)); addEmptyLine(preface, 1); try { Class.forName(driver); Connection connection = DriverManager.getConnection(url, user, pass); Statement statement = connection.createStatement(); String sql = "select a.id_pesanan,d.nama_meja,b.waktu,c.nama_makanan,c.harga_makanan,a.jumlah_makanan,a.status from isi_pesanan a, pesanan b, makanan c, meja d where b.id_pesanan='" + id_pesanan + "' and a.id_pesanan=b.id_pesanan and a.id_makanan=c.id_makanan and b.meja=d.id_meja"; ResultSet rs = statement.executeQuery(sql); int i = 0; int harga_tot = 0; while (rs.next()) { int id = rs.getInt(1); String nama_meja = rs.getString(2); String firstName = rs.getString(3); String surname = rs.getString(4); if (i == 0) { preface.add(new Chunk("ID Pesanan: " + rs.getInt(1) + "\n", normalFont)); preface.add(new Chunk("Meja: " + rs.getString(2) + "\n", normalFont)); preface.add(new Chunk("Waktu Pesanan: " + rs.getString(3), normalFont)); addEmptyLine(preface, 1); preface.add(new Paragraph( "---------------------------------------------------------------------------------------------------------------------------------\n", smallBold)); addEmptyLine(preface, 1); preface.add(new Paragraph("Rincian Pesananan:", smallBold)); addEmptyLine(preface, 1); } preface.add(new Paragraph( rs.getString(4) + " @ " + rs.getString(6) + " = Rp. " + rs.getString(5) + "\n", normalFont)); harga_tot += Integer.parseInt(rs.getString(5)) * Integer.parseInt(rs.getString(6)); i++; } addEmptyLine(preface, 1); preface.add(new Paragraph( "---------------------------------------------------------------------------------------------------------------------------------\n", smallBold)); addEmptyLine(preface, 1); preface.add(new Paragraph("Harga Total: Rp. " + harga_tot, smallBold)); addEmptyLine(preface, 1); preface.add(new Paragraph("Bayar: Rp. " + bayar, normalFont)); addEmptyLine(preface, 1); preface.add(new Paragraph("Kembali: Rp. " + kembali, smallBold)); addEmptyLine(preface, 3); preface.add(new Paragraph("============================== TERIMA KASIH ==============================", smallBold)); rs.close(); statement.close(); connection.close(); } catch (Exception DBException) { } document.add(preface); document.newPage(); }