Example usage for com.itextpdf.text FontFactory TIMES_ROMAN

List of usage examples for com.itextpdf.text FontFactory TIMES_ROMAN

Introduction

In this page you can find the example usage for com.itextpdf.text FontFactory TIMES_ROMAN.

Prototype

String TIMES_ROMAN

To view the source code for com.itextpdf.text FontFactory TIMES_ROMAN.

Click Source Link

Document

This is a possible value of a base 14 type 1 font

Usage

From source file:pkgfinal.viewTable.java

private void jButton11ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton11ActionPerformed

    try {/*w w w  .j a v  a2 s  .c om*/

        Document document = new Document();

        PdfWriter.getInstance(document, new FileOutputStream(" " + jComboBox1.getSelectedItem() + ".pdf"));
        document.open();
        //   Image image =  Image.getInstance("save.png");
        //     document.add(new Paragraph("image"));
        //    document.add(image);
        document.add(new Paragraph("ECHO TRADERS",
                FontFactory.getFont(FontFactory.TIMES_ROMAN, 18, Font.BOLD, BaseColor.RED)));
        document.add(new Paragraph(" " + jComboBox1.getSelectedItem() + " Report ",
                FontFactory.getFont(FontFactory.TIMES_ROMAN, 18, Font.BOLD, BaseColor.BLUE)));
        document.add(new Paragraph(new java.util.Date().toString()));
        document.add(new Paragraph("--------------------------------------------------------"));
        PdfPTable table = new PdfPTable(7);
        PdfPCell cell = new PdfPCell(new Paragraph("Purcahse_Sale Report"));

        cell.setColspan(7);

        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setBackgroundColor(BaseColor.GREEN);

        table.addCell(cell);
        String sql = "select * from '" + jComboBox1.getSelectedItem() + "' ";
        pst = conn.prepareStatement(sql);
        rs = pst.executeQuery();
        while (rs.next()) {

            String v1 = rs.getString("ID");
            String add = rs.getString("Date");
            String v2 = rs.getString("BrandName");
            String v3 = rs.getString("ManufactureName");
            String v4 = rs.getString("PurchaseQuantity");
            String v5 = rs.getString("SaleQuantity");
            String v6 = rs.getString("TotalQuantity");

            //  table.addCell("ID");
            table.addCell(v1);
            //        table.addCell(v/*.date_tf.getDateFormatString()*/);
            table.addCell(add);
            //  table.addCell("Brand name");
            table.addCell(v2);
            //  table.addCell("Manyfacture Name");
            table.addCell(v3);
            //   table.addCell("purchase Quantity");
            table.addCell(v4);
            table.addCell(v5);
            table.addCell(v6);

        }
        document.add(table);

        com.itextpdf.text.List list = new com.itextpdf.text.List(true, 20);
        list.add("Printed Date:_____________");
        list.add("Signature:_______________");
        document.add(list);

        document.close();
        JOptionPane.showMessageDialog(null, "Saved Report");
    } catch (Exception e) {
        JOptionPane.showMessageDialog(null, e);
    }
}