Package org.jpedal.tools
Class PdfPageExtraction
java.lang.Object
org.jpedal.tools.PdfPageExtraction
Utility class with static methods to extract pages from PDFs
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
extractPageRange
(File input, File outputDirectory, int rangeStart, int rangeEnd) Extract the specified page from the provided PDF file into a new Filestatic void
extractPageRange
(File input, File outputDirectory, int rangeStart, int rangeEnd, String password) Extract the specified page from the provided PDF file into a new Filestatic void
extractPageRange
(File input, File outputDirectory, PageRanges pagesToExtract) Extract the specified pages from the provided PDF file into a new Filestatic void
extractPageRange
(File input, File outputDirectory, PageRanges pagesToExtract, String password) Extract the specified pages from the provided PDF file into a new Filestatic void
extractSinglePage
(File input, File outputDirectory, int pageToExtract) Extract the specified page from the provided PDF filestatic void
extractSinglePage
(File input, File outputDirectory, int pageToExtract, String password) Extract the specified page from the provided PDF filestatic void
Extract the specified pages from a PDF and save the output to the specified file.
-
Method Details
-
main
Extract the specified pages from a PDF and save the output to the specified file.- Parameters:
args
- Expects a String array of 3 values. the first being the filename for the input PDF, the second being the filename for the output, the third being a page range specified as a String in the same way as SetOfIntegerSyntax- Throws:
IOException
- if there is an issue opening the PDF file
-
extractSinglePage
public static void extractSinglePage(File input, File outputDirectory, int pageToExtract) throws IOException Extract the specified page from the provided PDF file- Parameters:
input
- the file to extract fromoutputDirectory
- the directory to save the extracted output.pageToExtract
- the page to extract- Throws:
IOException
- if there is an issue opening the PDF file
-
extractSinglePage
public static void extractSinglePage(File input, File outputDirectory, int pageToExtract, String password) throws IOException Extract the specified page from the provided PDF file- Parameters:
input
- the file to extract fromoutputDirectory
- the directory to save the extracted output.pageToExtract
- the page to extractpassword
- the password of the file to have pages deleted- Throws:
IOException
- if there is an issue opening the PDF file
-
extractPageRange
public static void extractPageRange(File input, File outputDirectory, int rangeStart, int rangeEnd) throws IOException Extract the specified page from the provided PDF file into a new File- Parameters:
input
- the file to extract fromoutputDirectory
- the directory to save the extracted output.rangeStart
- the start of the page range to extract (inclusive), must be lower than the rangeEnd valuerangeEnd
- the end of the page range to extract (inclusive), must be larger than the rangeStart value- Throws:
IOException
- if there is an issue opening the PDF file
-
extractPageRange
public static void extractPageRange(File input, File outputDirectory, int rangeStart, int rangeEnd, String password) throws IOException Extract the specified page from the provided PDF file into a new File- Parameters:
input
- the file to extract fromoutputDirectory
- the directory to save the extracted output.rangeStart
- the start of the page range to extract (inclusive), must be lower than the rangeEnd valuerangeEnd
- the end of the page range to extract (inclusive), must be larger than the rangeStart valuepassword
- the password of the file to have pages deleted- Throws:
IOException
- if there is an issue opening the PDF file
-
extractPageRange
public static void extractPageRange(File input, File outputDirectory, PageRanges pagesToExtract) throws IOException Extract the specified pages from the provided PDF file into a new File- Parameters:
input
- the file to extract fromoutputDirectory
- the directory to save the extracted output.pagesToExtract
- the pages to extract specified as a PageRanges object- Throws:
IOException
- if there is an issue opening the PDF file
-
extractPageRange
public static void extractPageRange(File input, File outputDirectory, PageRanges pagesToExtract, String password) throws IOException Extract the specified pages from the provided PDF file into a new File- Parameters:
input
- the file to extract fromoutputDirectory
- the directory to save the extracted output.pagesToExtract
- the pages to extract specified as a PageRanges objectpassword
- the password of the file to have pages deleted- Throws:
IOException
- if there is an issue opening the PDF file
-