Class MultipageDocUtil


  • public final class MultipageDocUtil
    extends java.lang.Object
    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

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int autoGetElementNumber​(java.util.List<SaDocInfo.ElementInfo> elements)
      Returns the element number to use to get the first element of a document.
      static java.lang.String convertZipFilename​(java.lang.String path)
      Converts a multi-page filename in a zip filename.
      static java.lang.String getFilename​(java.lang.String path)
      Extracts and returns the filename of the given path.
      static boolean isMultipageDoc​(java.util.List<SaDocInfo.ElementInfo> elements)
      Returns true if the document contains the pages of a splitted multipage TIFF or scanned pages only.
      static boolean isMultipageTiff​(java.lang.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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • autoGetElementNumber

        public static int autoGetElementNumber​(java.util.List<SaDocInfo.ElementInfo> elements)
        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

        public static boolean isMultipageDoc​(java.util.List<SaDocInfo.ElementInfo> elements)
        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

        public 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.
        Parameters:
        element -
        Returns:
      • isMultipageTiff

        public static boolean isMultipageTiff​(java.lang.String path)
        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

        public static java.lang.String getFilename​(java.lang.String path)
        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

        public static java.lang.String convertZipFilename​(java.lang.String path)
        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