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

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

Introduction

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

Prototype

public void setColorFill(Color color) 

Source Link

Document

Sets the fill color.

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.//from   ww w  .ja  va2 s  .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 Barcode39 of the id number of a Volunteer to the Badge.
 *
 * @param content to be added//from w ww.  j ava 2s .c  om
 * @param id volunteer id
 * @throws DocumentException
 * @throws IOException
 */
private static void addBarcode(PdfContentByte contentByte, Integer id) throws IOException, DocumentException {
    Barcode39 barcode = new Barcode39();
    BaseFont baseFont = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.EMBEDDED);
    barcode.setFont(baseFont);
    barcode.setSize(6);
    barcode.setCode(id.toString());
    contentByte.setColorFill(Color.BLACK);
    Image baecodeImg = barcode.createImageWithBarcode(contentByte, null, null);
    contentByte.addImage(baecodeImg, 75, 0, 0, 35, 338, 344);
}