public class PdfManipulator
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
BOLD_ATTRIBUTE
The attribute name that will indicate the bold effect for contained text
|
static java.lang.String |
COLUMN_NUMBER_ATTRIBUTE
The attribute name that will indicate the column number
|
static java.util.Comparator<org.jdom2.Element> |
COLUMN_ORDER
Comparator to sort elements by column number
|
static java.lang.String |
END_COLUMN_NUMBER_ATTRIBUTE
The attribute name that will indicate the end column number.
|
static java.lang.String |
FONT_COLOR_ATTRIBUTE
The attribute name that will indicate the font color for the contained text
|
static java.lang.String |
FONT_FAMILY_ATTRIBUTE
The attribute name that will indicate the font family for the contained text
|
static java.lang.String |
FONT_SIZE_ATTRIBUTE
The attribute name that will indicate the font size for the contained text
|
static java.lang.String |
ITALIC_ATTRIBUTE
The attribute name that will indicate the italic effect for contained text
|
java.util.Comparator<org.jdom2.Element> |
LEFT_TO_RIGHT_ORDER
Comparator to sort elements by left value with the tolerance for this manipulator
|
static java.util.Comparator<org.jdom2.Element> |
LEFT_TO_RIGHT_ORDER_NO_TOLERANCE
Comparator to sort elements by left value
|
static java.lang.String |
PAGE_NUMBER_ATTRIBUTE
The attribute name that will indicate the page number
|
static java.util.Comparator<org.jdom2.Element> |
PAGE_ORDER
Comparator to sort elements by page number
|
java.util.Comparator<org.jdom2.Element> |
TOP_ORDER
Comparator to sort elements by top value with the tolerance for this manipulator
|
static java.util.Comparator<org.jdom2.Element> |
TOP_ORDER_NO_TOLERANCE
Comparator to sort elements by top value
|
java.util.Comparator<org.jdom2.Element> |
TOP_TO_RIGHT_ORDER
Comparator to sort elements by top value, then left value (top to bottom, left to right) with the tolerance for this manipulator
|
static java.util.Comparator<org.jdom2.Element> |
TOP_TO_RIGHT_ORDER_NO_TOLERANCE
Comparator to sort elements by top value, then left value (top to bottom, left to right)
|
static java.lang.String |
UNDERLINE_ATTRIBUTE
The attribute name that will indicate the underline effect for contained text
|
Constructor and Description |
---|
PdfManipulator(boolean preserveFontFaceInformation,
boolean convertPageBlockToAttribute,
boolean convertFontStylesToAttributes,
boolean sortElements,
boolean sortRowOrder,
java.lang.Boolean resortBlocksRowOrder,
boolean splitIntoColumns,
boolean removeItemsNotInColumns,
boolean sortBeforePageAndTextValidation,
boolean preserveImages,
int whiteSpaceDividerHeightAmount,
int locationTolerance,
PdfPageValidator pageValidator,
PdfPageValidator postColumnsPageValidator,
PdfTextValidator textValidator,
PdfBlockMergeChecker blockMergeChecker,
PdfColumnDeterminer columnDeterminer,
java.util.Map<java.lang.Integer,java.lang.Integer> predeterminedColumnLocationsAndWidths,
int maxColumnSpan,
boolean removeEmptyTextElements)
Create the manipulator
|
Modifier and Type | Method and Description |
---|---|
org.jdom2.Element |
process(org.jdom2.Element element)
Perform the desired operations on the element.
|
org.jdom2.Element |
process(org.jdom2.Element element,
boolean cloneElementFirst)
Perform the desired operations on the element.
|
public static final java.lang.String PAGE_NUMBER_ATTRIBUTE
public static final java.lang.String COLUMN_NUMBER_ATTRIBUTE
public static final java.lang.String END_COLUMN_NUMBER_ATTRIBUTE
public static final java.lang.String FONT_SIZE_ATTRIBUTE
public static final java.lang.String FONT_FAMILY_ATTRIBUTE
public static final java.lang.String FONT_COLOR_ATTRIBUTE
public static final java.lang.String BOLD_ATTRIBUTE
public static final java.lang.String ITALIC_ATTRIBUTE
public static final java.lang.String UNDERLINE_ATTRIBUTE
public static final java.util.Comparator<org.jdom2.Element> PAGE_ORDER
public static final java.util.Comparator<org.jdom2.Element> COLUMN_ORDER
public static final java.util.Comparator<org.jdom2.Element> TOP_ORDER_NO_TOLERANCE
public static final java.util.Comparator<org.jdom2.Element> LEFT_TO_RIGHT_ORDER_NO_TOLERANCE
public static final java.util.Comparator<org.jdom2.Element> TOP_TO_RIGHT_ORDER_NO_TOLERANCE
public final java.util.Comparator<org.jdom2.Element> TOP_ORDER
public final java.util.Comparator<org.jdom2.Element> LEFT_TO_RIGHT_ORDER
public final java.util.Comparator<org.jdom2.Element> TOP_TO_RIGHT_ORDER
PdfManipulator(boolean preserveFontFaceInformation, boolean convertPageBlockToAttribute, boolean convertFontStylesToAttributes, boolean sortElements, boolean sortRowOrder, @Nullable java.lang.Boolean resortBlocksRowOrder, boolean splitIntoColumns, boolean removeItemsNotInColumns, boolean sortBeforePageAndTextValidation, boolean preserveImages, int whiteSpaceDividerHeightAmount, int locationTolerance, @Nullable PdfPageValidator pageValidator, @Nullable PdfPageValidator postColumnsPageValidator, @Nullable PdfTextValidator textValidator, @Nullable PdfBlockMergeChecker blockMergeChecker, @Nullable PdfColumnDeterminer columnDeterminer, @Nullable java.util.Map<java.lang.Integer,java.lang.Integer> predeterminedColumnLocationsAndWidths, int maxColumnSpan, boolean removeEmptyTextElements)
preserveFontFaceInformation
- True to preserve information about the font face (font size, family, color, etc...), false otherwiseconvertPageBlockToAttribute
- True to convert pages to simple text elements with a page-number attributeconvertFontStylesToAttributes
- True to convert font information to an attribute on the text tag (and strip it out of the text as well)sortElements
- True to sort elements by location. In the event of tables, it will sort it into column order -- all data in column 1 will be before
the data in column 2sortRowOrder
- True to sort to row order, false to sort to column order. This only has effect if the sortElements flag is true, and also if we are
splitting into columnsresortBlocksRowOrder
- True to sort to row order inside blocks after they've been split and merged, false to sort column order, null to leave unmodifiedsplitIntoColumns
- True to split into columnsremoveItemsNotInColumns
- True to remove text elements that didn't fit into a column, false otherwisesortBeforePageAndTextValidation
- True to sort elements before passing them through the page and text validators, false otherwisepreserveImages
- True if image elements should be preserved, false otherwisewhiteSpaceDividerHeightAmount
- True to attempt to split elements by whitespace in height. This will wrap each text element in a block
taglocationTolerance
- The amount of tolerance between locationspageValidator
- The validator for checking if a page should be included or nottextValidator
- The validator for checking if a text element should be included or notblockMergeChecker
- Block merge checker to see if blocks should be merged or notcolumnDeterminer
- The object to determine (override) the column for text elementspredeterminedColumnLocationsAndWidths
- The suggested column locations and widthmaxColumnSpan
- The maximum number of columns an element can span (1 is efficient, more is less so for memory)@Contract(value="!null -> !null; null -> null") @Nullable public org.jdom2.Element process(@Nullable org.jdom2.Element element)
element
- The root element (this can contain a list of page tags or a list of text tags).@Contract(value="!null, _ -> !null; null, _ -> null") @Nullable public org.jdom2.Element process(@Nullable org.jdom2.Element element, boolean cloneElementFirst)
element
- The root element (this can contain a list of page tags or a list of text tags).cloneElementFirst
- True if the element should be cloned and we process a copy of it, false to modify the element itself (modifying the actual element will reduce overall memory use, but also loses the original element's extra data)