Example usage for com.itextpdf.text Paragraph setLeading

List of usage examples for com.itextpdf.text Paragraph setLeading

Introduction

In this page you can find the example usage for com.itextpdf.text Paragraph setLeading.

Prototype

public void setLeading(final float fixedLeading) 

Source Link

Usage

From source file:pipe.PdfMaker.java

private Element eightthElement(String applikation, String tabak) {
    float leading = 9f;
    PdfPTable table = new PdfPTable(2);
    table.setWidthPercentage(100f);/*from   w  w  w  .  j  a  v a  2  s.  c  om*/
    PdfPCell cell;

    cell = new PdfPCell(new Paragraph("Applikation", arialSmall));
    cell.setPadding(2);
    cell.setGrayFill(0.85f);
    cell.setBorderWidth(0.3f);
    table.addCell(cell);

    cell = new PdfPCell(new Paragraph("Eingerauchter Tabak", arialSmall));
    cell.setPadding(2);
    cell.setBorderWidth(0.3f);
    cell.setGrayFill(0.85f);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setPadding(2);
    cell.setBorderWidth(0.3f);
    cell.setFixedHeight(30f);
    Paragraph mundMatInfo = new Paragraph(applikation, courier);
    mundMatInfo.setLeading(leading);
    cell.addElement(mundMatInfo);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setPadding(2);
    cell.setBorderWidth(0.3f);
    cell.setFixedHeight(30f);
    Paragraph modellInfo = new Paragraph(tabak, courier);
    modellInfo.setLeading(leading);
    cell.addElement(modellInfo);
    table.addCell(cell);

    return table;
}

From source file:pipe.PdfMaker.java

private Element ninethElement(String kaufpreis, String gekauft_bei, String datum) {
    float leading = 9f;
    PdfPTable table = new PdfPTable(3);
    table.setWidthPercentage(100f);/* ww  w . ja  va2s .  c om*/
    PdfPCell cell;
    //Hier die Header zuerst
    cell = new PdfPCell(new Paragraph("Einstandspreis", arialSmall));
    cell.setPadding(2);
    cell.setGrayFill(0.85f);
    cell.setBorderWidth(0.3f);
    table.addCell(cell);

    cell = new PdfPCell(new Paragraph("Gekauft bei / von", arialSmall));
    cell.setPadding(2);
    cell.setGrayFill(0.85f);
    cell.setBorderWidth(0.3f);
    table.addCell(cell);

    cell = new PdfPCell(new Paragraph("Kaufdatum", arialSmall));
    cell.setPadding(2);
    cell.setGrayFill(0.85f);
    cell.setBorderWidth(0.3f);
    table.addCell(cell);

    //Ab hier die Werte
    cell = new PdfPCell();
    cell.setPadding(2);
    cell.setBorderWidth(0.3f);
    Paragraph herkunftInfo = new Paragraph(kaufpreis, courier);
    herkunftInfo.setLeading(leading);
    cell.addElement(herkunftInfo);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setPadding(2);
    cell.setBorderWidth(0.3f);
    Paragraph editionInfo = new Paragraph(gekauft_bei, courier);
    editionInfo.setLeading(leading);
    cell.addElement(editionInfo);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setBorderWidth(0.3f);
    cell.setFixedHeight(30f);
    Paragraph yearInfo = new Paragraph(datum, courier);
    yearInfo.setLeading(leading);
    cell.addElement(yearInfo);
    table.addCell(cell);

    return table;
}

From source file:pipe.PdfMaker.java

private Element tenthElement(String verkaufspreis, String verkauft_an, String datum) {
    float leading = 9f;
    PdfPTable table = new PdfPTable(3);
    table.setWidthPercentage(100f);//from www  . j  ava 2 s  .c  om
    PdfPCell cell;
    //Hier die Header zuerst
    cell = new PdfPCell(new Paragraph("Verkaufspreis", arialSmall));
    cell.setPadding(2);
    cell.setGrayFill(0.85f);
    cell.setBorderWidth(0.3f);
    table.addCell(cell);

    cell = new PdfPCell(new Paragraph("Verkauft an", arialSmall));
    cell.setPadding(2);
    cell.setGrayFill(0.85f);
    cell.setBorderWidth(0.3f);
    table.addCell(cell);

    cell = new PdfPCell(new Paragraph("Verkaufsdatum", arialSmall));
    cell.setPadding(2);
    cell.setGrayFill(0.85f);
    cell.setBorderWidth(0.3f);
    table.addCell(cell);

    //Ab hier die Werte
    cell = new PdfPCell();
    cell.setPadding(2);
    cell.setBorderWidth(0.3f);
    Paragraph herkunftInfo = new Paragraph(verkaufspreis, courier);
    herkunftInfo.setLeading(leading);
    cell.addElement(herkunftInfo);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setPadding(2);
    cell.setBorderWidth(0.3f);
    Paragraph editionInfo = new Paragraph(verkauft_an, courier);
    editionInfo.setLeading(leading);
    cell.addElement(editionInfo);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setBorderWidth(0.3f);
    cell.setFixedHeight(30f);
    Paragraph yearInfo = new Paragraph(datum, courier);
    yearInfo.setLeading(leading);
    cell.addElement(yearInfo);
    table.addCell(cell);

    return table;
}

From source file:pipe.PdfMaker.java

private Element eleventhElement(String oberflaeche, String bohrung, String filter) {
    float leading = 9f;
    PdfPTable table = new PdfPTable(3);
    table.setWidthPercentage(100f);//from  w  w  w .j  a va 2s.c  om
    PdfPCell cell;
    //Hier die Header zuerst
    cell = new PdfPCell(new Paragraph("Oberflche", arialSmall));
    cell.setPadding(2);
    cell.setGrayFill(0.85f);
    cell.setBorderWidth(0.3f);
    table.addCell(cell);

    cell = new PdfPCell(new Paragraph("Bohrung", arialSmall));
    cell.setPadding(2);
    cell.setGrayFill(0.85f);
    cell.setBorderWidth(0.3f);
    table.addCell(cell);

    cell = new PdfPCell(new Paragraph("Filter", arialSmall));
    cell.setPadding(2);
    cell.setGrayFill(0.85f);
    cell.setBorderWidth(0.3f);
    table.addCell(cell);

    //Ab hier die Werte
    cell = new PdfPCell();
    cell.setPadding(2);
    cell.setBorderWidth(0.3f);
    Paragraph herkunftInfo = new Paragraph(oberflaeche, courier);
    herkunftInfo.setLeading(leading);
    cell.addElement(herkunftInfo);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setPadding(2);
    cell.setBorderWidth(0.3f);
    Paragraph editionInfo = new Paragraph(bohrung, courier);
    editionInfo.setLeading(leading);
    cell.addElement(editionInfo);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setBorderWidth(0.3f);
    cell.setFixedHeight(18f);
    Paragraph yearInfo = new Paragraph(filter, courier);
    yearInfo.setLeading(leading);
    cell.addElement(yearInfo);
    table.addCell(cell);

    return table;
}

From source file:pipe.PdfMaker.java

private Element twelvethElement(String laenge, String kopfhoehe, String kopfdurchmesser) {
    float leading = 9f;
    PdfPTable table = new PdfPTable(3);
    table.setWidthPercentage(100f);/*from ww w  .j  av  a  2  s .  co m*/
    PdfPCell cell;
    //Hier die Header zuerst
    cell = new PdfPCell(new Paragraph("Lnge", arialSmall));
    cell.setPadding(2);
    cell.setGrayFill(0.85f);
    cell.setBorderWidth(0.3f);
    table.addCell(cell);

    cell = new PdfPCell(new Paragraph("Kopfhhe", arialSmall));
    cell.setPadding(2);
    cell.setGrayFill(0.85f);
    cell.setBorderWidth(0.3f);
    table.addCell(cell);

    cell = new PdfPCell(new Paragraph("Kopfdurchmesser", arialSmall));
    cell.setPadding(2);
    cell.setGrayFill(0.85f);
    cell.setBorderWidth(0.3f);
    table.addCell(cell);

    //Ab hier die Werte
    cell = new PdfPCell();
    cell.setPadding(2);
    cell.setBorderWidth(0.3f);
    Paragraph herkunftInfo = new Paragraph(laenge, courier);
    herkunftInfo.setLeading(leading);
    cell.addElement(herkunftInfo);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setPadding(2);
    cell.setBorderWidth(0.3f);
    Paragraph editionInfo = new Paragraph(kopfhoehe, courier);
    editionInfo.setLeading(leading);
    cell.addElement(editionInfo);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setBorderWidth(0.3f);
    cell.setFixedHeight(18f);
    Paragraph yearInfo = new Paragraph(kopfdurchmesser, courier);
    yearInfo.setLeading(leading);
    cell.addElement(yearInfo);
    table.addCell(cell);

    return table;
}

From source file:pipe.PdfMaker.java

private Element thirteenthElement(String gewicht, String farbe) {
    float leading = 9f;
    PdfPTable table = new PdfPTable(2);
    table.setWidthPercentage(100f);//from   w  ww  .j av  a 2 s .  co  m
    PdfPCell cell;

    cell = new PdfPCell(new Paragraph("Gewicht", arialSmall));
    cell.setPadding(2);
    cell.setGrayFill(0.85f);
    cell.setBorderWidth(0.3f);
    table.addCell(cell);

    cell = new PdfPCell(new Paragraph("Farbe", arialSmall));
    cell.setPadding(2);
    cell.setBorderWidth(0.3f);
    cell.setGrayFill(0.85f);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setPadding(2);
    cell.setBorderWidth(0.3f);
    cell.setFixedHeight(18f);
    Paragraph mundMatInfo = new Paragraph(gewicht, courier);
    mundMatInfo.setLeading(leading);
    cell.addElement(mundMatInfo);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setPadding(2);
    cell.setBorderWidth(0.3f);
    cell.setFixedHeight(18f);
    Paragraph modellInfo = new Paragraph(farbe, courier);
    modellInfo.setLeading(leading);
    cell.addElement(modellInfo);
    table.addCell(cell);

    return table;
}

From source file:pipe.PdfMaker.java

private Element fourteenthElement(String zustand, String lagerort) {
    float leading = 9f;
    PdfPTable table = new PdfPTable(2);
    table.setWidthPercentage(100f);/*from  w w w . j a v a  2  s . c  o  m*/
    PdfPCell cell;

    cell = new PdfPCell(new Paragraph("Zustand", arialSmall));
    cell.setPadding(2);
    cell.setGrayFill(0.85f);
    cell.setBorderWidth(0.3f);
    table.addCell(cell);

    cell = new PdfPCell(new Paragraph("Lagerort", arialSmall));
    cell.setPadding(2);
    cell.setBorderWidth(0.3f);
    cell.setGrayFill(0.85f);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setPadding(2);
    cell.setBorderWidth(0.3f);
    cell.setFixedHeight(18f);
    Paragraph mundMatInfo = new Paragraph(zustand, courier);
    mundMatInfo.setLeading(leading);
    cell.addElement(mundMatInfo);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setPadding(2);
    cell.setBorderWidth(0.3f);
    cell.setFixedHeight(18f);
    Paragraph modellInfo = new Paragraph(lagerort, courier);
    modellInfo.setLeading(leading);
    cell.addElement(modellInfo);
    table.addCell(cell);

    return table;
}

From source file:pipe.PdfMaker.java

private Element fifteenthElement(String besonderes) {
    float leading = 9f;
    PdfPTable table = new PdfPTable(1);
    table.setWidthPercentage(100f);//from w  w w.  ja va2  s .  c o  m
    PdfPCell cell;

    cell = new PdfPCell(new Paragraph("Besonderes", arialSmall));
    cell.setPadding(2);
    cell.setGrayFill(0.85f);
    cell.setBorderWidth(0.3f);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.setPadding(2);
    cell.setBorderWidth(0.3f);
    cell.setFixedHeight(30f);
    Paragraph herstellerInfo = new Paragraph(besonderes, courier);
    herstellerInfo.setLeading(leading);
    cell.addElement(herstellerInfo);
    table.addCell(cell);

    return table;
}

From source file:util.ImageExample.java

public ImageExample(Calendar date, int settings, ArrayList<String> courses, String time, String eventAddress,
        int totalPrice, String comments, boolean kunde) throws Exception {
    this.date = date;
    this.settings = settings;
    this.courses = courses;
    this.time = time;
    this.eventAddress = eventAddress;
    this.totalPrice = totalPrice;
    this.comments = comments;
    this.fileName = "";
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    ge.getAllFonts();/*from   w ww  .jav  a2s  .c o m*/
    FontFactory.register("C:/Windows/Fonts/ARLRDBD.TTF", "Arial Rounded");
    Font font = FontFactory.getFont("Arial Rounded", 22, Font.NORMAL, new BaseColor(51, 102, 102));
    Document document = new Document();

    System.out.println("Pdf creation startet");
    try {
        if (kunde) {
            fileName = "grill" + new SimpleDateFormat("dd. MMMMM yyyy hhmm").format(date.getTime()) + ".pdf";
        } else {
            fileName = "grill" + new SimpleDateFormat("dd. MMMMM yyyy hhmm").format(date.getTime())
                    + "Prisliste.pdf";
        }

        FileOutputStream file = new FileOutputStream(new File("C:/Users/Mark/Desktop", fileName));
        PdfWriter writer = PdfWriter.getInstance(document, file);
        document.open();

        Image img = Image.getInstance("src/pictures/cirkles.png");
        img.scaleToFit(277, 277);
        img.setAbsolutePosition(40, PageSize.A4.getHeight() - img.getHeight());
        document.add(img);
        Chunk chunk = new Chunk("Grillmester 'Frankie'", font);
        chunk.setCharacterSpacing(3);
        Paragraph header = new Paragraph(chunk);
        header.setAlignment(Element.ALIGN_RIGHT);
        header.setSpacingBefore(15);
        document.add(header);
        Paragraph title = new Paragraph(
                "Tilbud angende d. " + new SimpleDateFormat("dd. MMMMM yyyy").format(date.getTime()) + ".",
                new Font(Font.FontFamily.TIMES_ROMAN, 20, Font.BOLD));
        title.setAlignment(Element.ALIGN_LEFT);
        title.setIndentationLeft(235);
        title.setSpacingBefore(100);
        title.setLeading(17);
        document.add(title);
        Paragraph subtitle = new Paragraph("(Arrangement til " + settings + " personer).",
                new Font(Font.FontFamily.TIMES_ROMAN, 18, Font.ITALIC));
        subtitle.setAlignment(Element.ALIGN_LEFT);
        subtitle.setIndentationLeft(235);
        subtitle.setLeading(17);
        document.add(subtitle);
        Paragraph body = new Paragraph("\n\nDer er aftalt:\n\n", new Font(Font.FontFamily.TIMES_ROMAN, 18));
        body.setAlignment(Element.ALIGN_LEFT);
        body.setIndentationLeft(235);
        body.setLeading(17);
        for (String course : courses) {
            body.add(course + "\n\n");
        }
        body.add("\nServeres klokken " + time + " i " + eventAddress + ".");
        document.add(body);
        Paragraph ending = new Paragraph("\n\n\nPris: " + totalPrice + ",-kr.",
                new Font(Font.FontFamily.TIMES_ROMAN, 18, Font.BOLD));
        ending.setAlignment(Element.ALIGN_LEFT);
        ending.setIndentationLeft(235);
        ending.setLeading(17);
        document.add(ending);
        if (!comments.equals("null")) {
            if (!comments.equals("")) {
                Paragraph comment = new Paragraph("\n\nKommentarer\n" + comments,
                        new Font(Font.FontFamily.TIMES_ROMAN, 18));
                comment.setAlignment(Element.ALIGN_LEFT);
                comment.setIndentationLeft(235);
                comment.setLeading(17);
                document.add(comment);
            }
        }

        Image footerImg = Image.getInstance("src/pictures/grillmester.png");
        footerImg.scaleToFit(210, 210);
        footerImg.setAbsolutePosition(40, 40);
        document.add(footerImg);

        Image img2 = Image.getInstance("src/pictures/Contact.png");
        img2.scaleToFit(250, 250);
        img2.setAbsolutePosition(20, PageSize.A4.getHeight() - img.getHeight() - 250);
        document.add(img2);

        document.close();

        System.out.println("Pdf finish");
    } catch (Exception e) {
        e.printStackTrace();
        System.out.println(e.getLocalizedMessage());
    }
}