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 SummaryFieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final int
- 
Constructor SummaryConstructors
- 
Method SummaryModifier 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_ALLPAGESpublic static final int POLICY_ALLPAGES- See Also:
 
- 
POLICY_SELECTIONpublic static final int POLICY_SELECTION- See Also:
 
- 
POLICY_BLANKPAGEpublic static final int POLICY_BLANKPAGE- See Also:
 
- 
POLICY_BARCODEpublic static final int POLICY_BARCODE- See Also:
 
- 
POLICY_TEXTpublic static final int POLICY_TEXT- See Also:
 
- 
SEPARATOR_SKIPpublic static final int SEPARATOR_SKIP- See Also:
 
- 
SEPARATOR_CURRENTSEGpublic static final int SEPARATOR_CURRENTSEG- See Also:
 
- 
SEPARATOR_NEXTSEGpublic static final int SEPARATOR_NEXTSEG- See Also:
 
 
- 
- 
Constructor Details- 
Splitter
 
- 
- 
Method Details- 
splitAllPagesSplits every page in a separate single page PDF- Returns:
- the list of splits
- Throws:
- IOException- cannot read the PDF file
- FeatureNotEnabledException- Feature is not enabled in the license
 
- 
splitSelectionSplits 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 file
- FeatureNotEnabledException- Feature is not enabled in the license
 
- 
getSegmentsFromExpression
- 
splitUsingBarcodepublic 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 Barcode
- tenant- name of the tenant
- separator- 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 file
- FeatureNotEnabledException- Feature is not enabled in the license
 
- 
splitUsingTextpublic 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 Barcode
- 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 file
- com.logicaldoc.core.parser.ParsingException- in case of error during the parsing
- FeatureNotEnabledException- Feature is not enabled in the license
 
- 
splitUsingBlankPageSplits 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 file
- FeatureNotEnabledException- Feature is not enabled in the license
 
- 
getSplits
- 
splitpublic 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 document
- policy- the splitting policy, one of the- POLICY_xxx
- separator- how to handle the separator: 0 = skip, 1 = append to current segment, 2 = prepend to next segment
- expression- the expression to use (some policies support it)
- transaction- informations about the current transaction
- Returns:
- the list of segments
- Throws:
- IOException- I/O error
- com.logicaldoc.core.PersistenceException- Error in the data layer
- com.logicaldoc.core.security.authorization.PermissionException- The user does not have enough permissions
- FeatureNotEnabledException- The feature is not enabled in the license
- com.logicaldoc.core.parser.ParsingException- Error parsing the document file
 
 
-