Package org.jpedal.tools
Class PdfPageDeletion
java.lang.Object
org.jpedal.tools.PdfPageDeletion
Utility class with static methods to delete pages from a PDF
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
deletePageRange
(File input, File outputFile, int rangeStart, int rangeEnd) Delete the specified page from the provided PDF file into a new Filestatic void
deletePageRange
(File input, File outputFile, int rangeStart, int rangeEnd, String password) Delete the specified page from the provided PDF file into a new Filestatic void
deletePageRange
(File input, File outputFile, PageRanges pagesToDelete) Delete the specified page from the provided PDF file into a new Filestatic void
deletePageRange
(File input, File outputFile, PageRanges pagesToDelete, String password) Delete the specified page from the provided PDF file into a new Filestatic void
deleteSinglePage
(File input, File outputFile, int pageToDelete) Delete the specified page from the provided PDF filestatic void
deleteSinglePage
(File input, File outputFile, int pageToDelete, String password) Delete the specified page from the provided PDF filestatic void
Delete the specified pages from a PDF and save the output to the specified file.
-
Method Details
-
deleteSinglePage
public static void deleteSinglePage(File input, File outputFile, int pageToDelete) throws IOException Delete the specified page from the provided PDF file- Parameters:
input
- the file to delete fromoutputFile
- the file to save the modified output to.pageToDelete
- the page to delete- Throws:
IOException
- if there is an issue opening the PDF file
-
deleteSinglePage
public static void deleteSinglePage(File input, File outputFile, int pageToDelete, String password) throws IOException Delete the specified page from the provided PDF file- Parameters:
input
- the file to delete fromoutputFile
- the file to save the modified output to.pageToDelete
- the page to deletepassword
- the password of the file to have pages deleted- Throws:
IOException
- if there is an issue opening the PDF file
-
deletePageRange
public static void deletePageRange(File input, File outputFile, int rangeStart, int rangeEnd) throws IOException Delete the specified page from the provided PDF file into a new File- Parameters:
input
- the file to extract fromoutputFile
- the file to save the modified output to.rangeStart
- the start of the page range to delete (inclusive), must be lower than the rangeEnd valuerangeEnd
- the end of the page range to delete (inclusive), must be larger than the rangeStart value- Throws:
IOException
- if there is an issue opening the PDF file
-
deletePageRange
public static void deletePageRange(File input, File outputFile, int rangeStart, int rangeEnd, String password) throws IOException Delete the specified page from the provided PDF file into a new File- Parameters:
input
- the file to extract fromoutputFile
- the file to save the modified output to.rangeStart
- the start of the page range to delete (inclusive), must be lower than the rangeEnd valuerangeEnd
- the end of the page range to delete (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
-
deletePageRange
public static void deletePageRange(File input, File outputFile, PageRanges pagesToDelete) throws IOException Delete the specified page from the provided PDF file into a new File- Parameters:
input
- the file to extract fromoutputFile
- the file to save the modified output to.pagesToDelete
- the pages to delete specified as a PageRanges object- Throws:
IOException
- if there is an issue opening the PDF file
-
deletePageRange
public static void deletePageRange(File input, File outputFile, PageRanges pagesToDelete, String password) throws IOException Delete the specified page from the provided PDF file into a new File- Parameters:
input
- the file to extract fromoutputFile
- the file to save the modified output to.pagesToDelete
- the pages to delete 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
-
main
Delete 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
-