Example usage for com.itextpdf.text.pdf PdfPTable BASECANVAS

List of usage examples for com.itextpdf.text.pdf PdfPTable BASECANVAS

Introduction

In this page you can find the example usage for com.itextpdf.text.pdf PdfPTable BASECANVAS.

Prototype

int BASECANVAS

To view the source code for com.itextpdf.text.pdf PdfPTable BASECANVAS.

Click Source Link

Document

The index of the original PdfcontentByte.

Usage

From source file:com.vectorprint.report.itext.style.stylers.AdvancedImpl.java

License:Open Source License

/**
 * An advanced styler may be added as event to a table by {@link StyleHelper#style(java.lang.Object, java.lang.Object, java.util.Collection) }
 * when the element styled is a table and the {@link EVENTMODE} is ALL or TABLE. This enables drawing near a table.
 * Calls {@link #draw(com.itextpdf.text.Rectangle, java.lang.String) } with the rectangle of the table and null as genericTag.
 *
 * @see EVENTMODE#TABLE/*ww  w  . j  a  va2 s.  c o  m*/
 * @param table
 * @param widths
 * @param heights
 * @param headerRows
 * @param rowStart
 * @param canvases
 */
@Override
public final void tableLayout(PdfPTable table, float[][] widths, float[] heights, int headerRows, int rowStart,
        PdfContentByte[] canvases) {
    final int footer = widths.length - table.getFooterRows();
    final int header = table.getHeaderRows();
    int columns = widths[header].length - 1;
    float w = widths[header][columns];
    try {
        tableForeground = isBg() ? canvases[PdfPTable.BASECANVAS] : canvases[PdfPTable.TEXTCANVAS];
        draw(new Rectangle(widths[header][0], heights[footer - 1], w, heights[header]), null);
        tableForeground = null;
    } catch (VectorPrintException ex) {
        throw new VectorPrintRuntimeException(ex);
    }
}

From source file:com.vectorprint.report.itext.style.stylers.AdvancedImpl.java

License:Open Source License

/**
 * An advanced styler may be added as event to a cell by {@link StyleHelper#style(java.lang.Object, java.lang.Object, java.util.Collection) }
 * when the element styled is a table and the {@link EVENTMODE} is ALL or CELL. This enables drawing near a cell.
 * Calls {@link #draw(com.itextpdf.text.Rectangle, java.lang.String) } with the rectangle of the cell and null as genericTag. When
 * {@link #USEPADDING} is true the rectangle is calculated taking cell padding into account.
 *
 * @see EVENTMODE#CELL/*from  w  w w.  j  a  v a2  s . c o m*/
 * @param cell
 * @param position
 * @param canvases
 */
@Override
public final void cellLayout(PdfPCell cell, Rectangle position, PdfContentByte[] canvases) {
    try {
        tableForeground = isBg() ? canvases[PdfPTable.BASECANVAS] : canvases[PdfPTable.TEXTCANVAS];
        Rectangle box = getValue(USEPADDING, Boolean.class)
                ? new Rectangle(position.getLeft() + cell.getPaddingLeft(),
                        position.getBottom() + cell.getPaddingBottom(),
                        position.getRight() - cell.getPaddingRight(), position.getTop() - cell.getPaddingTop())
                : position;
        draw(box, null);
        tableForeground = null;
    } catch (VectorPrintException ex) {
        throw new VectorPrintRuntimeException(ex);
    }
}