Class PdfPageDeletion

java.lang.Object
org.jpedal.tools.PdfPageDeletion

public final class PdfPageDeletion extends Object
Utility class with static methods to delete pages from a PDF
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    deletePageRange(File input, File outputFile, int rangeStart, int rangeEnd)
    Delete the specified page from the provided PDF file into a new File
    static void
    deletePageRange(File input, File outputFile, int rangeStart, int rangeEnd, String password)
    Delete the specified page from the provided PDF file into a new File
    static void
    deletePageRange(File input, File outputFile, PageRanges pagesToDelete)
    Delete the specified page from the provided PDF file into a new File
    static void
    deletePageRange(File input, File outputFile, PageRanges pagesToDelete, String password)
    Delete the specified page from the provided PDF file into a new File
    static void
    deleteSinglePage(File input, File outputFile, int pageToDelete)
    Delete the specified page from the provided PDF file
    static void
    deleteSinglePage(File input, File outputFile, int pageToDelete, String password)
    Delete the specified page from the provided PDF file
    static void
    main(String[] args)
    Delete the specified pages from a PDF and save the output to the specified file.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 from
      outputFile - 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 from
      outputFile - the file to save the modified output to.
      pageToDelete - the page to delete
      password - 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 from
      outputFile - the file to save the modified output to.
      rangeStart - the start of the page range to delete (inclusive), must be lower than the rangeEnd value
      rangeEnd - 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 from
      outputFile - the file to save the modified output to.
      rangeStart - the start of the page range to delete (inclusive), must be lower than the rangeEnd value
      rangeEnd - the end of the page range to delete (inclusive), must be larger than the rangeStart value
      password - 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 from
      outputFile - 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 from
      outputFile - the file to save the modified output to.
      pagesToDelete - the pages to delete specified as a PageRanges object
      password - the password of the file to have pages deleted
      Throws:
      IOException - if there is an issue opening the PDF file
    • main

      public static void main(String[] args)
      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