Example usage for com.lowagie.text.pdf PdfPTable BACKGROUNDCANVAS

List of usage examples for com.lowagie.text.pdf PdfPTable BACKGROUNDCANVAS

Introduction

In this page you can find the example usage for com.lowagie.text.pdf PdfPTable BACKGROUNDCANVAS.

Prototype

int BACKGROUNDCANVAS

To view the source code for com.lowagie.text.pdf PdfPTable BACKGROUNDCANVAS.

Click Source Link

Document

The index of the duplicate PdfContentByte where the background will be drawn.

Usage

From source file:questions.tables.AlternateBackground.java

public void tableLayout(PdfPTable table, float[][] widths, float[] heights, int headerRows, int rowStart,
        PdfContentByte[] canvases) {/*  w w w  .jav  a  2s .c om*/
    int rows = widths.length;
    int columns;
    Rectangle rect;
    for (int row = headerRows + 1; row < rows; row += 2) {
        columns = widths[row].length - 1;
        rect = new Rectangle(widths[row][0], heights[row], widths[row][columns], heights[row + 1]);
        rect.setBackgroundColor(Color.YELLOW);
        rect.setBorder(Rectangle.NO_BORDER);
        canvases[PdfPTable.BACKGROUNDCANVAS].rectangle(rect);

    }
}