Package com.logicaldoc.split
Class Splitter
java.lang.Object
com.logicaldoc.split.Splitter
Splits a pdf file into smaller pdfs using different criteria.
- Since:
- 8.4
- Author:
- Marco Meschieri - LogicalDOC
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetSegmentsFromExpression
(String expression) static List
<com.logicaldoc.core.document.Document> split
(long docId, int policy, int separator, String expression, com.logicaldoc.core.document.DocumentHistory transaction) Generic method for splittingSplits every page in a separate single page PDFsplitSelection
(String expression) Splits in segments of pages depending on an expression(eg: 1,4-7,8)splitUsingBarcode
(String expression, String tenant, int separator) Splits in segments using a barcodesplitUsingBlankPage
(int separator) Splits in segments using a blank page as separatorsplitUsingText
(String expression, int separator) Splits in segments using a text expression
-
Field Details
-
POLICY_ALLPAGES
public static final int POLICY_ALLPAGES- See Also:
-
POLICY_SELECTION
public static final int POLICY_SELECTION- See Also:
-
POLICY_BLANKPAGE
public static final int POLICY_BLANKPAGE- See Also:
-
POLICY_BARCODE
public static final int POLICY_BARCODE- See Also:
-
POLICY_TEXT
public static final int POLICY_TEXT- See Also:
-
SEPARATOR_SKIP
public static final int SEPARATOR_SKIP- See Also:
-
SEPARATOR_CURRENTSEG
public static final int SEPARATOR_CURRENTSEG- See Also:
-
SEPARATOR_NEXTSEG
public static final int SEPARATOR_NEXTSEG- See Also:
-
-
Constructor Details
-
Splitter
-
-
Method Details
-
splitAllPages
Splits every page in a separate single page PDF- Returns:
- the list of splits
- Throws:
IOException
- cannot read the PDF fileFeatureNotEnabledException
- Feature is not enabled in the license
-
splitSelection
Splits in segments of pages depending on an expression(eg: 1,4-7,8)- Parameters:
expression
- the selection of pages (e.g.: 1,2,4-6,9)- Returns:
- the list of segments
- Throws:
IOException
- cannot read the PDF fileFeatureNotEnabledException
- Feature is not enabled in the license
-
getSegmentsFromExpression
-
splitUsingBarcode
public List<File> splitUsingBarcode(String expression, String tenant, int separator) throws IOException, FeatureNotEnabledException Splits in segments using a barcode- Parameters:
expression
- Expression that must be matched by the Barcodetenant
- name of the tenantseparator
- 0 = skip the separator, 1 = last page of segment, 2 = first page of segment- Returns:
- the list of segments
- Throws:
IOException
- cannot read the PDF fileFeatureNotEnabledException
- Feature is not enabled in the license
-
splitUsingText
public List<File> splitUsingText(String expression, int separator) throws IOException, com.logicaldoc.core.parser.ParsingException, FeatureNotEnabledException Splits in segments using a text expression- Parameters:
expression
- Expression that must be matched by the Barcodeseparator
- 0 = skip the separator, 1 = last page of segment, 2 = first page of segment- Returns:
- the list of splits
- Throws:
IOException
- cannot read the PDF filecom.logicaldoc.core.parser.ParsingException
- in case of error during the parsingFeatureNotEnabledException
- Feature is not enabled in the license
-
splitUsingBlankPage
Splits in segments using a blank page as separator- Parameters:
separator
- 0 = skip the separator, 1 = last page of segment, 2 = first page of segment- Returns:
- the list of splits
- Throws:
IOException
- cannot read the PDF fileFeatureNotEnabledException
- Feature is not enabled in the license
-
getSplits
-
split
public static List<com.logicaldoc.core.document.Document> split(long docId, int policy, int separator, String expression, com.logicaldoc.core.document.DocumentHistory transaction) throws IOException, com.logicaldoc.core.PersistenceException, com.logicaldoc.core.security.authorization.PermissionException, FeatureNotEnabledException, com.logicaldoc.core.parser.ParsingException Generic method for splitting- Parameters:
docId
- identifier of the documentpolicy
- the splitting policy, one of thePOLICY_xxx
separator
- how to handle the separator: 0 = skip, 1 = append to current segment, 2 = prepend to next segmentexpression
- the expression to use (some policies support it)transaction
- informations about the current transaction- Returns:
- the list of segments
- Throws:
IOException
- I/O errorcom.logicaldoc.core.PersistenceException
- Error in the data layercom.logicaldoc.core.security.authorization.PermissionException
- The user does not have enough permissionsFeatureNotEnabledException
- The feature is not enabled in the licensecom.logicaldoc.core.parser.ParsingException
- Error parsing the document file
-