Example usage for com.itextpdf.text Font BOLD

List of usage examples for com.itextpdf.text Font BOLD

Introduction

In this page you can find the example usage for com.itextpdf.text Font BOLD.

Prototype

int BOLD

To view the source code for com.itextpdf.text Font BOLD.

Click Source Link

Document

this is a possible style.

Usage

From source file:opticalworkshopmonitoringsystem.CenteringAndEdgingView.java

License:Open Source License

private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
    //code for the forating of the pdf report.

    try {/*from  ww w.  j a  va  2s.co m*/
        Document document = new Document();
        JFileChooser fc = new JFileChooser();
        fc.showOpenDialog(null);

        PdfWriter.getInstance(document, new FileOutputStream(fc.getSelectedFile().getAbsolutePath()));
        document.open();

        Font courierFontItalic = new Font(Font.FontFamily.COURIER, 10, Font.ITALIC);
        Font courierFontUnderline = new Font(Font.FontFamily.COURIER, 10, Font.UNDERLINE);
        Font tr = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD);
        Font timesRomanUnderline = new Font(Font.FontFamily.TIMES_ROMAN, 20, Font.UNDERLINE);
        Font helvetica = new Font(Font.FontFamily.HELVETICA, 14, Font.UNDERLINE);

        document.add(new Paragraph(
                "                         Centering And Edging Division                            ",
                timesRomanUnderline));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));

        document.add(new Paragraph(jLabel1.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField1.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel2.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField2.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel3.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField3.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel4.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField4.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel5.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField5.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel6.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField6.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel7.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField7.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel8.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField8.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel9.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField9.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel10.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField10.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel11.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField11.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel12.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField12.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel13.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField13.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));

        document.add(new Paragraph(
                "                                                                                                                                  "));
        document.add(new Paragraph(
                "                                                                                                                                  "));
        document.add(new Paragraph(
                "                                                                                                                                  "));
        document.add(new Paragraph(
                "                                                                                                                                  "));
        document.add(new Paragraph(
                "      Prepared by                                   Checked by                                       Approved by                  "));

        document.close();
        JOptionPane.showMessageDialog(null, "report generated successfully");
    } catch (DocumentException ex) {
        Logger.getLogger(CenteringAndEdgingView.class.getName()).log(Level.SEVERE, null, ex);
    } catch (FileNotFoundException ex) {
        Logger.getLogger(CenteringAndEdgingView.class.getName()).log(Level.SEVERE, null, ex);
    }

}

From source file:opticalworkshopmonitoringsystem.GrindingDivisionView.java

License:Open Source License

private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
    try {// w ww  . j  a  v  a2  s. c  o m
        Document document = new Document();
        JFileChooser fc = new JFileChooser();
        fc.showOpenDialog(null);

        PdfWriter.getInstance(document, new FileOutputStream(fc.getSelectedFile().getAbsolutePath()));
        document.open();

        Font courierFontItalic = new Font(Font.FontFamily.COURIER, 10, Font.ITALIC);
        Font courierFontUnderline = new Font(Font.FontFamily.COURIER, 10, Font.UNDERLINE);
        Font tr = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD);
        Font timesRomanUnderline = new Font(Font.FontFamily.TIMES_ROMAN, 20, Font.UNDERLINE);
        Font helvetica = new Font(Font.FontFamily.HELVETICA, 14, Font.UNDERLINE);

        document.add(new Paragraph(
                "                                 Grinding Division                                         ",
                timesRomanUnderline));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));

        document.add(new Paragraph(jLabel2.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField2.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel3.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField3.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel1.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField1.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel4.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField4.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel5.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField23.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel6.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField24.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel7.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField25.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel8.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField26.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));

        document.add(new Paragraph("          Slicing Operation                        ", helvetica));

        document.add(new Paragraph(jLabel9.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField27.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel11.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField28.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel10.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField29.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel23.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField30.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel24.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField31.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));

        document.add(new Paragraph("          Trepening Operation                        ", helvetica));

        document.add(new Paragraph(jLabel15.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField19.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel17.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField20.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel28.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField21.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel29.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField22.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel30.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField32.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));

        document.add(new Paragraph("          Curve Generation Operation                        ", helvetica));

        document.add(new Paragraph(jLabel12.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField5.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel13.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField6.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel14.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField7.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel25.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField16.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel26.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField17.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel27.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField18.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));

        document.add(
                new Paragraph("          Grinding and Smoothing Operation                        ", helvetica));

        document.add(new Paragraph(jLabel38.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField43.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel39.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField44.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel40.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField45.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel41.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField46.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel42.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField47.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel43.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField48.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel44.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField49.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));

        document.add(new Paragraph("          Inspection Details                        ", helvetica));

        document.add(new Chunk("                                                      Specified"));
        document.add(new Chunk("                                            Measured"));
        document.add(new Paragraph(jLabel16.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField8.getText()));
        document.add(
                new Chunk("                                                      " + jTextField12.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));

        document.add(new Paragraph(jLabel18.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField9.getText()));
        document.add(
                new Chunk("                                                      " + jTextField15.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));

        document.add(new Paragraph(jLabel19.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField10.getText()));
        document.add(
                new Chunk("                                                        " + jTextField13.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));

        document.add(new Paragraph("          Angles                        ", helvetica));

        document.add(new Paragraph(jLabel32.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField11.getText()));
        document.add(
                new Chunk("                                                        " + jTextField14.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));

        document.add(new Paragraph(jLabel33.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField33.getText()));
        document.add(
                new Chunk("                                                      " + jTextField38.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));

        document.add(new Paragraph(jLabel34.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField34.getText()));
        document.add(
                new Chunk("                                                      " + jTextField39.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));

        document.add(new Paragraph(jLabel35.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField35.getText()));
        document.add(
                new Chunk("                                                        " + jTextField40.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));

        document.add(new Paragraph(jLabel36.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField37.getText()));
        document.add(
                new Chunk("                                                        " + jTextField41.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));

        document.add(new Paragraph(jLabel37.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField36.getText()));
        document.add(
                new Chunk("                                                        " + jTextField42.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));

        document.add(new Paragraph(jLabel45.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField50.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));

        document.add(new Paragraph(jLabel46.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField51.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));

        document.add(new Paragraph(jLabel47.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField52.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));

        document.add(new Paragraph(jLabel48.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField53.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));

        document.add(new Paragraph(
                "                                                                                                                                  "));
        document.add(new Paragraph(
                "                                                                                                                                  "));
        document.add(new Paragraph(
                "                                                                                                                                  "));
        document.add(new Paragraph(
                "                                                                                                                                  "));
        document.add(new Paragraph(
                "      Prepared by                                   Checked by                                       Approved by                  "));

        document.close();
        JOptionPane.showMessageDialog(null, "report generated successfully");
    } catch (DocumentException ex) {
        Logger.getLogger(GrindingDivisionView.class.getName()).log(Level.SEVERE, null, ex);
    } catch (FileNotFoundException ex) {
        Logger.getLogger(GrindingDivisionView.class.getName()).log(Level.SEVERE, null, ex);
    }

}

From source file:opticalworkshopmonitoringsystem.PolishingDivisionView.java

License:Open Source License

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

    try {//from  w  w w.j a  v  a  2s  .  c o  m
        // TODO add your handling code here:

        Document document = new Document();
        JFileChooser fc = new JFileChooser();
        fc.showOpenDialog(null);

        PdfWriter.getInstance(document, new FileOutputStream(fc.getSelectedFile().getAbsolutePath()));
        document.open();

        Font courierFontItalic = new Font(Font.FontFamily.COURIER, 10, Font.ITALIC);
        Font courierFontUnderline = new Font(Font.FontFamily.COURIER, 10, Font.UNDERLINE);
        Font tr = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD);
        Font timesRomanUnderline = new Font(Font.FontFamily.TIMES_ROMAN, 20, Font.UNDERLINE);
        Font helvetica = new Font(Font.FontFamily.HELVETICA, 14, Font.UNDERLINE);

        document.add(new Paragraph(
                "                                 Polishing Division                                         ",
                timesRomanUnderline));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));

        document.add(new Paragraph(jLabel1.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField1.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel2.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField2.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel3.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField3.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));

        document.add(new Paragraph("          Polisher Details                        ", helvetica));

        document.add(new Paragraph(jLabel4.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField4.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel5.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField5.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel6.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField6.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel7.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField7.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel8.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField8.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel9.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField9.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));

        document.add(
                new Paragraph("          Polishing Material(Processing)                        ", helvetica));

        document.add(new Paragraph(jLabel10.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField10.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel11.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField11.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel12.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField12.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel13.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField13.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel14.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField14.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));

        document.add(new Paragraph("          Polishing Iteration                        ", helvetica));

        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel17.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField18.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel18.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField19.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));

        document.add(new Paragraph("          Final Inspection                        ", helvetica));

        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel23.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField23.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel24.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField24.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel25.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField25.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel26.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField26.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));
        document.add(new Paragraph(jLabel27.getText(), tr));
        document.add(
                new Chunk("                                                      " + jTextField27.getText()));
        document.add(new Paragraph(
                "----------------------------------------------------------------------------------------------------------------------------------"));

        document.add(new Paragraph(
                "                                                                                                                                  "));
        document.add(new Paragraph(
                "                                                                                                                                  "));
        document.add(new Paragraph(
                "                                                                                                                                  "));
        document.add(new Paragraph(
                "                                                                                                                                  "));
        document.add(new Paragraph(
                "      Prepared by                                   Checked by                                       Approved by                  "));

        document.close();
        JOptionPane.showMessageDialog(null, "report generated successfully");
    } catch (DocumentException ex) {
        Logger.getLogger(PolishingDivisionView.class.getName()).log(Level.SEVERE, null, ex);
    } catch (FileNotFoundException ex) {
        Logger.getLogger(PolishingDivisionView.class.getName()).log(Level.SEVERE, null, ex);
    }

}

From source file:org.apache.jmeter.visualizers.CreateReport.java

License:Apache License

public void createPdf(String filename, Document document2) throws IOException, DocumentException {
    // step 1/*from   www . java2  s  .  c  o  m*/
    Document document = new Document();
    // step 2
    //  OutputStream outputStream = new OutputStream(new FileOutputStream(filename));
    PdfWriter.getInstance(document, new FileOutputStream(filename));
    // step 3
    document.open();
    // step 4

    Font titleFont = new Font(Font.FontFamily.HELVETICA, 30, Font.BOLD, clr);//BaseColor.Color.getHSBColor(258, 100, 13));
    Paragraph emptyLine = new Paragraph();
    addEmptyLine(emptyLine, 2);
    Paragraph title = new Paragraph("Test Report", titleFont);
    title.setAlignment(Element.ALIGN_CENTER);

    BaseColor BC = new BaseColor(164, 188, 196);

    document.add(title);
    document.add(emptyLine);
    emptyLine = new Paragraph(" ");
    Date dNow = new Date();
    SimpleDateFormat ft = new SimpleDateFormat("E yyyy.MM.dd 'at' hh:mm:ss a zzz");
    //    addEmptyLine(emptyLine, 0);
    document.add(new Paragraph("Report created on : " + ft.format(dNow), small));
    document.add(emptyLine);
    document.add(emptyLine);
    document.add(emptyLine);
    document.add(new Paragraph("Test Summary Report", subFont));
    // document.add(emptyLine);
    PdfPTable table = createTable1();

    PdfPTable table2 = createTable2();
    document.add(new Paragraph(" "));
    document.add(emptyLine);
    document.add(table);
    document.add(emptyLine);
    document.add(emptyLine);
    document.add(emptyLine);
    document.add(new Paragraph("Test Error Report", subFont));
    document.add(emptyLine);
    document.add(emptyLine);
    document.add(table2);
    table.setSpacingBefore(5);
    table.setSpacingAfter(5);
    table2.setSpacingBefore(5);
    table2.setSpacingAfter(5);
    // step 5
    //adding  graphs

    //PdfWriter writer ;
    //  writer = PdfWriter.getInstance(document, outputStream);
    Image[] img = new Image[5];

    img[0] = createGraphs("Average Response Time of samples for each Request", "Average(ms)", 2); // df *add 90%line and no of samples to csv summary model table
    img[1] = createGraphs("Number of samples processed for each Request", "Number of Samples", 2);
    img[2] = createGraphs("Error % of samples for each Request", "Error %", 6);
    img[3] = createGraphs("Throughput of samples for each Request", "Throughput(ms)", 7);
    img[4] = createGraphs("90 % Line of samples for each Request", "90% line(ms)", 2);

    // document.add(image1);

    document.add(img[0]);
    // document.

    //release resources 
    document.close();
    document = null;

}

From source file:org.cherchgk.actions.tournament.result.show.GetPDFTournamentResultAction.java

License:Apache License

private Font getBoldFont() {
    BaseFont baseFont = getBaseFont("DejaVuSerif-Bold.ttf");
    if (baseFont != null) {
        return new Font(baseFont, defaultFontSize);
    }//from  w ww .ja v  a2  s  .c o  m
    return new Font(Font.FontFamily.TIMES_ROMAN, defaultFontSize, Font.BOLD);
}

From source file:org.cidte.sii.negocio.PDFWriter.java

public void writePDF(ArrayList<Writable> list, String directorio, String nombre, java.awt.Image image)
        throws DocumentException, FileNotFoundException, BadElementException, IOException {

    Document doc = new Document();
    PdfWriter docWriter;//  w ww.j  a va 2s  . com

    // special font sizes
    Font bfBold12 = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD, new BaseColor(0, 0, 0));
    Font bf12 = new Font(Font.FontFamily.TIMES_ROMAN, 12);

    // file path
    String path = directorio + nombre + ".pdf";
    docWriter = PdfWriter.getInstance(doc, new FileOutputStream(new File(path)));

    // document header attributes
    doc.addAuthor("sii");
    doc.addCreationDate();
    doc.addProducer();
    doc.addCreator("sii");
    doc.addTitle(nombre);
    doc.setPageSize(PageSize.LETTER);

    // open document
    doc.open();

    Image img = Image.getInstance(image, null);
    img.setAlignment(Element.ALIGN_LEFT);
    doc.add(img);

    // create a paragraph
    Paragraph paragraph = new Paragraph("iText  is a library that allows you to create and "
            + "manipulate PDF documents. It enables developers looking to enhance web and other "
            + "applications with dynamic PDF document generation and/or manipulation.");

    // create PDF table with the given widths
    PdfPTable table = new PdfPTable(list.get(0).getNames().length);
    // set table width a percentage of the page width
    table.setWidthPercentage(100);
    table.setSpacingBefore(10f); // Space before table
    table.setSpacingAfter(10f); // Space after table

    // insert column headings
    String[] headings = list.get(0).getNames();
    for (String heading : headings) {
        insertCell(table, heading, Element.ALIGN_CENTER, 1, bfBold12);
    }
    table.setHeaderRows(1);

    // insert the data
    for (int i = 0; i < list.size(); i++) {
        Writable w = list.get(i);
        Object[] arr = w.getAsArray();
        for (int j = 0; j < arr.length; j++) {
            // arr[j]
            insertCell(table, arr[j].toString(), Element.ALIGN_LEFT, 1, bf12);
        }
    }

    // insert an empty row
    // insertCell(table, "", Element.ALIGN_LEFT, 4, bfBold12);
    // add the PDF table to the paragraph
    paragraph.add(table);
    // add the paragraph to the document
    doc.add(paragraph);

    // close the document
    doc.close();

    // close the writer
    docWriter.close();

}

From source file:org.displaytag.sample.decorators.ItextTotalWrapper.java

License:Open Source License

/**
 * Writes a total line.//from   w  w  w.  j a  v a2s  .  c o  m
 * @param value Total message.
 * @param total Total number.
 */
private void writeTotal(String value, double total) {
    if (assertRequiredState()) {
        this.font = FontFactory.getFont(this.font.getFamilyname(), this.font.getSize(), Font.BOLD,
                this.font.getColor());
        this.table.addCell(this.getCell(""));
        this.table.addCell(this.getCell(""));
        this.table.addCell(this.getCell("-------------"));
        this.table.addCell(this.getCell(""));
        // new row
        this.table.addCell(this.getCell(""));
        this.table.addCell(this.getCell(value + " Total:"));
        this.table.addCell(this.getCell(total + ""));
        this.table.addCell(this.getCell(""));
    }
}

From source file:org.fatec.lpbd.projetocurriculo.controller.CurriculoHelper.java

public static Paragraph titleString(String text) {
    Font f = new Font(FontFamily.COURIER, 20, Font.BOLD);
    Paragraph p = new Paragraph(text, f);
    p.setAlignment(Element.ALIGN_CENTER);
    p.setSpacingAfter(20);/*from   w  w  w  .j  av  a  2  s  . c  om*/
    return p;
}

From source file:org.fatec.lpbd.projetocurriculo.controller.CurriculoHelper.java

public static Paragraph separatorText(String text) {
    Font f = new Font(FontFamily.COURIER, 12, Font.BOLD);
    Paragraph p = new Paragraph(text, f);
    //        p.setSpacingBefore(5);
    p.setSpacingAfter(-15);/*from   w  ww  .j a  v  a2s.  c om*/
    return p;
}

From source file:org.ganttproject.impex.htmlpdf.itext.ThemeImpl.java

License:GNU General Public License

private Font getSansRegularBold(float size) {
    return myFontCache.getFont(getFontName(), getCharset(), Font.BOLD, size);
}