本文整理汇总了Java中com.lowagie.text.pdf.PdfPTable.TEXTCANVAS属性的典型用法代码示例。如果您正苦于以下问题:Java PdfPTable.TEXTCANVAS属性的具体用法?Java PdfPTable.TEXTCANVAS怎么用?Java PdfPTable.TEXTCANVAS使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.lowagie.text.pdf.PdfPTable
的用法示例。
在下文中一共展示了PdfPTable.TEXTCANVAS属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: cellLayout
/**
* @see com.lowagie.text.pdf.PdfPCellEvent#cellLayout(com.lowagie.text.pdf.PdfPCell,
* com.lowagie.text.Rectangle, com.lowagie.text.pdf.PdfContentByte[])
*/
public void cellLayout(PdfPCell cell, Rectangle position, PdfContentByte[] canvases) {
PdfContentByte cb = canvases[PdfPTable.TEXTCANVAS];
cb.moveTo(position.getLeft(), position.getBottom());
cb.lineTo(position.getRight(), position.getTop());
cb.stroke();
}
示例2: tableLayout
/**
* @see com.lowagie.text.pdf.PdfPTableEvent#tableLayout(com.lowagie.text.pdf.PdfPTable, float[][], float[], int, int, com.lowagie.text.pdf.PdfContentByte[])
*/
public void tableLayout(PdfPTable table, float[][] width, float[] heights, int headerRows, int rowStart, PdfContentByte[] canvases) {
// widths of the different cells of the first row
float widths[] = width[0];
PdfContentByte cb = canvases[PdfPTable.TEXTCANVAS];
cb.saveState();
// border for the complete table
cb.setLineWidth(2);
cb.setRGBColorStroke(255, 0, 0);
cb.rectangle(widths[0], heights[heights.length - 1], widths[widths.length - 1] - widths[0], heights[0] - heights[heights.length - 1]);
cb.stroke();
// border for the header rows
if (headerRows > 0) {
cb.setRGBColorStroke(0, 0, 255);
cb.rectangle(widths[0], heights[headerRows], widths[widths.length - 1] - widths[0], heights[0] - heights[headerRows]);
cb.stroke();
}
cb.restoreState();
cb = canvases[PdfPTable.BASECANVAS];
cb.saveState();
// border for the cells
cb.setLineWidth(.5f);
// loop over the rows
for (int line = 0; line < heights.length - 1; ++line) {
widths = width[line];
// loop over the columns
for (int col = 0; col < widths.length - 1; ++col) {
if (line == 0 && col == 0)
cb.setAction(new PdfAction("http://www.lowagie.com/iText/"),
widths[col], heights[line + 1], widths[col + 1], heights[line]);
cb.setRGBColorStrokeF((float)Math.random(), (float)Math.random(), (float)Math.random());
// horizontal borderline
cb.moveTo(widths[col], heights[line]);
cb.lineTo(widths[col + 1], heights[line]);
cb.stroke();
// vertical borderline
cb.setRGBColorStrokeF((float)Math.random(), (float)Math.random(), (float)Math.random());
cb.moveTo(widths[col], heights[line]);
cb.lineTo(widths[col], heights[line + 1]);
cb.stroke();
}
}
cb.restoreState();
}
示例3: tableLayout
/**
* @see com.lowagie.text.pdf.PdfPTableEvent#tableLayout(com.lowagie.text.pdf.PdfPTable,
* float[][], float[], int, int, com.lowagie.text.pdf.PdfContentByte[])
*/
public void tableLayout(PdfPTable table, float[][] width, float[] heights, int headerRows, int rowStart,
PdfContentByte[] canvases) {
// widths of the different cells of the first row
float widths[] = width[0];
PdfContentByte cb = canvases[PdfPTable.TEXTCANVAS];
cb.saveState();
// border for the complete table
cb.setLineWidth(2);
cb.setRGBColorStroke(255, 0, 0);
cb.rectangle(widths[0], heights[heights.length - 1], widths[widths.length - 1] - widths[0], heights[0]
- heights[heights.length - 1]);
cb.stroke();
// border for the header rows
if (headerRows > 0) {
cb.setRGBColorStroke(0, 0, 255);
cb.rectangle(widths[0], heights[headerRows], widths[widths.length - 1] - widths[0], heights[0]
- heights[headerRows]);
cb.stroke();
}
cb.restoreState();
cb = canvases[PdfPTable.BASECANVAS];
cb.saveState();
// border for the cells
cb.setLineWidth(.5f);
// loop over the rows
for (int line = 0; line < heights.length - 1; ++line) {
// loop over the columns
for (int col = 0; col < widths.length - 1; ++col) {
if (line == 0 && col == 0)
cb.setAction(new PdfAction("http://www.lowagie.com/iText/"), widths[col], heights[line + 1],
widths[col + 1], heights[line]);
cb.setRGBColorStrokeF((float) Math.random(), (float) Math.random(), (float) Math.random());
// horizontal borderline
cb.moveTo(widths[col], heights[line]);
cb.lineTo(widths[col + 1], heights[line]);
cb.stroke();
// vertical borderline
cb.setRGBColorStrokeF((float) Math.random(), (float) Math.random(), (float) Math.random());
cb.moveTo(widths[col], heights[line]);
cb.lineTo(widths[col], heights[line + 1]);
cb.stroke();
}
}
cb.restoreState();
}
示例4: tableLayout
/**
* @see com.lowagie.text.pdf.PdfPTableEvent#tableLayout(com.lowagie.text.pdf.PdfPTable,
* float[][], float[], int, int, com.lowagie.text.pdf.PdfContentByte[])
*/
public void tableLayout(PdfPTable table, float[][] width, float[] heights, int headerRows, int rowStart,
PdfContentByte[] canvases) {
// widths of the different cells of the first row
float widths[] = width[0];
PdfContentByte cb = canvases[PdfPTable.TEXTCANVAS];
cb.saveState();
// border for the complete table
cb.setLineWidth(2);
cb.setRGBColorStroke(255, 0, 0);
cb.rectangle(widths[0], heights[heights.length - 1], widths[widths.length - 1] - widths[0], heights[0]
- heights[heights.length - 1]);
cb.stroke();
// border for the header rows
if (headerRows > 0) {
float headerHeight = heights[0];
for (int k = 0; k < headerRows; ++k)
headerHeight += heights[k];
cb.setRGBColorStroke(0, 0, 255);
cb.rectangle(widths[0], heights[headerRows], widths[widths.length - 1] - widths[0], heights[0]
- heights[headerRows]);
cb.stroke();
}
cb.restoreState();
cb = canvases[PdfPTable.BASECANVAS];
cb.saveState();
// border for the cells
cb.setLineWidth(.5f);
// loop over the rows
for (int line = 0; line < heights.length - 1; ++line) {
// loop over the columns
for (int col = 0; col < widths.length - 1; ++col) {
if (line == 0 && col == 0)
cb.setAction(new PdfAction("http://www.lowagie.com/iText/"), widths[col], heights[line + 1],
widths[col + 1], heights[line]);
cb.setRGBColorStrokeF((float) Math.random(), (float) Math.random(), (float) Math.random());
// horizontal borderline
cb.moveTo(widths[col], heights[line]);
cb.lineTo(widths[col + 1], heights[line]);
cb.stroke();
// vertical borderline
cb.setRGBColorStrokeF((float) Math.random(), (float) Math.random(), (float) Math.random());
cb.moveTo(widths[col], heights[line]);
cb.lineTo(widths[col], heights[line + 1]);
cb.stroke();
}
}
cb.restoreState();
}
示例5: tableLayout
/**
* @see com.lowagie.text.pdf.PdfPTableEvent#tableLayout(com.lowagie.text.pdf.PdfPTable,
* float[][], float[], int, int, com.lowagie.text.pdf.PdfContentByte[])
*/
public void tableLayout(PdfPTable table, float[][] width, float[] heights, int headerRows, int rowStart,
PdfContentByte[] canvases) {
// widths of the different cells of the first row
float widths[] = width[0];
PdfContentByte cb = canvases[PdfPTable.TEXTCANVAS];
cb.saveState();
// border for the complete table
cb.setLineWidth(2);
cb.setRGBColorStroke(255, 0, 0);
cb.rectangle(widths[0], heights[heights.length - 1], widths[widths.length - 1] - widths[0], heights[0]
- heights[heights.length - 1]);
cb.stroke();
// border for the header rows
if (headerRows > 0) {
float headerHeight = heights[0];
for (int k = 0; k < headerRows; ++k)
headerHeight += heights[k];
cb.setRGBColorStroke(0, 0, 255);
cb.rectangle(widths[0], heights[headerRows], widths[widths.length - 1] - widths[0], heights[0]
- heights[headerRows]);
cb.stroke();
}
cb.restoreState();
cb = canvases[PdfPTable.BASECANVAS];
cb.saveState();
// border for the cells
cb.setLineWidth(.5f);
// loop over the rows
for (int line = 0; line < heights.length - 1; ++line) {
widths = width[line];
// loop over the columns
for (int col = 0; col < widths.length - 1; ++col) {
if (line == 0 && col == 0)
cb.setAction(new PdfAction("http://www.lowagie.com/iText/"), widths[col], heights[line + 1],
widths[col + 1], heights[line]);
cb.setRGBColorStrokeF((float) Math.random(), (float) Math.random(), (float) Math.random());
// horizontal borderline
cb.moveTo(widths[col], heights[line]);
cb.lineTo(widths[col + 1], heights[line]);
cb.stroke();
// vertical borderline
cb.setRGBColorStrokeF((float) Math.random(), (float) Math.random(), (float) Math.random());
cb.moveTo(widths[col], heights[line]);
cb.lineTo(widths[col], heights[line + 1]);
cb.stroke();
}
}
cb.restoreState();
}