Package com.saperion.util
Class MultipageDocUtil
java.lang.Object
com.saperion.util.MultipageDocUtil
Utility class for multipage documents.
E.g. to detect if a document contains pages of one multipage TIFF or scanpages ONLY. Filename conversions utility methods e.g. for zip files are also available.
-
Method Summary
Modifier and TypeMethodDescriptionstatic int
autoGetElementNumber
(List<SaDocInfo.ElementInfo> elements) Returns the element number to use to get the first element of a document.static String
convertZipFilename
(String path) Converts a multi-page filename in a zip filename.static String
getFilename
(String path) Extracts and returns the filename of the given path.static boolean
isMultipageDoc
(List<SaDocInfo.ElementInfo> elements) Returns true if the document contains the pages of a splitted multipage TIFF or scanned pages only.static boolean
isMultipageTiff
(String path) Checks if the given path contains a multi-page filename.static boolean
isTiffDocument
(SaDocInfo.ElementInfo element) Tries to guess if the document element has a multiple page tiff document Intended to work tiff documents stored in original format.
-
Method Details
-
autoGetElementNumber
Returns the element number to use to get the first element of a document. If the document is a splitted multipage TIFF or a scanned document, -1 will be returned in order to retrieve the entire document. Otherwise, the number of the first element is returned.- Parameters:
elements
- the document's structure elements- Returns:
- -1 if multipage document, otherwise number of first element
-
isMultipageDoc
Returns true if the document contains the pages of a splitted multipage TIFF or scanned pages only.- Parameters:
elements
- the document's structure elements- Returns:
- true if multipage document, otherwise false
-
isTiffDocument
Tries to guess if the document element has a multiple page tiff document Intended to work tiff documents stored in original format.- Parameters:
element
-- Returns:
-
isMultipageTiff
Checks if the given path contains a multi-page filename.A multi-page filename is specified by a "@" after the filename suffix. The number after the "@" describes the page number of the multi-page document. Example: file.tiff@1
- Parameters:
path
- the path containing a filename to check multi-page- Returns:
- true, if path contains a multi-page filename
-
getFilename
Extracts and returns the filename of the given path. Strips the possible '@' postfix. - Parameters:
path
- The path+filename to be extract the filename from. Should be a multi-page filename.- Returns:
- The extracted filename.
-
convertZipFilename
Converts a multi-page filename in a zip filename.Example: converts filename.tiff@3 to filename[3].tiff
- Parameters:
path
- The path+filename to be extract the filename from. Should be a multi-page filename.- Returns:
- the converted zip filename
-