Example usage for com.lowagie.text.pdf PdfContentByte endText

List of usage examples for com.lowagie.text.pdf PdfContentByte endText

Introduction

In this page you can find the example usage for com.lowagie.text.pdf PdfContentByte endText.

Prototype

public void endText() 

Source Link

Document

Ends the writing of text and makes the current font invalid.

Usage

From source file:uk.org.rbc1b.roms.controller.volunteer.VolunteerBadgePdfView.java

License:Open Source License

/**
 * Adds the RBC Region's title (e.g. London and the Home Counties) to the
 * bottom of the badge./* w ww  .j  av  a 2s .  c  o  m*/
 *
 * @param content to be added
 * @param rbcRegion RBC region
 */
private static void addRBCRegionFooter(PdfContentByte content) throws DocumentException, IOException {
    content.beginText();
    content.moveText(183, 345);

    BaseFont bf = BaseFont.createFont();
    content.setFontAndSize(bf, 9);
    content.setColorFill(Color.DARK_GRAY);
    content.showText(VolunteerBadgePdfView.BADGE_RBC_REGION);
    content.endText();
}

From source file:uk.org.rbc1b.roms.controller.volunteer.VolunteerBadgePdfView.java

License:Open Source License

/**
 * Adds a department to the Badge. The badge only shows the first
 * departmental assignment of a Volunteer, not all their departmental
 * assignments.// w  w  w.ja v a2  s .c  om
 *
 * @param content to be added
 * @param department of the volunteer
 */
private static void addDepartment(PdfContentByte content, String department)
        throws DocumentException, IOException {
    content.beginText();
    content.moveText(183, 453);

    BaseFont bf = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.CP1257, false);
    content.setFontAndSize(bf, 14);
    content.showText(department);
    content.endText();
}

From source file:wikitopdf.pdf.PdfTitleWrapper.java

License:Open Source License

public final void addPrologue() throws DocumentException {
    PdfContentByte cb = pdfWriter.getDirectContent();
    BaseFont times = null;//from   ww w .j  a  v a  2s . c om

    try {
        wikiFontSelector.getTitleFontSelector().process("");
        times = wikiFontSelector.getCommonFont().getBaseFont();
    } catch (Exception ex) {
        ex.printStackTrace();
    }

    cb.beginText();

    cb.setFontAndSize(times, 32);
    cb.setTextMatrix(pdfDocument.right() - 130, 500);
    cb.showText("Wikipedia");
    cb.endText();
    cb.beginText();
    cb.setFontAndSize(times, 8);
    cb.setTextMatrix(pdfDocument.right() - 50, 490);
    cb.showText("table of contents");

    cb.endText();

    String copyrightText = "Copyright (c) 2013 WIKIMEDIA FOUNDATION. \r\n"
            + "Permission is granted to copy, distribute and/or modify this document under the \r\n"
            + "terms of the GNU Free Documentation License, Version 1.2 or any later version \r\n"
            + "published by the Free Software Foundation; with no Invariant Sections, no \r\n"
            + "Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included \r\n"
            + "in the section entitled \"GNU Free Documentation License\".";

    cb.beginText();
    cb.setFontAndSize(times, 8);

    String[] textArr = copyrightText.split("\r\n");
    for (int i = 0; i < textArr.length; i++) {
        cb.setTextMatrix(pdfDocument.left() - 10, 100 - (i * 10));
        cb.showText(textArr[i]);
    }
    cb.endText();
    pdfDocument.newPage();
    cb.beginText();
    cb.setFontAndSize(times, 8);
    cb.setTextMatrix(pdfDocument.left() - 19, 100);
    cb.showText("");
    cb.endText();

}