Class PdfPageSplit

java.lang.Object
org.jpedal.tools.PdfPageSplit

public final class PdfPageSplit extends Object
Utility class with static methods to split PDFs into separate files
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    main(String[] args)
    Split the PDF at the given page and save the two sections into the specified directory The split will put all pages less than and equal to the specified page in the first file and all pages greater than the specified page in the second file.
    static void
    splitAllPages(File input, File outputDirectory)
    Split the provided document to make each page a separate file.
    static void
    splitAllPages(File input, File outputDirectory, String password)
    Split the provided document to make each page a separate file.
    static void
    splitIn2(File input, File outputDirectory, int splitPage)
    Split the provided document in two 2 documents with the first containing pages 1 to splitPage inclusive and the second containing all other pages.
    static void
    splitIn2(File input, File outputDirectory, int splitPage, String password)
    Split the provided document in two 2 documents with the first containing pages 1 to splitPage inclusive and the second containing all other pages.
    static void
    splitToNPagePDFs(File input, File outputDirectory, int pages)
    Split the provided document to make files comprising the given number of pages each.
    static void
    splitToNPagePDFs(File input, File outputDirectory, int pages, String password)
    Split the provided document to make files comprising the given number of pages each.

    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
      Split the PDF at the given page and save the two sections into the specified directory The split will put all pages less than and equal to the specified page in the first file and all pages greater than the specified page in the second 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 number of the page to split the file
      Throws:
      IOException - if there is an issue opening the PDF file
    • splitIn2

      public static void splitIn2(File input, File outputDirectory, int splitPage) throws IOException
      Split the provided document in two 2 documents with the first containing pages 1 to splitPage inclusive and the second containing all other pages.
      Parameters:
      input - the file to be split
      outputDirectory - the directory to save the split output.
      splitPage - the page to be used to split the document, this page is included in the first file
      Throws:
      IOException - if there is an issue opening the PDF file
    • splitIn2

      public static void splitIn2(File input, File outputDirectory, int splitPage, String password) throws IOException
      Split the provided document in two 2 documents with the first containing pages 1 to splitPage inclusive and the second containing all other pages.
      Parameters:
      input - the file to be split
      outputDirectory - the directory to save the split output.
      splitPage - the page to be used to split the document, this page is included in the first file
      password - the password of the file to have pages deleted
      Throws:
      IOException - if there is an issue opening the PDF file
    • splitAllPages

      public static void splitAllPages(File input, File outputDirectory) throws IOException
      Split the provided document to make each page a separate file.
      Parameters:
      input - the file to be split
      outputDirectory - the directory to save the split output.
      Throws:
      IOException - if there is an issue opening the PDF file
    • splitAllPages

      public static void splitAllPages(File input, File outputDirectory, String password) throws IOException
      Split the provided document to make each page a separate file.
      Parameters:
      input - the file to be split
      outputDirectory - the directory to save the split output
      password - the password of the file to have pages deleted
      Throws:
      IOException - if there is an issue opening the PDF file
    • splitToNPagePDFs

      public static void splitToNPagePDFs(File input, File outputDirectory, int pages) throws IOException
      Split the provided document to make files comprising the given number of pages each. The final file will contain any remaining pages up to the specified amount
      Parameters:
      input - the file to be split
      outputDirectory - the directory to save the split output.
      pages - the number of pages each output file should contain
      Throws:
      IOException - if there is an issue opening the PDF file
    • splitToNPagePDFs

      public static void splitToNPagePDFs(File input, File outputDirectory, int pages, String password) throws IOException
      Split the provided document to make files comprising the given number of pages each. The final file will contain any remaining pages up to the specified amount
      Parameters:
      input - the file to be split
      outputDirectory - the directory to save the split output.
      pages - the number of pages each output file should contain
      password - the password of the file to have pages deleted
      Throws:
      IOException - if there is an issue opening the PDF file