Class PdfPageExtraction

java.lang.Object
org.jpedal.tools.PdfPageExtraction

public final class PdfPageExtraction extends Object
Utility class with static methods to extract pages from PDFs
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    extractPageRange(File input, File outputDirectory, int rangeStart, int rangeEnd)
    Extract the specified page from the provided PDF file into a new File
    static void
    extractPageRange(File input, File outputDirectory, int rangeStart, int rangeEnd, String password)
    Extract the specified page from the provided PDF file into a new File
    static void
    extractPageRange(File input, File outputDirectory, PageRanges pagesToExtract)
    Extract the specified pages from the provided PDF file into a new File
    static void
    extractPageRange(File input, File outputDirectory, PageRanges pagesToExtract, String password)
    Extract the specified pages from the provided PDF file into a new File
    static void
    extractSinglePage(File input, File outputDirectory, int pageToExtract)
    Extract the specified page from the provided PDF file
    static void
    extractSinglePage(File input, File outputDirectory, int pageToExtract, String password)
    Extract the specified page from the provided PDF file
    static void
    main(String[] args)
    Extract 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

    • main

      public static void main(String[] args) throws IOException
      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 from
      outputDirectory - 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 from
      outputDirectory - the directory to save the extracted output.
      pageToExtract - the page to extract
      password - 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 from
      outputDirectory - the directory to save the extracted output.
      rangeStart - the start of the page range to extract (inclusive), must be lower than the rangeEnd value
      rangeEnd - 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 from
      outputDirectory - the directory to save the extracted output.
      rangeStart - the start of the page range to extract (inclusive), must be lower than the rangeEnd value
      rangeEnd - the end of the page range to extract (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
    • 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 from
      outputDirectory - 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 from
      outputDirectory - the directory to save the extracted output.
      pagesToExtract - the pages to extract 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