List of usage examples for com.lowagie.text.pdf PdfPTable BACKGROUNDCANVAS
int BACKGROUNDCANVAS
To view the source code for com.lowagie.text.pdf PdfPTable BACKGROUNDCANVAS.
Click Source Link
PdfContentByte
where the background will be drawn. 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); } }