Example usage for com.itextpdf.text FontFactory TIMES_BOLD

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

Introduction

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

Prototype

String TIMES_BOLD

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

Click Source Link

Document

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

Usage

From source file:employee.payroll.system.searchEmpSalarySlip.java

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

    // TODO add your handling code here:
    String value = txt_firstname.getText();
    String value0 = txt_surname.getText();
    String value1 = txt_id.getText();
    String value2 = txt_desig.getText();
    String value3 = txt_desig.getText();

    JFileChooser dialog = new JFileChooser();
    dialog.setSelectedFile(new File(value + " " + value0 + "-Salary Slip" + ".pdf"));
    int dialogResult = dialog.showSaveDialog(null);
    if (dialogResult == JFileChooser.APPROVE_OPTION) {
        String filePath = dialog.getSelectedFile().getPath();

        try {/*  www.  j a  v a2  s .c om*/
            // TODO add your handling code here:

            String sql = "select * from Deductions where emp_id = '" + value1 + "'";
            pst = conn.prepareStatement(sql);
            rs = pst.executeQuery();
            String val = rs.getString(5);
            String reason = rs.getString(6);
            rs.close();
            pst.close();

            String sq = "select * from Allowance where emp_id = '" + value1 + "'";
            pst = conn.prepareStatement(sq);
            rs = pst.executeQuery();

            int calcTotal = Integer.parseInt(txt_salary.getText());
            float x = Float.valueOf(rs.getString(9));
            int v = Integer.parseInt(val);
            float total = calcTotal + x - v;

            Document myDocument = new Document();
            PdfWriter myWriter = PdfWriter.getInstance(myDocument, new FileOutputStream(filePath));
            myDocument.open();

            myDocument
                    .add(new Paragraph("PAY SLIP", FontFactory.getFont(FontFactory.TIMES_BOLD, 20, Font.BOLD)));
            myDocument.add(new Paragraph(new Date().toString()));
            myDocument.add(new Paragraph(
                    "-------------------------------------------------------------------------------------------"));
            myDocument.add((new Paragraph("EMPLOYEE DETAILS",
                    FontFactory.getFont(FontFactory.TIMES_ROMAN, 15, Font.BOLD))));
            myDocument.add((new Paragraph("Name of Employee: " + value + " " + value0,
                    FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.PLAIN))));
            myDocument.add((new Paragraph("Designation: " + value2,
                    FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.PLAIN))));
            myDocument.add((new Paragraph("Department: " + value3,
                    FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.PLAIN))));
            myDocument.add(new Paragraph(
                    "-------------------------------------------------------------------------------------------"));
            myDocument
                    .add(new Paragraph("SALARY", FontFactory.getFont(FontFactory.TIMES_ROMAN, 15, Font.BOLD)));
            myDocument.add(new Paragraph("Basic Salary: $" + calcTotal,
                    FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.PLAIN)));
            myDocument.add(new Paragraph("Overtime: " + rs.getString(2) + " Hours",
                    FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.PLAIN)));
            myDocument.add(new Paragraph("Medical: $" + rs.getString(3),
                    FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.PLAIN)));
            myDocument.add(new Paragraph("Bonus: $" + rs.getString(4),
                    FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.PLAIN)));
            myDocument.add(new Paragraph("Other: $" + rs.getString(5),
                    FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.PLAIN)));
            myDocument.add(new Paragraph(
                    "-------------------------------------------------------------------------------------------"));
            myDocument.add(
                    new Paragraph("DEDUCTION", FontFactory.getFont(FontFactory.TIMES_ROMAN, 15, Font.BOLD)));
            myDocument.add(new Paragraph("Deduction Details: " + reason,
                    FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.PLAIN)));
            myDocument.add(new Paragraph("Total Deductions : $" + val,
                    FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.PLAIN)));
            myDocument.add(new Paragraph(
                    "-------------------------------------------------------------------------------------------"));
            myDocument.add(new Paragraph("TOTAL PAYMENT",
                    FontFactory.getFont(FontFactory.TIMES_ROMAN, 15, Font.BOLD)));
            myDocument.add(new Paragraph("Total Earnings: " + rs.getString(9),
                    FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.PLAIN)));
            myDocument.add(new Paragraph("Net Pay : " + total,
                    FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.PLAIN)));
            myDocument.add(new Paragraph(
                    "-------------------------------------------------------------------------------------------"));

            myDocument.newPage();
            myDocument.close();
            JOptionPane.showMessageDialog(null, "Report was successfully generated");

        } catch (Exception e) {
            JOptionPane.showMessageDialog(null, e);

        } finally {

            try {
                rs.close();
                pst.close();

            } catch (Exception e) {
                JOptionPane.showMessageDialog(null, e);

            }
        }
    }

}

From source file:employeepayroll.mainMenu.java

private void emp_td_rpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_emp_td_rpActionPerformed
    // TODO add your handling code here:
    JFileChooser dialog = new JFileChooser();
    dialog.setSelectedFile(new File("Employee Allowance Report.pdf"));
    int dialogResult = dialog.showSaveDialog(null);
    if (dialogResult == JFileChooser.APPROVE_OPTION) {
        String filePath = dialog.getSelectedFile().getPath();

        try {/*from   w  w w  .  j av  a2  s.co  m*/
            String sql = "select * from Allowance";
            pst = conn.prepareStatement(sql);
            rs = pst.executeQuery();
            Document myDocument = new Document();
            PdfWriter myWriter = PdfWriter.getInstance(myDocument, new FileOutputStream(filePath));
            PdfPTable table = new PdfPTable(11);
            myDocument.open();
            float[] columnWidths = new float[] { 3, 7, 7, 5, 5, 9, 6, 5, 8, 8, 8 };
            table.setWidths(columnWidths);
            table.setWidthPercentage(100); //set table width to 100%
            myDocument.add(new Paragraph("Employees Allowance List",
                    FontFactory.getFont(FontFactory.TIMES_BOLD, 20, Font.BOLD)));
            myDocument.add(new Paragraph(new Date().toString()));
            myDocument.add(new Paragraph(
                    "-------------------------------------------------------------------------------------------"));
            table.addCell(new PdfPCell(
                    new Paragraph("ID", FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.BOLD))));
            table.addCell(new PdfPCell(
                    new Paragraph("Overtime", FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.BOLD))));
            table.addCell(new PdfPCell(
                    new Paragraph("Medical", FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.BOLD))));
            table.addCell(new PdfPCell(
                    new Paragraph("Bonus", FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.BOLD))));
            table.addCell(new PdfPCell(
                    new Paragraph("Other", FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.BOLD))));
            table.addCell(new PdfPCell(
                    new Paragraph("Employee ID", FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.BOLD))));
            table.addCell(new PdfPCell(
                    new Paragraph("Salary", FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.BOLD))));
            table.addCell(new PdfPCell(
                    new Paragraph("Rate", FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.BOLD))));
            table.addCell(new PdfPCell(
                    new Paragraph("Allowance", FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.BOLD))));
            table.addCell(new PdfPCell(
                    new Paragraph("First Name", FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.BOLD))));
            table.addCell(new PdfPCell(
                    new Paragraph("Surname", FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.BOLD))));
            while (rs.next()) {
                table.addCell(new PdfPCell(new Paragraph(rs.getString(1),
                        FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.PLAIN))));
                table.addCell(new PdfPCell(new Paragraph(rs.getString(2),
                        FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.PLAIN))));
                table.addCell(new PdfPCell(new Paragraph(rs.getString(3),
                        FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.PLAIN))));
                table.addCell(new PdfPCell(new Paragraph(rs.getString(4),
                        FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.PLAIN))));
                table.addCell(new PdfPCell(new Paragraph(rs.getString(5),
                        FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.PLAIN))));
                table.addCell(new PdfPCell(new Paragraph(rs.getString(6),
                        FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.PLAIN))));
                table.addCell(new PdfPCell(new Paragraph(rs.getString(7),
                        FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.PLAIN))));
                table.addCell(new PdfPCell(new Paragraph(rs.getString(8),
                        FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.PLAIN))));
                table.addCell(new PdfPCell(new Paragraph(rs.getString(9),
                        FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.PLAIN))));
                table.addCell(new PdfPCell(new Paragraph(rs.getString(10),
                        FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.PLAIN))));
                table.addCell(new PdfPCell(new Paragraph(rs.getString(11),
                        FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.PLAIN))));
            }
            myDocument.add(table);
            myDocument.add(new Paragraph(
                    "--------------------------------------------------------------------------------------------"));
            myDocument.close();
            JOptionPane.showMessageDialog(null, "Allowance Report was successfully generated");
        } catch (Exception e) {
            JOptionPane.showMessageDialog(null, e);
        } finally {
            try {
                rs.close();
                pst.close();
            } catch (Exception e) {
                JOptionPane.showMessageDialog(null, e);
            }
        }
    }
}

From source file:employeepayroll.mainMenu.java

private void emp_ta_rpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_emp_ta_rpActionPerformed
    // TODO add your handling code here:
    JFileChooser dialog = new JFileChooser();
    dialog.setSelectedFile(new File("Employees Report.pdf"));
    int dialogResult = dialog.showSaveDialog(null);
    if (dialogResult == JFileChooser.APPROVE_OPTION) {
        String filePath = dialog.getSelectedFile().getPath();
        try {/*  w w w.j  a  v  a 2  s.  c  o m*/
            String sql = "select * from emp_info";
            pst = conn.prepareStatement(sql);
            rs = pst.executeQuery();
            Document myDocument = new Document();
            PdfWriter myWriter = PdfWriter.getInstance(myDocument, new FileOutputStream(filePath));
            PdfPTable table = new PdfPTable(13);
            myDocument.open();
            float[] columnWidths = new float[] { 3, 8, 7, 5, 5, 9, 8, 9, 6, 6, 6, 8, 8 };
            table.setWidths(columnWidths);
            table.setWidthPercentage(100); //set table width to 100%
            myDocument.add(new Paragraph("Employees List",
                    FontFactory.getFont(FontFactory.TIMES_BOLD, 20, Font.BOLD)));
            myDocument.add(new Paragraph(new Date().toString()));
            myDocument.add(new Paragraph(
                    "-------------------------------------------------------------------------------------------"));
            table.addCell(new PdfPCell(
                    new Paragraph("ID", FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.BOLD))));
            table.addCell(new PdfPCell(
                    new Paragraph("First Name", FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.BOLD))));
            table.addCell(new PdfPCell(
                    new Paragraph("Surname", FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.BOLD))));
            table.addCell(new PdfPCell(new Paragraph("Date of Birth",
                    FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.BOLD))));
            table.addCell(new PdfPCell(
                    new Paragraph("Email", FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.BOLD))));
            table.addCell(new PdfPCell(
                    new Paragraph("Telephone", FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.BOLD))));
            table.addCell(new PdfPCell(
                    new Paragraph("Address", FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.BOLD))));
            table.addCell(new PdfPCell(
                    new Paragraph("Department", FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.BOLD))));
            table.addCell(new PdfPCell(
                    new Paragraph("Gender", FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.BOLD))));
            table.addCell(new PdfPCell(
                    new Paragraph("Salary", FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.BOLD))));
            table.addCell(new PdfPCell(
                    new Paragraph("Status", FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.BOLD))));
            table.addCell(new PdfPCell(
                    new Paragraph("Date Hired", FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.BOLD))));
            table.addCell(new PdfPCell(
                    new Paragraph("Job Title", FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.BOLD))));

            while (rs.next()) {
                table.addCell(new PdfPCell(new Paragraph(rs.getString(1),
                        FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.PLAIN))));
                table.addCell(new PdfPCell(new Paragraph(rs.getString(2),
                        FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.PLAIN))));
                table.addCell(new PdfPCell(new Paragraph(rs.getString(3),
                        FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.PLAIN))));
                table.addCell(new PdfPCell(new Paragraph(rs.getString(4),
                        FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.PLAIN))));
                table.addCell(new PdfPCell(new Paragraph(rs.getString(5),
                        FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.PLAIN))));
                table.addCell(new PdfPCell(new Paragraph(rs.getString(6),
                        FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.PLAIN))));
                table.addCell(new PdfPCell(new Paragraph(rs.getString(7),
                        FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.PLAIN))));
                table.addCell(new PdfPCell(new Paragraph(rs.getString(8),
                        FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.PLAIN))));
                table.addCell(new PdfPCell(new Paragraph(rs.getString(10),
                        FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.PLAIN))));
                table.addCell(new PdfPCell(new Paragraph(rs.getString(11),
                        FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.PLAIN))));
                table.addCell(new PdfPCell(new Paragraph(rs.getString(16),
                        FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.PLAIN))));
                table.addCell(new PdfPCell(new Paragraph(rs.getString(17),
                        FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.PLAIN))));
                table.addCell(new PdfPCell(new Paragraph(rs.getString(18),
                        FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.PLAIN))));
            }
            myDocument.add(table);
            myDocument.add(new Paragraph(
                    "--------------------------------------------------------------------------------------------"));
            myDocument.close();
            JOptionPane.showMessageDialog(null, "Report was successfully generated");
        } catch (Exception e) {
            JOptionPane.showMessageDialog(null, e);
        } finally {

            try {
                rs.close();
                pst.close();
            } catch (Exception e) {
                JOptionPane.showMessageDialog(null, e);
            }
        }
    }
}

From source file:employeepayroll.mainMenu.java

private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed
    // TODO add your handling code here:
    JFileChooser dialog = new JFileChooser();
    dialog.setSelectedFile(new File("Employee Deduction Report.pdf"));
    int dialogResult = dialog.showSaveDialog(null);
    if (dialogResult == JFileChooser.APPROVE_OPTION) {
        String filePath = dialog.getSelectedFile().getPath();
        try {/*www .  j  a  v  a  2 s. c  o  m*/
            String sql = "select * from Deductions";
            pst = conn.prepareStatement(sql);
            rs = pst.executeQuery();
            Document myDocument = new Document();
            PdfWriter myWriter = PdfWriter.getInstance(myDocument, new FileOutputStream(filePath));
            PdfPTable table = new PdfPTable(8);
            myDocument.open();
            float[] columnWidths = new float[] { 3, 7, 7, 5, 5, 9, 6, 5 };
            table.setWidths(columnWidths);
            table.setWidthPercentage(100); //set table width to 100%
            myDocument.add(new Paragraph("Employees Deduction List",
                    FontFactory.getFont(FontFactory.TIMES_BOLD, 20, Font.BOLD)));
            myDocument.add(new Paragraph(new Date().toString()));
            myDocument.add(new Paragraph(
                    "-------------------------------------------------------------------------------------------"));
            table.addCell(new PdfPCell(
                    new Paragraph("ID", FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.BOLD))));
            table.addCell(new PdfPCell(
                    new Paragraph("First Name", FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.BOLD))));
            table.addCell(new PdfPCell(
                    new Paragraph("Surname", FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.BOLD))));
            table.addCell(new PdfPCell(
                    new Paragraph("Salary", FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.BOLD))));
            table.addCell(new PdfPCell(new Paragraph("Deduction Amount",
                    FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.BOLD))));
            table.addCell(new PdfPCell(new Paragraph("Deduction Reason",
                    FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.BOLD))));
            table.addCell(new PdfPCell(
                    new Paragraph("Employee ID", FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.BOLD))));
            table.addCell(new PdfPCell(
                    new Paragraph("Created By", FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.BOLD))));
            while (rs.next()) {
                table.addCell(new PdfPCell(new Paragraph(rs.getString(1),
                        FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.PLAIN))));
                table.addCell(new PdfPCell(new Paragraph(rs.getString(2),
                        FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.PLAIN))));
                table.addCell(new PdfPCell(new Paragraph(rs.getString(3),
                        FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.PLAIN))));
                table.addCell(new PdfPCell(new Paragraph(rs.getString(4),
                        FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.PLAIN))));
                table.addCell(new PdfPCell(new Paragraph(rs.getString(5),
                        FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.PLAIN))));
                table.addCell(new PdfPCell(new Paragraph(rs.getString(6),
                        FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.PLAIN))));
                table.addCell(new PdfPCell(new Paragraph(rs.getString(7),
                        FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.PLAIN))));
                table.addCell(new PdfPCell(new Paragraph(rs.getString(8),
                        FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.PLAIN))));
            }
            myDocument.add(table);
            myDocument.add(new Paragraph(
                    "--------------------------------------------------------------------------------------------"));
            myDocument.close();
            JOptionPane.showMessageDialog(null, "Deductions Report was successfully generated");
        } catch (Exception e) {
            JOptionPane.showMessageDialog(null, e);
        } finally {
            try {
                rs.close();
                pst.close();
            } catch (Exception e) {
                JOptionPane.showMessageDialog(null, e);
            }
        }
    }
}

From source file:employeepayroll.Searchempsalary.java

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
    // TODO add your handling code here:
    String value = txt_fname.getText();
    String value0 = txt_sname.getText();
    int value1 = parseInt(txt_id.getText());
    String value2 = txt_dest.getText();
    String value3 = txt_dept.getText();
    String overtime = " ";
    String medical = " ";
    String bonus = " ";
    String other = " ";
    String earnings = " ";

    JFileChooser dialog = new JFileChooser();
    dialog.setSelectedFile(new File(value + " " + value0 + "-SalarySlip" + ".pdf"));
    int dialogResult = dialog.showSaveDialog(null);
    if (dialogResult == JFileChooser.APPROVE_OPTION) {
        String filePath = dialog.getSelectedFile().getPath();
        try {//from w  w w .  j a  v a 2 s . c  om
            String sql = "select * from deductions where emp_id =" + value1;
            pst = conn.prepareStatement(sql);
            rs = pst.executeQuery();
            while (rs.next()) {
                val = rs.getString(5);
                reason = rs.getString(6);
                v = Integer.parseInt(val);
            }
            rs.close();
            pst.close();

            String sql2 = "select * from allowance where emp_id =" + value1;
            pst = conn.prepareStatement(sql2);
            rs = pst.executeQuery();
            while (rs.next()) {
                x = Float.valueOf(rs.getString(9));
                overtime = rs.getString(2);
                medical = rs.getString(3);
                bonus = rs.getString(4);
                other = rs.getString(5);
                earnings = rs.getString(9);
            }
            //v = Integer.parseInt(val);
            int calcTotal = Integer.parseInt(txt_sal.getText());
            float total = calcTotal + x - v;
            Document myDocument = new Document();
            PdfWriter myWriter = PdfWriter.getInstance(myDocument, new FileOutputStream(filePath));
            myDocument.open();
            myDocument
                    .add(new Paragraph("PAY SLIP", FontFactory.getFont(FontFactory.TIMES_BOLD, 20, Font.BOLD)));
            myDocument.add(new Paragraph(new Date().toString()));
            myDocument.add(new Paragraph(
                    "-------------------------------------------------------------------------------------------"));
            myDocument.add((new Paragraph("EMPLOYEE DETAILS",
                    FontFactory.getFont(FontFactory.TIMES_ROMAN, 15, Font.BOLD))));
            myDocument.add((new Paragraph("Name of Employee: " + value + " " + value0,
                    FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.PLAIN))));
            myDocument.add((new Paragraph("Designation: " + value2,
                    FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.PLAIN))));
            myDocument.add((new Paragraph("Department: " + value3,
                    FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.PLAIN))));
            myDocument.add(new Paragraph(
                    "-------------------------------------------------------------------------------------------"));
            myDocument
                    .add(new Paragraph("SALARY", FontFactory.getFont(FontFactory.TIMES_ROMAN, 15, Font.BOLD)));
            myDocument.add(new Paragraph("Basic Salary: $" + calcTotal,
                    FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.PLAIN)));
            myDocument.add(new Paragraph("Overtime: " + overtime + " Hours",
                    FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.PLAIN)));
            myDocument.add(new Paragraph("Medical: $" + medical,
                    FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.PLAIN)));
            myDocument.add(new Paragraph("Bonus: $" + bonus,
                    FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.PLAIN)));
            myDocument.add(new Paragraph("Other: $" + other,
                    FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.PLAIN)));
            myDocument.add(new Paragraph(
                    "-------------------------------------------------------------------------------------------"));
            myDocument.add(
                    new Paragraph("DEDUCTION", FontFactory.getFont(FontFactory.TIMES_ROMAN, 15, Font.BOLD)));
            myDocument.add(new Paragraph("Deduction Details: " + reason,
                    FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.PLAIN)));
            myDocument.add(new Paragraph("Total Deductions : $" + val,
                    FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.PLAIN)));
            myDocument.add(new Paragraph(
                    "-------------------------------------------------------------------------------------------"));
            myDocument.add(new Paragraph("TOTAL PAYMENT",
                    FontFactory.getFont(FontFactory.TIMES_ROMAN, 15, Font.BOLD)));
            myDocument.add(new Paragraph("Total Earnings: " + earnings,
                    FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.PLAIN)));
            myDocument.add(new Paragraph("Net Pay : " + total,
                    FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.PLAIN)));
            myDocument.add(new Paragraph(
                    "-------------------------------------------------------------------------------------------"));
            myDocument.newPage();
            myDocument.close();
            JOptionPane.showMessageDialog(null, "Report was successfully generated");
        } catch (Exception e) {
            JOptionPane.showMessageDialog(null, e + "\n creating report problem 00x333");
        } finally {
            try {
                rs.close();
                pst.close();
            } catch (SQLException e) {
                JOptionPane.showMessageDialog(null, e + "/n creating report problem 00x341");
            }
        }
    }
}

From source file:ems.memu.java

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

    JFileChooser dialog = new JFileChooser();
    dialog.setSelectedFile(new File("Employees Report.pdf"));
    int dialogResult = dialog.showSaveDialog(null);
    if (dialogResult == JFileChooser.APPROVE_OPTION) {
        String filePath = dialog.getSelectedFile().getPath();

        try {//from   ww  w . ja v a 2  s .co  m
            // TODO add your handling code here:

            String sql = "select * from empinfo";

            pst = conn.prepareStatement(sql);
            rs = pst.executeQuery();

            Document myDocument = new Document();
            PdfWriter myWriter = PdfWriter.getInstance(myDocument, new FileOutputStream(filePath));
            PdfPTable table = new PdfPTable(13);
            myDocument.open();

            float[] columnWidths = new float[] { 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8 };
            table.setWidths(columnWidths);

            table.setWidthPercentage(100); //set table width to 100%

            myDocument.add(new Paragraph("Employees List",
                    FontFactory.getFont(FontFactory.TIMES_BOLD, 20, Font.BOLD)));
            myDocument.add(new Paragraph(new Date().toString()));
            myDocument.add(new Paragraph(
                    "-------------------------------------------------------------------------------------------"));
            table.addCell(new PdfPCell(
                    new Paragraph("ID", FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.BOLD))));
            table.addCell(new PdfPCell(
                    new Paragraph("First Name", FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.BOLD))));
            table.addCell(new PdfPCell(
                    new Paragraph("Surname", FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.BOLD))));
            table.addCell(new PdfPCell(new Paragraph("Date of Birth",
                    FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.BOLD))));
            table.addCell(new PdfPCell(
                    new Paragraph("Email", FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.BOLD))));
            table.addCell(new PdfPCell(
                    new Paragraph("Telephone", FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.BOLD))));
            table.addCell(new PdfPCell(
                    new Paragraph("Address", FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.BOLD))));
            table.addCell(new PdfPCell(
                    new Paragraph("Department", FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.BOLD))));
            table.addCell(new PdfPCell(
                    new Paragraph("Gender", FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.BOLD))));
            table.addCell(new PdfPCell(
                    new Paragraph("Salary", FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.BOLD))));
            table.addCell(new PdfPCell(
                    new Paragraph("Status", FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.BOLD))));
            table.addCell(new PdfPCell(
                    new Paragraph("Date Hired", FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.BOLD))));
            table.addCell(new PdfPCell(
                    new Paragraph("Job Title", FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.BOLD))));

            while (rs.next()) {

                table.addCell(new PdfPCell(new Paragraph(rs.getString(1),
                        FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.PLAIN))));
                table.addCell(new PdfPCell(new Paragraph(rs.getString(2),
                        FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.PLAIN))));
                table.addCell(new PdfPCell(new Paragraph(rs.getString(3),
                        FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.PLAIN))));
                table.addCell(new PdfPCell(new Paragraph(rs.getString(4),
                        FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.PLAIN))));
                table.addCell(new PdfPCell(new Paragraph(rs.getString(5),
                        FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.PLAIN))));
                table.addCell(new PdfPCell(new Paragraph(rs.getString(6),
                        FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.PLAIN))));
                table.addCell(new PdfPCell(new Paragraph(rs.getString(7),
                        FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.PLAIN))));
                table.addCell(new PdfPCell(new Paragraph(rs.getString(11),
                        FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.PLAIN))));
                table.addCell(new PdfPCell(new Paragraph(rs.getString(17),
                        FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.PLAIN))));
                table.addCell(new PdfPCell(new Paragraph(rs.getString(14),
                        FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.PLAIN))));
                table.addCell(new PdfPCell(new Paragraph(rs.getString(16),
                        FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.PLAIN))));
                table.addCell(new PdfPCell(new Paragraph(rs.getString(13),
                        FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.PLAIN))));
                table.addCell(new PdfPCell(new Paragraph(rs.getString(15),
                        FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.PLAIN))));

            }

            myDocument.add(table);
            myDocument.add(new Paragraph(
                    "--------------------------------------------------------------------------------------------"));
            myDocument.close();
            JOptionPane.showMessageDialog(null, "Report was successfully generated");

        } catch (Exception e) {
            JOptionPane.showMessageDialog(null, e);

        } finally {

            try {
                rs.close();
                pst.close();

            } catch (Exception e) {
                JOptionPane.showMessageDialog(null, e);

            }
        }
    }
}

From source file:ems.memu.java

private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
    JFileChooser dialog = new JFileChooser();
    dialog.setSelectedFile(new File("Employee Deduction Report.pdf"));
    int dialogResult = dialog.showSaveDialog(null);
    if (dialogResult == JFileChooser.APPROVE_OPTION) {
        String filePath = dialog.getSelectedFile().getPath();

        try {//from ww w .j av  a2  s  .  c  o  m
            // TODO add your handling code here:

            String sql = "select * from deduction";

            pst = conn.prepareStatement(sql);
            rs = pst.executeQuery();

            Document myDocument = new Document();
            PdfWriter myWriter = PdfWriter.getInstance(myDocument, new FileOutputStream(filePath));
            PdfPTable table = new PdfPTable(7);
            myDocument.open();

            float[] columnWidths = new float[] { 8, 8, 8, 8, 8, 8, 8 };
            table.setWidths(columnWidths);

            table.setWidthPercentage(100); //set table width to 100%

            myDocument.add(new Paragraph("Employees Deduction List",
                    FontFactory.getFont(FontFactory.TIMES_BOLD, 20, Font.BOLD)));
            myDocument.add(new Paragraph(new Date().toString()));
            myDocument.add(new Paragraph(
                    "-------------------------------------------------------------------------------------------"));
            table.addCell(new PdfPCell(
                    new Paragraph("ID", FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.BOLD))));
            table.addCell(new PdfPCell(
                    new Paragraph("First Name", FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.BOLD))));
            table.addCell(new PdfPCell(
                    new Paragraph("Surname", FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.BOLD))));
            table.addCell(new PdfPCell(
                    new Paragraph("Salary", FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.BOLD))));
            table.addCell(new PdfPCell(new Paragraph("Deduction Amount",
                    FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.BOLD))));
            table.addCell(new PdfPCell(new Paragraph("Deduction Reason",
                    FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.BOLD))));
            table.addCell(new PdfPCell(
                    new Paragraph("Employee ID", FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.BOLD))));

            while (rs.next()) {
                table.addCell(new PdfPCell(new Paragraph(rs.getString(1),
                        FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.PLAIN))));
                table.addCell(new PdfPCell(new Paragraph(rs.getString(2),
                        FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.PLAIN))));
                table.addCell(new PdfPCell(new Paragraph(rs.getString(3),
                        FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.PLAIN))));
                table.addCell(new PdfPCell(new Paragraph(rs.getString(4),
                        FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.PLAIN))));
                table.addCell(new PdfPCell(new Paragraph(rs.getString(5),
                        FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.PLAIN))));
                table.addCell(new PdfPCell(new Paragraph(rs.getString(6),
                        FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.PLAIN))));
                table.addCell(new PdfPCell(new Paragraph(rs.getString(7),
                        FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.PLAIN))));

            }

            myDocument.add(table);
            myDocument.add(new Paragraph(
                    "--------------------------------------------------------------------------------------------"));
            myDocument.close();
            JOptionPane.showMessageDialog(null, "Report was successfully generated");

        } catch (Exception e) {
            JOptionPane.showMessageDialog(null, e);

        } finally {

            try {
                rs.close();
                pst.close();

            } catch (Exception e) {
                JOptionPane.showMessageDialog(null, e);

            }
        }
    }

}

From source file:Forms.AddCustomers.java

private void cardBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cardBtnActionPerformed
    String name = fNameTxt.getText() + " " + lNameTxt.getText();
    String cid = cusIdTxt.getText();
    Document document = new Document();
    Rectangle test = new Rectangle(350, 200);
    BaseColor color = new BaseColor(63, 72, 204);
    test.setBackgroundColor(color);//from www . j a va 2 s. c  o  m
    document.setPageSize(test);

    File theDir = new File("E:\\CustomerCard");

    // if the directory does not exist, create it
    if (!theDir.exists()) {
        //System.out.println("creating directory: " + directoryName);
        boolean result = false;

        try {
            theDir.mkdir();
            result = true;
        } catch (SecurityException se) {
            System.out.println(se.getMessage());
        }
    }

    try {
        PdfWriter.getInstance(document, new FileOutputStream("E:\\CustomerCard\\card(" + cid + ").pdf"));

        document.open();
        //Image image;

        //image = Image.getInstance("api.png");

        //document.add(image);

        document.add(new Paragraph("           Customer Discount Card",
                FontFactory.getFont(FontFactory.TIMES_BOLD, 16, Font.BOLD, BaseColor.GRAY)));
        document.add(new Paragraph("     "));
        document.add(new Paragraph("              Name : " + name,
                FontFactory.getFont(FontFactory.TIMES_ROMAN, 12, Font.NORMAL, BaseColor.BLACK)));
        document.add(new Paragraph("     "));
        document.add(new Paragraph("              Card ID: " + cid,
                FontFactory.getFont(FontFactory.TIMES_ROMAN, 12, Font.NORMAL, BaseColor.BLACK)));
        document.close();

        try {
            //Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler "+"E:\\CustomerCard\\card("+cid+").pdf");
            Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler "
                    + "C:\\Users\\Vidu\\Desktop\\CustomerIDCard\\card(" + cid + ").pdf");
        } catch (Exception ex) {
            Logger.getLogger(SellPage.class.getName()).log(Level.SEVERE, null, ex);
        }
        //document.add(new Paragraph(date,FontFactory.getFont(FontFactory.TIMES_ROMAN, 12, Font.NORMAL,BaseColor.BLACK)));
        fNameTxt.setText("");
        lNameTxt.setText("");
        cusIdTxt.setText("");
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}

From source file:Forms.CloseCash.java

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
    String sql = "SELECT * FROM `cash` WHERE 1";

    Date dNow = new Date();

    SimpleDateFormat ft = new SimpleDateFormat("dd.MM.yyyy");
    String date = "" + ft.format(dNow);

    File theDir = new File("E:\\Reports");

    // if the directory does not exist, create it
    if (!theDir.exists()) {
        //System.out.println("creating directory: " + directoryName);
        boolean result = false;

        try {// w  w  w . j  ava2  s . com
            theDir.mkdir();
            result = true;
        } catch (SecurityException se) {
            //handle it
        }
    }

    try {

        Connection con = (Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/nafis", "root",
                "");
        Statement s = (Statement) con.prepareStatement(sql);

        ResultSet rs = s.executeQuery(sql);

        Document document = new Document(PageSize.A5);
        PdfWriter.getInstance(document, new FileOutputStream("E:\\Reports\\report(" + date + ").pdf"));
        document.open();
        Image image = Image.getInstance("api.png");
        document.add(image);
        document.add(new Paragraph("UNITY POS REPORS",
                FontFactory.getFont(FontFactory.TIMES_BOLD, 20, Font.BOLD, BaseColor.BLUE)));
        document.add(new Paragraph(date,
                FontFactory.getFont(FontFactory.TIMES_ROMAN, 12, Font.NORMAL, BaseColor.BLACK)));

        document.add(new Paragraph(
                "--------------------------------------------------------------------------------------"));

        PdfPTable table = new PdfPTable(4);
        //table.addCell("Date");
        //table.addCell("Cash In/Out");

        PdfPCell cell = new PdfPCell(new Phrase("Date"));
        cell.setBackgroundColor(BaseColor.DARK_GRAY);
        table.addCell(cell);
        PdfPCell ce = new PdfPCell(new Phrase("Cash In/Out"));
        ce.setBackgroundColor(BaseColor.DARK_GRAY);
        table.addCell(ce);
        PdfPCell c = new PdfPCell(new Phrase("Cause"));
        c.setBackgroundColor(BaseColor.DARK_GRAY);
        table.addCell(c);
        PdfPCell cel = new PdfPCell(new Phrase("Amount"));
        cel.setBackgroundColor(BaseColor.DARK_GRAY);
        table.addCell(cel);

        document.add(new Paragraph("  "));
        document.add(table);

        float in = 0, out = 0;
        while (rs.next()) {
            String dateof = rs.getString(5);
            String inout = rs.getString(2);
            String cause = rs.getString(3);
            String amount = rs.getString(4);

            if (inout.equalsIgnoreCase("Cash In")) {
                in = in + Float.parseFloat(amount);
            } else {
                out = out + Float.parseFloat(amount);
            }

            PdfPTable t = new PdfPTable(4);
            t.addCell(dateof);
            t.addCell(inout);
            t.addCell(cause);
            t.addCell(amount);
            document.add(t);
        }

        System.out.println("in=" + in + "out=" + out);
        document.add(new Paragraph("  "));
        document.add(new Paragraph("Total Invested: " + out,
                FontFactory.getFont(FontFactory.TIMES_ROMAN, 12, Font.NORMAL, BaseColor.BLACK)));
        document.add(new Paragraph("Total Return: " + in,
                FontFactory.getFont(FontFactory.TIMES_ROMAN, 12, Font.NORMAL, BaseColor.BLACK)));
        document.add(new Paragraph("Total Earned: " + (in - out),
                FontFactory.getFont(FontFactory.TIMES_ROMAN, 12, Font.NORMAL, BaseColor.BLACK)));
        document.add(new Paragraph("  "));
        document.add(new Paragraph(
                "--------------------------------------------------------------------------------------"));
        document.close();
    } catch (Exception ex) {
        JOptionPane.showMessageDialog(null, "problem in memoo");
    }

    ///////////////////////////
    //to open pdf invoice
    try {
        Runtime.getRuntime()
                .exec("rundll32 url.dll,FileProtocolHandler " + "E:\\Reports\\report(" + date + ").pdf");
    } catch (IOException ex) {
        Logger.getLogger(SellPage.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:frames.main.java

private void jButton13ActionPerformed(java.awt.event.ActionEvent evt) {
    try {/*ww  w . ja v  a2 s .  c o m*/

        BaseFont unicode = BaseFont.createFont("c:/windows/fonts/ALGER.ttf", BaseFont.IDENTITY_H,
                BaseFont.EMBEDDED);

        // Font font11113 = new Font(unicode, 16, Font.BOLD,BaseColor(2,2,2));
        ///////////////////////////////////////////////dark brown//////////////////////////////////////////////////////
        Font font1003 = new Font(unicode, 16, Font.BOLD, new BaseColor(101, 67, 33));
        Font font1008 = new Font(unicode, 20, Font.BOLD, new BaseColor(101, 67, 33));
        /////////////////////////////////////
        ///////////////////////////////////////////////dark red//////////////////////////////////////////////////////
        Font font1004 = new Font(unicode, 14, Font.BOLD, new BaseColor(139, 0, 0));
        Font font1005 = new Font(unicode, 14, Font.BOLD, new BaseColor(255, 0, 0));

        /////////////////////////////////////
        Font font100 = new Font(unicode, 8, Font.ITALIC, BaseColor.BLUE);
        Document document = new Document();
        PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("SMART-TC.pdf"));
        document.open();
        PdfContentByte cb = writer.getDirectContent();
        Font font111 = new Font(Font.FontFamily.COURIER, 16, Font.BOLD, BaseColor.ORANGE);
        com.itextpdf.text.Image image2 = com.itextpdf.text.Image
                .getInstance("C:\\smart kid\\src\\frames\\logo.jpg");
        image2.scaleAbsolute(125f, 125f);
        image2.setAbsolutePosition(31, 700);
        document.add(image2);
        com.itextpdf.text.Image ing = com.itextpdf.text.Image.getInstance("C:\\smart kid\\src\\frames\\BC.jpg");
        ing.setAbsolutePosition(1, 200);
        document.add(ing);
        Font font1111 = new Font(unicode, 16, Font.BOLD, BaseColor.ORANGE);
        Font font11111 = new Font(unicode, 14, Font.BOLD, BaseColor.ORANGE);
        java.awt.Font awtPlainFont = new java.awt.Font("ALGERIAN", java.awt.Font.PLAIN, 10);
        document.add(new Paragraph("                                    SMART KIDS CONVENT SCHOOL", font1008));
        document.add(new Paragraph(
                "                                                   HEERA NAGAR (GURGAON)         ", font1003));
        document.add(
                new Chunk("                                       SCHOLOR'S REGISTER AND TRANSFER CERTIFICATE",
                        font1005));
        document.add(new Paragraph("                                    "));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph("                            ", font111));
        Font font41 = new Font(Font.FontFamily.HELVETICA, 9, Font.BOLD, new BaseColor(0, 0, 0));
        Font font23 = new Font(Font.FontFamily.HELVETICA, 12, Font.BOLD, new BaseColor(92, 64, 51));
        Font font1 = new Font(Font.FontFamily.HELVETICA, 10, Font.BOLD, new BaseColor(0, 0, 0));
        Font font11 = new Font(Font.FontFamily.HELVETICA, 12, Font.ITALIC, new BaseColor(148, 0, 211));
        Font font31 = new Font(Font.FontFamily.HELVETICA, 10, Font.BOLD, new BaseColor(990000));
        Font font2 = new Font(Font.FontFamily.COURIER, 18, Font.ITALIC | Font.UNDERLINE);
        Font font3 = new Font(Font.FontFamily.HELVETICA, 10, Font.BOLD, new BaseColor(255, 255, 200));

        document.add(new Paragraph(
                "Ref No:  " + TC16.getText() + "                         " + new java.util.Date().toString(),
                FontFactory.getFont(FontFactory.COURIER, 12, Font.NORMAL, BaseColor.BLACK)));
        document.add(new Paragraph("    "));
        String ho4 = TC1.getText();
        Paragraph p1 = new Paragraph();
        p1.add(new Chunk("NAME OF STUDENT        :",
                FontFactory.getFont(FontFactory.COURIER, 12, Font.NORMAL, BaseColor.BLACK)));
        p1.add(new Chunk(ho4, font11));
        document.add(p1);

        String ho5 = TC2.getText();
        Paragraph p2 = new Paragraph();
        p2.add(new Chunk("FATHER'S NAME          :",
                FontFactory.getFont(FontFactory.COURIER, 12, Font.NORMAL, BaseColor.BLACK)));
        p2.add(new Chunk(ho5, font11));
        document.add(p2);

        String ho6 = TC3.getText();
        Paragraph p93 = new Paragraph();
        p93.add(new Chunk("MOTHER'S NAME          :",
                FontFactory.getFont(FontFactory.COURIER, 12, Font.NORMAL, BaseColor.BLACK)));
        p93.add(new Chunk(ho6, font11));
        document.add(p93);

        Font font15 = new Font(Font.FontFamily.HELVETICA, 10, Font.BOLD, new BaseColor(0, 0, 0));
        String ho8 = TC1.getText();
        String tt = TC4.getText();
        Paragraph p4 = new Paragraph();

        p4.add(new Chunk("RELIGION               :",
                FontFactory.getFont(FontFactory.COURIER, 12, Font.NORMAL, BaseColor.BLACK)));
        p4.add(new Chunk(tt, font11));

        document.add(p4);
        // document.add(new Paragraph("                                            ",font1003));
        String kk = TC5.getText();
        Paragraph p5 = new Paragraph();
        p5.add(new Chunk("CASTE OF SCHOLOR       :",
                FontFactory.getFont(FontFactory.COURIER, 12, Font.NORMAL, BaseColor.BLACK)));
        p5.add(new Chunk(kk, font11));
        document.add(p5);

        String ho10 = TC10.getText();
        Paragraph p6 = new Paragraph();
        p6.add(new Chunk("ADDRESS                :",
                FontFactory.getFont(FontFactory.COURIER, 12, Font.NORMAL, BaseColor.BLACK)));
        p6.add(new Chunk(ho10, font11));
        document.add(p6);

        Paragraph p8 = new Paragraph();
        p8.add(new Chunk("DATE OF BIRTH          :",
                FontFactory.getFont(FontFactory.COURIER, 12, Font.NORMAL, BaseColor.BLACK)));
        p8.add(new Chunk(TC9.getText(), font11));
        document.add(p8);
        Paragraph p9 = new Paragraph();
        p9.add(new Chunk("SECTION                :",
                FontFactory.getFont(FontFactory.COURIER, 12, Font.NORMAL, BaseColor.BLACK)));
        p9.add(new Chunk(TC7.getText(), font11));
        document.add(p9);
        Paragraph p10 = new Paragraph();
        p10.add(new Chunk("REGISTRATION NO:       :",
                FontFactory.getFont(FontFactory.COURIER, 12, Font.NORMAL, BaseColor.BLACK)));
        p10.add(new Chunk(TC8.getText(), font11));
        document.add(p10);
        document.add(new Paragraph("                                       "));

        PdfPTable table = new PdfPTable(8);
        String vacume = "";
        table.addCell("Class");
        table.addCell("Date of Admission");
        table.addCell("Date of Promotion");
        table.addCell("Date of Removal");
        table.addCell("Cause of Removal");
        table.addCell("Year");
        table.addCell("Conduct and Work");
        table.addCell("Sign");

        PdfPCell cell10 = new PdfPCell(new Paragraph("NURSERY", font100));
        table.addCell(cell10);
        if (TC6.getSelectedIndex() == 0) {
            PdfPCell cell11 = new PdfPCell(new Paragraph(TC11.getText(), font100));
            PdfPCell cell12 = new PdfPCell(
                    new Paragraph(((JTextField) TC12.getDateEditor().getUiComponent()).getText(), font100));
            PdfPCell cell13 = new PdfPCell(
                    new Paragraph(((JTextField) TC13.getDateEditor().getUiComponent()).getText(), font100));
            ;
            PdfPCell cell14 = new PdfPCell(new Paragraph(TC14.getText(), font100));
            PdfPCell cell15 = new PdfPCell(new Paragraph((String) TC15.getSelectedItem(), font100));
            PdfPCell cell16 = new PdfPCell(new Paragraph(TC17.getText(), font100));
            table.addCell(cell11);
            table.addCell(cell12);
            table.addCell(cell13);
            table.addCell(cell14);
            table.addCell(cell15);
            table.addCell(cell16);
            table.addCell("");
        } else {
            for (int i = 0; i < 7; i++)
                table.addCell(vacume);
        }

        PdfPCell cell111 = new PdfPCell(new Paragraph("LKG", font100));
        table.addCell(cell111);
        if (TC6.getSelectedIndex() == 1) {
            PdfPCell cell11 = new PdfPCell(new Paragraph(TC11.getText(), font100));
            PdfPCell cell12 = new PdfPCell(
                    new Paragraph(((JTextField) TC12.getDateEditor().getUiComponent()).getText(), font100));
            PdfPCell cell13 = new PdfPCell(
                    new Paragraph(((JTextField) TC13.getDateEditor().getUiComponent()).getText(), font100));
            ;
            PdfPCell cell14 = new PdfPCell(new Paragraph(TC14.getText(), font100));
            PdfPCell cell15 = new PdfPCell(new Paragraph((String) TC15.getSelectedItem(), font100));
            PdfPCell cell16 = new PdfPCell(new Paragraph(TC17.getText(), font100));
            table.addCell(cell11);
            table.addCell(cell12);
            table.addCell(cell13);
            table.addCell(cell14);
            table.addCell(cell15);
            table.addCell(cell16);
            table.addCell("");
        } else {
            for (int i = 0; i < 7; i++)
                table.addCell(vacume);
        }

        PdfPCell cell1 = new PdfPCell(new Paragraph("UKG", font100));
        table.addCell(cell1);
        if (TC6.getSelectedIndex() == 2) {
            PdfPCell cell11 = new PdfPCell(new Paragraph(TC11.getText(), font100));
            PdfPCell cell12 = new PdfPCell(
                    new Paragraph(((JTextField) TC12.getDateEditor().getUiComponent()).getText(), font100));
            PdfPCell cell13 = new PdfPCell(
                    new Paragraph(((JTextField) TC13.getDateEditor().getUiComponent()).getText(), font100));
            ;
            PdfPCell cell14 = new PdfPCell(new Paragraph(TC14.getText(), font100));
            PdfPCell cell15 = new PdfPCell(new Paragraph((String) TC15.getSelectedItem(), font100));
            PdfPCell cell16 = new PdfPCell(new Paragraph(TC17.getText(), font100));
            table.addCell(cell11);
            table.addCell(cell12);
            table.addCell(cell13);
            table.addCell(cell14);
            table.addCell(cell15);
            table.addCell(cell16);
            table.addCell("");
        } else {
            for (int i = 0; i < 7; i++)
                table.addCell(vacume);
        }
        PdfPCell cell2 = new PdfPCell(new Paragraph("STD-1", font100));
        table.addCell(cell2);
        if (TC6.getSelectedIndex() == 3) {
            PdfPCell cell11 = new PdfPCell(new Paragraph(TC11.getText(), font100));
            PdfPCell cell12 = new PdfPCell(
                    new Paragraph(((JTextField) TC12.getDateEditor().getUiComponent()).getText(), font100));
            PdfPCell cell13 = new PdfPCell(
                    new Paragraph(((JTextField) TC13.getDateEditor().getUiComponent()).getText(), font100));
            ;
            PdfPCell cell14 = new PdfPCell(new Paragraph(TC14.getText(), font100));
            PdfPCell cell15 = new PdfPCell(new Paragraph((String) TC15.getSelectedItem(), font100));
            PdfPCell cell16 = new PdfPCell(new Paragraph(TC17.getText(), font100));
            table.addCell(cell11);
            table.addCell(cell12);
            table.addCell(cell13);
            table.addCell(cell14);
            table.addCell(cell15);
            table.addCell(cell16);
            table.addCell("");
        } else {
            for (int i = 0; i < 7; i++)
                table.addCell(vacume);
        }

        PdfPCell cell3 = new PdfPCell(new Paragraph("STD-2", font100));
        table.addCell(cell3);
        if (TC6.getSelectedIndex() == 4) {
            PdfPCell cell11 = new PdfPCell(new Paragraph(TC11.getText(), font100));
            PdfPCell cell12 = new PdfPCell(
                    new Paragraph(((JTextField) TC12.getDateEditor().getUiComponent()).getText(), font100));
            PdfPCell cell13 = new PdfPCell(
                    new Paragraph(((JTextField) TC13.getDateEditor().getUiComponent()).getText(), font100));
            ;
            PdfPCell cell14 = new PdfPCell(new Paragraph(TC14.getText(), font100));
            PdfPCell cell15 = new PdfPCell(new Paragraph((String) TC15.getSelectedItem(), font100));
            PdfPCell cell16 = new PdfPCell(new Paragraph(TC17.getText(), font100));
            table.addCell(cell11);
            table.addCell(cell12);
            table.addCell(cell13);
            table.addCell(cell14);
            table.addCell(cell15);
            table.addCell(cell16);
            table.addCell("");
        } else {
            for (int i = 0; i < 7; i++)
                table.addCell(vacume);
        }

        PdfPCell cell4 = new PdfPCell(new Paragraph("STD-3", font100));
        table.addCell(cell4);
        if (TC6.getSelectedIndex() == 5) {
            PdfPCell cell11 = new PdfPCell(new Paragraph(TC11.getText(), font100));
            PdfPCell cell12 = new PdfPCell(
                    new Paragraph(((JTextField) TC12.getDateEditor().getUiComponent()).getText(), font100));
            PdfPCell cell13 = new PdfPCell(
                    new Paragraph(((JTextField) TC13.getDateEditor().getUiComponent()).getText(), font100));
            ;
            PdfPCell cell14 = new PdfPCell(new Paragraph(TC14.getText(), font100));
            PdfPCell cell15 = new PdfPCell(new Paragraph((String) TC15.getSelectedItem(), font100));
            PdfPCell cell16 = new PdfPCell(new Paragraph(TC17.getText(), font100));
            table.addCell(cell11);
            table.addCell(cell12);
            table.addCell(cell13);
            table.addCell(cell14);
            table.addCell(cell15);
            table.addCell(cell16);
            table.addCell("");
        } else {
            for (int i = 0; i < 7; i++)
                table.addCell(vacume);
        }

        PdfPCell cell5 = new PdfPCell(new Paragraph("STD-4", font100));
        table.addCell(cell5);
        if (TC6.getSelectedIndex() == 6) {
            PdfPCell cell11 = new PdfPCell(new Paragraph(TC11.getText(), font100));
            PdfPCell cell12 = new PdfPCell(
                    new Paragraph(((JTextField) TC12.getDateEditor().getUiComponent()).getText(), font100));
            PdfPCell cell13 = new PdfPCell(
                    new Paragraph(((JTextField) TC13.getDateEditor().getUiComponent()).getText(), font100));
            ;
            PdfPCell cell14 = new PdfPCell(new Paragraph(TC14.getText(), font100));
            PdfPCell cell15 = new PdfPCell(new Paragraph((String) TC15.getSelectedItem(), font100));
            PdfPCell cell16 = new PdfPCell(new Paragraph(TC17.getText(), font100));
            table.addCell(cell11);
            table.addCell(cell12);
            table.addCell(cell13);
            table.addCell(cell14);
            table.addCell(cell15);
            table.addCell(cell16);
            table.addCell("");
        } else {
            for (int i = 0; i < 7; i++)
                table.addCell(vacume);
        }
        PdfPCell cell6 = new PdfPCell(new Paragraph("STD-5", font100));
        table.addCell(cell6);
        if (TC6.getSelectedIndex() == 7) {
            PdfPCell cell11 = new PdfPCell(new Paragraph(TC11.getText(), font100));
            PdfPCell cell12 = new PdfPCell(
                    new Paragraph(((JTextField) TC12.getDateEditor().getUiComponent()).getText(), font100));
            PdfPCell cell13 = new PdfPCell(
                    new Paragraph(((JTextField) TC13.getDateEditor().getUiComponent()).getText(), font100));
            ;
            PdfPCell cell14 = new PdfPCell(new Paragraph(TC14.getText(), font100));
            PdfPCell cell15 = new PdfPCell(new Paragraph((String) TC15.getSelectedItem(), font100));
            PdfPCell cell16 = new PdfPCell(new Paragraph(TC17.getText(), font100));
            table.addCell(cell11);
            table.addCell(cell12);
            table.addCell(cell13);
            table.addCell(cell14);
            table.addCell(cell15);
            table.addCell(cell16);
            table.addCell("");
        } else {
            for (int i = 0; i < 7; i++)
                table.addCell(vacume);
        }
        PdfPCell cell8 = new PdfPCell(new Paragraph("STD-6", font100));
        table.addCell(cell8);
        if (TC6.getSelectedIndex() == 8) {
            PdfPCell cell11 = new PdfPCell(new Paragraph(TC11.getText(), font100));
            PdfPCell cell12 = new PdfPCell(
                    new Paragraph(((JTextField) TC12.getDateEditor().getUiComponent()).getText(), font100));
            PdfPCell cell13 = new PdfPCell(
                    new Paragraph(((JTextField) TC13.getDateEditor().getUiComponent()).getText(), font100));
            ;
            PdfPCell cell14 = new PdfPCell(new Paragraph(TC14.getText(), font100));
            PdfPCell cell15 = new PdfPCell(new Paragraph((String) TC15.getSelectedItem(), font100));
            PdfPCell cell16 = new PdfPCell(new Paragraph(TC17.getText(), font100));
            table.addCell(cell11);
            table.addCell(cell12);
            table.addCell(cell13);
            table.addCell(cell14);
            table.addCell(cell15);
            table.addCell(cell16);
            table.addCell("");
        } else {
            for (int i = 0; i < 7; i++)
                table.addCell(vacume);
        }

        PdfPCell cell9 = new PdfPCell(new Paragraph("STD-7", font100));
        table.addCell(cell9);
        if (TC6.getSelectedIndex() == 9) {
            PdfPCell cell11 = new PdfPCell(new Paragraph(TC11.getText(), font100));
            PdfPCell cell12 = new PdfPCell(
                    new Paragraph(((JTextField) TC12.getDateEditor().getUiComponent()).getText(), font100));
            PdfPCell cell13 = new PdfPCell(
                    new Paragraph(((JTextField) TC13.getDateEditor().getUiComponent()).getText(), font100));
            ;
            PdfPCell cell14 = new PdfPCell(new Paragraph(TC14.getText(), font100));
            PdfPCell cell15 = new PdfPCell(new Paragraph((String) TC15.getSelectedItem(), font100));
            PdfPCell cell16 = new PdfPCell(new Paragraph(TC17.getText(), font100));
            table.addCell(cell11);
            table.addCell(cell12);
            table.addCell(cell13);
            table.addCell(cell14);
            table.addCell(cell15);
            table.addCell(cell16);
            table.addCell("");
        } else {
            for (int i = 0; i < 7; i++)
                table.addCell(vacume);
        }

        PdfPCell cell18 = new PdfPCell(new Paragraph("STD-8", font100));
        table.addCell(cell18);
        if (TC6.getSelectedIndex() == 2) {
            PdfPCell cell11 = new PdfPCell(new Paragraph(TC11.getText(), font100));
            PdfPCell cell12 = new PdfPCell(
                    new Paragraph(((JTextField) TC12.getDateEditor().getUiComponent()).getText(), font100));
            PdfPCell cell13 = new PdfPCell(
                    new Paragraph(((JTextField) TC13.getDateEditor().getUiComponent()).getText(), font100));
            ;
            PdfPCell cell14 = new PdfPCell(new Paragraph(TC14.getText(), font100));
            PdfPCell cell15 = new PdfPCell(new Paragraph((String) TC15.getSelectedItem(), font100));
            PdfPCell cell16 = new PdfPCell(new Paragraph(TC17.getText(), font100));
            table.addCell(cell11);
            table.addCell(cell12);
            table.addCell(cell13);
            table.addCell(cell14);
            table.addCell(cell15);
            table.addCell(cell16);
            table.addCell("");
        } else {
            for (int i = 0; i < 7; i++)
                table.addCell(vacume);
        }

        float[] ColumnWidths = new float[] { 8f, 12f, 12f, 12f, 22f, 8f, 15f, 7f };
        table.setWidths(ColumnWidths);
        table.setWidthPercentage(106);
        table.setHorizontalAlignment(Element.ALIGN_LEFT);
        document.add(table);

        document.add(new Paragraph("                                       "));
        document.add(new Paragraph("                                       "));
        document.add(new Paragraph(
                "1. I certified that the entries as regard details of the student have been duly checked from the 'Admission form' and that they are complete.",
                FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.NORMAL, BaseColor.BLACK)));
        // document.add(new Paragraph("                                                                                                        "));

        document.add(new Paragraph("                                       "));
        document.add(new Paragraph(
                "2. Certified that the above Students register have been posted up-to date of students leaving as required by the departmental rules.",
                FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.NORMAL, BaseColor.BLACK)));
        document.add(new Paragraph("                                       "));
        document.add(new Paragraph("                                       "));
        document.add(new Paragraph(
                "Prepared by:-" + "                                " + "Date:-" + " "
                        + new java.util.Date().toString() + "                      " + "Principal's Sign:-",
                FontFactory.getFont(FontFactory.TIMES_BOLD, 12, Font.NORMAL, BaseColor.BLACK)));

        document.add(new Paragraph("                                       "));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph("An ISO 9001:2008 Certified School(Certificate Number:NOR/0712M/1505)",
                FontFactory.getFont(FontFactory.COURIER, 12, Font.NORMAL, BaseColor.BLUE)));
        document.add(new Paragraph("(Run By:Smart Educational Society)Regd.No.(DR/GGN/285)",
                FontFactory.getFont(FontFactory.COURIER, 12, Font.NORMAL, BaseColor.BLUE)));
        document.add(new Paragraph(
                "413A/23,Gali No:-2,Heera Nagar,Near Rajendra Hospital,Khandsa Road,Gurgaon(Haryana)",
                FontFactory.getFont(FontFactory.COURIER, 10, Font.NORMAL, BaseColor.BLUE)));
        cb.saveState();
        cb.setColorStroke(BaseColor.BLACK);
        cb.rectangle(2, 2, 588, 828);
        cb.stroke();
        cb.restoreState();
        JOptionPane.showMessageDialog(this, "it is saved");
        document.close();
    } catch (Exception ee) {
        JOptionPane.showMessageDialog(this, ee);
    } // TODO add your handling code here:
}