Package adams.core.io

Class JPod


  • public class JPod
    extends Object
    Helper class for jPod (PDF handling).
    Version:
    $Revision$
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    • Constructor Detail

      • JPod

        public JPod()
    • Method Detail

      • load

        public static de.intarsys.pdf.pd.PDDocument load​(String file)
        Loads the specified PDF document.
        Parameters:
        file - the file to load
        Returns:
        the PDF document, null in case of an error
      • load

        public static de.intarsys.pdf.pd.PDDocument load​(File file)
        Loads the specified PDF document.
        Parameters:
        file - the file to load
        Returns:
        the PDF document, null in case of an error
      • close

        public static void close​(de.intarsys.pdf.pd.PDDocument document)
        Closes the document again.
        Parameters:
        document - the document to close, can be null
      • save

        public static boolean save​(de.intarsys.pdf.pd.PDDocument doc,
                                   String file)
        Saves the PDF document under the specified filename.
        Parameters:
        doc - the document to save
        file - the file to save the document to
        Returns:
        true if successfully saved
      • save

        public static boolean save​(de.intarsys.pdf.pd.PDDocument doc,
                                   File file)
        Saves the PDF document under the specified filename.
        Parameters:
        doc - the document to save
        file - the file to save the document to
        Returns:
        true if successfully saved
      • extract

        public static String extract​(File file)
        Extracts all text from the specified PDF file.
        Parameters:
        file - the PDF file to extract the content from
        Returns:
        the extracted text, null in case of an error
      • extract

        public static String extract​(File file,
                                     Range range)
        Extracts all text from the specified PDF file.
        Parameters:
        file - the PDF file to extract the content from
        range - the range of pages to extract
        Returns:
        the extracted text, null in case of an error
      • extractImages

        public static List<BufferedImage> extractImages​(File file)
        Extracts all images from the specified PDF file.
        Parameters:
        file - the PDF file to extract the images from
        Returns:
        the extracted images, null in case of an error
      • getPageCount

        public static int getPageCount​(File file)
        Determines the page count of a PDF file.
        Parameters:
        file - the PDF file to extract the content from
        Returns:
        the page count, -1 in case of an error