Package adams.core.io
Class JPod
- java.lang.Object
-
- adams.core.io.JPod
-
public class JPod extends Object
Helper class for jPod (PDF handling).- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
-
-
Constructor Summary
Constructors Constructor Description JPod()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
close(de.intarsys.pdf.pd.PDDocument document)
Closes the document again.static String
extract(File file)
Extracts all text from the specified PDF file.static String
extract(File file, Range range)
Extracts all text from the specified PDF file.static List<BufferedImage>
extractImages(File file)
Extracts all images from the specified PDF file.static int
getPageCount(File file)
Determines the page count of a PDF file.static de.intarsys.pdf.pd.PDDocument
load(File file)
Loads the specified PDF document.static de.intarsys.pdf.pd.PDDocument
load(String file)
Loads the specified PDF document.static boolean
save(de.intarsys.pdf.pd.PDDocument doc, File file)
Saves the PDF document under the specified filename.static boolean
save(de.intarsys.pdf.pd.PDDocument doc, String file)
Saves the PDF document under the specified filename.
-
-
-
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 savefile
- 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 savefile
- 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 fromrange
- 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
-
-