Package com.moebiusgames.pdfbox.table
Class PDFTable
java.lang.Object
com.moebiusgames.pdfbox.table.PDFTable
A simple PDFTable implementation for PDFBox
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic class -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddRow()static PDFTablecreateByRelativeColumnWidth(float tableWidth, float... columnWidthPercent) creates a table according to a given total width of the table and sets the column's with as a pecentage of that widthstatic PDFTablecreateWithSomeFixedColumnWidths(float tableWidth, float... columnWidths) Creates a table with the given total width and fixed widths for the column specified.getColumn(int index) intfloatcalculates the height of the table with the current content (without and top or bottom paddings added).returns the settings that are used as templates for every new pagegetRow(int index) intgetRows()voidrender(PDFRenderContext renderContext, float x) renders this table to the given document and starts at the last page directly under the last rendered elementvoidrender(PDFRenderContext renderContext, float x, float y) renders this table to the given document and starts at the last pagevoidrender(PDFRenderContext renderContext, PDFPageWithStream page, float x, float y) renders this table to the given document and starts at the given page at the given coordinates.voidsetColumnHeadersMode(PDFTable.ColumnHeadersMode columnHeadersMode)
-
Field Details
-
NOT_SET
public static int NOT_SET -
AUTO_DETERMINE_COLUMN_WIDTH
public static final float AUTO_DETERMINE_COLUMN_WIDTH- See Also:
-
NOT_SET_COLOR
-
-
Constructor Details
-
PDFTable
public PDFTable(float... columnWidths)
-
-
Method Details
-
getPageSettings
returns the settings that are used as templates for every new page- Returns:
- returns the page settings
-
getColumnHeadersMode
-
setColumnHeadersMode
-
getColumn
-
getColumns
public int getColumns() -
addRow
-
getRows
public int getRows() -
getRow
-
render
renders this table to the given document and starts at the last page directly under the last rendered element- Parameters:
renderContext- the render context that collects all pagesx- the x position to render the table- Throws:
IOException
-
render
renders this table to the given document and starts at the last page- Parameters:
renderContext- the render context that collects all pagesx- the x position to render the tabley- the y position to render the table- Throws:
IOException
-
render
public void render(PDFRenderContext renderContext, PDFPageWithStream page, float x, float y) throws IOException renders this table to the given document and starts at the given page at the given coordinates.- Parameters:
renderContext- the render context that collects all pagespage- the page to render the table to (not necessarily the last page)x- the x position to render the tabley- the y position to render the table- Throws:
IOException
-
getHeight
calculates the height of the table with the current content (without and top or bottom paddings added). If this exceeds the height of a page, then the table will be wrapped. Note that multiple headings are not accounted for.- Returns:
- returns the height of the table
- Throws:
IOException
-
createByRelativeColumnWidth
creates a table according to a given total width of the table and sets the column's with as a pecentage of that width- Parameters:
tableWidth- the total table widthcolumnWidthPercent- the percentages for the columns- Returns:
- returns a new PDFTable object
-
createWithSomeFixedColumnWidths
Creates a table with the given total width and fixed widths for the column specified. The remainder of the space is split up between the columns that have the value of constant AUTO_DETERMINE_COLUMN_WIDTH.- Parameters:
tableWidth- the total widthcolumnWidths- the fixed widths for the columns- Returns:
- returns a new PDFTable object
-