Example usage for com.lowagie.text Font COURIER

List of usage examples for com.lowagie.text Font COURIER

Introduction

In this page you can find the example usage for com.lowagie.text Font COURIER.

Prototype

int COURIER

To view the source code for com.lowagie.text Font COURIER.

Click Source Link

Document

a possible value of a font family.

Usage

From source file:org.egov.works.web.actions.contractorBill.ContractorBillPDFGenerator.java

License:Open Source License

protected void createCertificate() throws DocumentException {
    final Paragraph headerTextPara = new Paragraph(new Chunk(pdfLabel.get("contractorbill.pdf.contractorbill"),
            new Font(Font.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLD)));
    headerTextPara.setAlignment(Element.ALIGN_CENTER);
    document.add(headerTextPara);/*from  w w  w . j av  a  2 s . com*/
    final Paragraph certificateheaderTextPara = new Paragraph(new Chunk(
            pdfLabel.get("contractorbill.pdf.certificate"), new Font(Font.COURIER, LARGE_FONT, Font.BOLD)));
    certificateheaderTextPara.setAlignment(Element.ALIGN_CENTER);
    document.add(certificateheaderTextPara);
    document.add(spacer());
    document.add(spacer());

    document.add(makePara(pdfLabel.get("contractorbill.pdf.certificatecontent1")));
    document.add(spacer());
    document.add(spacer());

    document.add(rightPara(
            pdfLabel.get("contractorbill.pdf.juniorengineer") + "\t \t\t \t \t \t\t \t\t \t \t \t \t"));
    document.add(spacer());
    document.add(rightPara(pdfLabel.get(dateLabel) + "\t \t \t \t\t \t\t \t \t \t \t\t \t\t \t \t \t \t\t \t\t"
            + "\t \t\t \t\t \t \t \t \t\t \t\t\t\t \t\t \t\t"));
    document.add(spacer());

    document.add(makePara(pdfLabel.get("contractorbill.pdf.certificatecontent2")));
    document.add(spacer());
    document.add(spacer());

    document.add(rightPara(pdfLabel.get("contractorbill.pdf.exeasstengineer") + "\t \t"));
    document.add(spacer());
    document.add(rightPara(pdfLabel.get(dateLabel) + "\t \t \t \t\t \t\t \t \t \t \t\t \t\t \t \t \t \t\t \t\t"
            + "\t \t \t \t\t \t\t \t \t \t \t\t \t\t \t \t \t \t\t \t\t\t \t \t\t\t \t\t \t \t \t \t\t \t\t \t \t \t \t\t \t\t \t \t \t \t\t \t\t"));

    document.add(spacer());

    document.add(makePara(pdfLabel.get("contractorbill.pdf.certificatecontent3")));
    document.add(spacer());
    document.add(makePara(pdfLabel.get("contractorbill.pdf.certificatecontent4")));
    document.add(spacer());

    document.add(makePara(pdfLabel.get("contractorbill.pdf.certificatecontent5")));
    document.add(spacer());
    document.add(spacer());

    document.add(makePara(pdfLabel.get("contractorbill.pdf.certificatecontent6")));

    document.add(spacer());
    document.add(spacer());

    document.add(makePara(pdfLabel.get("contractorbill.pdf.juniorengineer")
            + "\t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t " + tab2 + tab2
            + "\t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t\t \t \t \t \t \t \t \t \t \t \t"
            + pdfLabel.get("contractorbill.pdf.exeasstengineer")));
    document.add(spacer());
    document.add(makePara(pdfLabel.get(dateLabel)
            + "\t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t" + tab2 + tab2
            + "\t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t\t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t"
            + "\t \t \t \t \t \t \t \t " + pdfLabel.get(dateLabel)));
}

From source file:org.inbio.modeling.core.manager.impl.ExportManagerImpl.java

License:Open Source License

private void addImageSection(Document d, String mapName, Long currentSessionId)
        throws BadElementException, MalformedURLException, IOException, DocumentException {

    Image mapImage = Image.getInstance(mapsHome + mapName + "_T_" + currentSessionId + ".png");
    mapImage.scaleToFit(550, 413);/*  w w w.j  av a  2 s  .co m*/
    mapImage.setAlignment(Image.ALIGN_LEFT);

    // scale
    Image scaleImage = Image.getInstance(mapsHome + "scale.jpg");
    scaleImage.scaleToFit(30, 150);
    scaleImage.setAlignment(Image.ALIGN_RIGHT);

    Paragraph images = new Paragraph();
    images.setAlignment(Paragraph.ALIGN_RIGHT);

    //upper scale leyend
    images.add(new Chunk(this.getI18nString("pdfReport.scaleUpper") + "\n\n\n\n\n\n\n",
            new Font(Font.COURIER, 8, Font.BOLDITALIC)));
    // Map
    images.add(new Chunk(mapImage, 1F, 1F));
    // Scale
    images.add(new Chunk(scaleImage, 1F, 1F));
    // lower scale leyend
    images.add(new Chunk("\n" + this.getI18nString("pdfReport.scaleLower") + "\n",
            new Font(Font.COURIER, 8, Font.BOLDITALIC)));

    d.add(images);
}

From source file:org.lucee.extension.pdf.tag.PDF.java

License:Open Source License

private static Font getDefaultFont() {
    Font font = new Font(Font.COURIER);
    font.setSize(10);
    return font;
}

From source file:org.mapfish.print.PDFUtils.java

License:Open Source License

public static BaseFont getBaseFont(String fontFamily, String fontSize, String fontWeight) {
    int myFontValue;
    float myFontSize;
    int myFontWeight;
    if (fontFamily.toUpperCase().contains("COURIER")) {
        myFontValue = Font.COURIER;
    } else if (fontFamily.toUpperCase().contains("HELVETICA")) {
        myFontValue = Font.HELVETICA;
    } else if (fontFamily.toUpperCase().contains("ROMAN")) {
        myFontValue = Font.TIMES_ROMAN;
    } else {// ww w .  j av  a  2  s  .  c o m
        myFontValue = Font.HELVETICA;
    }
    myFontSize = (float) Double.parseDouble(fontSize.toLowerCase().replaceAll("px", ""));
    if (fontWeight.toUpperCase().contains("NORMAL")) {
        myFontWeight = Font.NORMAL;
    } else if (fontWeight.toUpperCase().contains("BOLD")) {
        myFontWeight = Font.BOLD;
    } else if (fontWeight.toUpperCase().contains("ITALIC")) {
        myFontWeight = Font.ITALIC;
    } else {
        myFontWeight = Font.NORMAL;
    }
    Font pdfFont = new Font(myFontValue, myFontSize, myFontWeight);
    BaseFont bf = pdfFont.getCalculatedBaseFont(false);
    return bf;
}

From source file:questions.objects.DifferentLeadings.java

public static void main(String[] args) {
    Document document = new Document(PageSize.A7);
    try {/*from  ww  w .java2s .  c om*/
        PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(RESULT));
        document.open();
        Chunk space = new Chunk(' ');
        String text = "Quick brown fox jumps over the lazy dog.";
        Phrase phrase1 = new Phrase(text, new Font(Font.HELVETICA, 12));
        Phrase phrase2 = new Phrase(new Chunk(text, new Font(Font.TIMES_ROMAN, 24)));
        Phrase phrase3 = new Phrase(text, new Font(Font.COURIER, 8));
        Phrase phrase4 = new Phrase(text, new Font(Font.HELVETICA, 4));
        Paragraph paragraph = new Paragraph();
        paragraph.add(phrase1);
        paragraph.add(space);
        paragraph.add(phrase2);
        paragraph.add(space);
        paragraph.add(phrase3);
        paragraph.add(space);
        paragraph.add(phrase4);
        paragraph.setMultipliedLeading(1.5f);
        paragraph.setAlignment(Element.ALIGN_JUSTIFIED);
        ColumnText column = new ColumnText(writer.getDirectContent());
        column.setSimpleColumn(document.left(), document.bottom(), document.right(), document.top());
        column.addElement(paragraph);
        column.go();
        document.newPage();
        document.add(paragraph);
    } catch (DocumentException de) {
        System.err.println(de.getMessage());
    } catch (IOException ioe) {
        System.err.println(ioe.getMessage());
    }
    document.close();
}

From source file:questions.separators.SeparatedWords1.java

public static void main(String[] args) {
    Document document = new Document();
    try {//from  w  ww . j  av  a 2  s.co m
        PdfWriter.getInstance(document, new FileOutputStream(RESULT));
        document.open();

        Chunk separator = new Chunk(new LineSeparator());

        Paragraph p;
        for (int i = 1000; i < 1040; i++) {
            p = new Paragraph("TEST", new Font(Font.COURIER));
            p.add(separator);
            p.add(new Chunk(String.valueOf(i)));
            p.add(separator);
            p.add(new Chunk(String.valueOf(i + 100)));
            p.add(separator);
            p.add(new Chunk(String.valueOf(i + 200)));
            p.add(separator);
            p.add(new Chunk(String.valueOf(i + 300)));
            document.add(p);
        }
        document.close();
    } catch (Exception de) {
        de.printStackTrace();
    }
}

From source file:util.PDFconverter.java

public static void createPDF(String[] header, String[][] data, String path, String tittle,
        float[] columnWidths) {
    try {/*from w  ww.j  av  a  2 s. c o m*/
        Document doc = new Document();

        PdfWriter.getInstance(doc, new FileOutputStream(path));

        doc.open();
        doc.setPageSize(PageSize.A4);
        doc.setMargins(10, 10, 10, 10);
        Font litle = new Font(Font.COURIER, 7, Font.NORMAL);
        Font norm = new Font(Font.TIMES_ROMAN, 8, Font.NORMAL);
        Font normBold = new Font(Font.TIMES_ROMAN, 8, Font.BOLD);
        Font TitleFont = new Font(Font.TIMES_ROMAN, 12, Font.BOLD);

        doc.add(Chunk.NEWLINE);
        Paragraph judul = new Paragraph(tittle, TitleFont);
        judul.setAlignment(Element.ALIGN_CENTER);
        doc.add(judul);

        //          Paragraph tgl = new Paragraph("tanggal " + tanggal + "\n", TitleFont);            
        //          tgl.setAlignment(Element.ALIGN_CENTER);
        //          doc.add(tgl);
        doc.add(Chunk.NEWLINE);

        PdfPTable table = new PdfPTable(header.length);
        table.setWidthPercentage(100f);

        for (String head : header) {
            table.addCell(new PdfPCell(new Phrase(head, normBold)));
        }

        for (String[] obj : data) {
            for (int i = 0; i < header.length; i++) {
                table.addCell(new PdfPCell(new Phrase(obj[i], norm)));
            }

        }

        //float[] columnWidths = new float[] {10f, 20f, 30f, 10f};
        table.setWidths(columnWidths);

        doc.add(table);

        //            Paragraph stamp = new Paragraph(new Chunk("this report has generated with QCMS by " + System.getProperty("user.name") + " on " + new Date(), litle));
        //            stamp.setAlignment(Element.ALIGN_BOTTOM);
        //            stamp.setAlignment(Element.ALIGN_CENTER);
        //            doc.add(stamp);
        //
        //            Paragraph tanda = new Paragraph(new Chunk("Mengetahui,", norm));
        //            tanda.setSpacingBefore(100);
        //            tanda.setAlignment(Element.ALIGN_RIGHT);
        //            tanda.setAlignment(Element.ALIGN_BOTTOM);
        //            doc.add(tanda);
        //
        //            Paragraph nama = new Paragraph(new Chunk("MANAGER Dept.RnQ", norm));
        //            nama.setSpacingBefore(30);
        //            nama.setAlignment(Element.ALIGN_RIGHT);
        //            nama.setAlignment(Element.ALIGN_BOTTOM);
        //            doc.add(nama);
        doc.close();
    } catch (DocumentException | FileNotFoundException ex) {
        Logger.getLogger(PDFconverter.class.getName()).log(Level.SEVERE, null, ex);
    }

}