org.apache.pdfbox

## Class Loader

- java.lang.Object
- - org.apache.pdfbox.Loader

    public class Loader
    extends Object

Utility methods to load different types of documents

### Method Summary

All Methods Static Methods Concrete Methods
`static FDFDocument` `loadFDF(File file)` This will load a document from a file.
`static FDFDocument` `loadFDF(InputStream input)` This will load a document from an input stream.
`static FDFDocument` `loadFDF(String filename)` This will load a document from a file.
`static PDDocument` `loadPDF(byte[] input)` Parses a PDF.
`static PDDocument` `loadPDF(byte[] input, String password)` Parses a PDF.
`static PDDocument` `loadPDF(byte[] input, String password, InputStream keyStore, String alias)` Parses a PDF.
`static PDDocument` `loadPDF(byte[] input, String password, InputStream keyStore, String alias, org.apache.pdfbox.io.RandomAccessStreamCache.StreamCacheCreateFunction streamCacheCreateFunction)` Parses a PDF.
`static PDDocument` `loadPDF(File file)` Parses a PDF.
`static PDDocument` `loadPDF(File file, org.apache.pdfbox.io.RandomAccessStreamCache.StreamCacheCreateFunction streamCacheCreateFunction)` Parses a PDF.
`static PDDocument` `loadPDF(File file, String password)` Parses a PDF.
`static PDDocument` `loadPDF(File file, String password, InputStream keyStore, String alias)` Parses a PDF.
`static PDDocument` `loadPDF(File file, String password, InputStream keyStore, String alias, org.apache.pdfbox.io.RandomAccessStreamCache.StreamCacheCreateFunction streamCacheCreateFunction)` Parses a PDF.
`static PDDocument` `loadPDF(File file, String password, org.apache.pdfbox.io.RandomAccessStreamCache.StreamCacheCreateFunction streamCacheCreateFunction)` Parses a PDF.
`static PDDocument` `loadPDF(org.apache.pdfbox.io.RandomAccessRead randomAccessRead)` Parses a PDF.
`static PDDocument` `loadPDF(org.apache.pdfbox.io.RandomAccessRead randomAccessRead, org.apache.pdfbox.io.RandomAccessStreamCache.StreamCacheCreateFunction streamCacheCreateFunction)` Parses a PDF.
`static PDDocument` `loadPDF(org.apache.pdfbox.io.RandomAccessRead randomAccessRead, String password)` Parses a PDF.
`static PDDocument` `loadPDF(org.apache.pdfbox.io.RandomAccessRead randomAccessRead, String password, InputStream keyStore, String alias)` Parses a PDF.
`static PDDocument` `loadPDF(org.apache.pdfbox.io.RandomAccessRead randomAccessRead, String password, InputStream keyStore, String alias, org.apache.pdfbox.io.RandomAccessStreamCache.StreamCacheCreateFunction streamCacheCreateFunction)` Parses a PDF.
`static PDDocument` `loadPDF(org.apache.pdfbox.io.RandomAccessRead randomAccessRead, String password, org.apache.pdfbox.io.RandomAccessStreamCache.StreamCacheCreateFunction streamCacheCreateFunction)` Parses a PDF.
`static FDFDocument` `loadXFDF(File file)` This will load a document from a file.
`static FDFDocument` `loadXFDF(InputStream input)` This will load a document from an input stream.
`static FDFDocument` `loadXFDF(String filename)` This will load a document from a file.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Method Detail

#### loadFDF

    public static FDFDocument loadFDF(String filename)
                               throws IOException

This will load a document from a file.

Parameters:
  `filename` - The name of the file to load. `RandomAccessReadBufferedFile` is used to read the file.
Returns:
  The document that was loaded.
Throws:
  `IOException` - If there is an error reading from the stream.

#### loadFDF

    public static FDFDocument loadFDF(File file)
                               throws IOException

This will load a document from a file.

Parameters:
  `file` - The name of the file to load. `RandomAccessReadBufferedFile` is used to read the file.
Returns:
  The document that was loaded.
Throws:
  `IOException` - If there is an error reading from the stream.

#### loadFDF

    public static FDFDocument loadFDF(InputStream input)
                               throws IOException

This will load a document from an input stream. The stream is loaded to the memory to establish random access to the data.

Parameters:
  `input` - The stream that contains the document. To read the stream `RandomAccessReadBuffer` is used
Returns:
  The document that was loaded.
Throws:
  `IOException` - If there is an error reading from the stream.

#### loadXFDF

    public static FDFDocument loadXFDF(String filename)
                                throws IOException

This will load a document from a file.

Parameters:
  `filename` - The name of the file to load.
Returns:
  The document that was loaded.
Throws:
  `IOException` - If there is an error reading from the stream.

#### loadXFDF

    public static FDFDocument loadXFDF(File file)
                                throws IOException

This will load a document from a file.

Parameters:
  `file` - The name of the file to load.
Returns:
  The document that was loaded.
Throws:
  `IOException` - If there is an error reading from the stream.

#### loadXFDF

    public static FDFDocument loadXFDF(InputStream input)
                                throws IOException

This will load a document from an input stream. The stream is loaded to the memory to establish random access to the data.

Parameters:
  `input` - The stream that contains the document.
Returns:
  The document that was loaded.
Throws:
  `IOException` - If there is an error reading from the stream.

#### loadPDF

    public static PDDocument loadPDF(byte[] input)
                              throws IOException

Parses a PDF. Unrestricted main memory will be used for buffering PDF streams.

Parameters:
  `input` - byte array that contains the document. `RandomAccessReadBuffer` is used to read the data.
Returns:
  loaded document
Throws:
  `InvalidPasswordException` - If the PDF required a non-empty password.
  `IOException` - In case of a reading or parsing error.

#### loadPDF

    public static PDDocument loadPDF(byte[] input,
                                     String password)
                              throws IOException

Parses a PDF. Unrestricted main memory will be used for buffering PDF streams.

Parameters:
  `input` - byte array that contains the document. `RandomAccessReadBuffer` is used to read the data.
  `password` - password to be used for decryption
Returns:
  loaded document
Throws:
  `InvalidPasswordException` - If the password is incorrect.
  `IOException` - In case of a reading or parsing error.

#### loadPDF

    public static PDDocument loadPDF(byte[] input,
                                     String password,
                                     InputStream keyStore,
                                     String alias)
                              throws IOException

Parses a PDF. Unrestricted main memory will be used for buffering PDF streams.

Parameters:
  `input` - byte array that contains the document. `RandomAccessReadBuffer` is used to read the data.
  `password` - password to be used for decryption
  `keyStore` - key store to be used for decryption when using public key security
  `alias` - alias to be used for decryption when using public key security
Returns:
  loaded document
Throws:
  `InvalidPasswordException` - If the password is incorrect.
  `IOException` - In case of a reading or parsing error.

#### loadPDF

    public static PDDocument loadPDF(byte[] input,
                                     String password,
                                     InputStream keyStore,
                                     String alias,
                                     org.apache.pdfbox.io.RandomAccessStreamCache.StreamCacheCreateFunction streamCacheCreateFunction)
                              throws IOException

Parses a PDF.

Parameters:
  `input` - byte array that contains the document. `RandomAccessReadBuffer` is used to read the data.
  `password` - password to be used for decryption
  `keyStore` - key store to be used for decryption when using public key security
  `alias` - alias to be used for decryption when using public key security
  `streamCacheCreateFunction` - a function to create an instance of a stream cache to be used for buffering new/altered PDF streams
Returns:
  loaded document
Throws:
  `InvalidPasswordException` - If the password is incorrect.
  `IOException` - In case of a reading or parsing error.

#### loadPDF

    public static PDDocument loadPDF(File file)
                              throws IOException

Parses a PDF. Unrestricted main memory will be used for buffering PDF streams.

Parameters:
  `file` - file to be loaded. `RandomAccessReadBufferedFile` is used to read the file.
Returns:
  loaded document
Throws:
  `InvalidPasswordException` - If the file required a non-empty password.
  `IOException` - in case of a file reading or parsing error

#### loadPDF

    public static PDDocument loadPDF(File file,
                                     org.apache.pdfbox.io.RandomAccessStreamCache.StreamCacheCreateFunction streamCacheCreateFunction)
                              throws IOException

Parses a PDF.

Parameters:
  `file` - file to be loaded. `RandomAccessReadBufferedFile` is used to read the file.
  `streamCacheCreateFunction` - a function to create an instance of a stream cache to be used for buffering new/altered PDF streams
Returns:
  loaded document
Throws:
  `InvalidPasswordException` - If the file required a non-empty password.
  `IOException` - in case of a file reading or parsing error

#### loadPDF

    public static PDDocument loadPDF(File file,
                                     String password)
                              throws IOException

Parses a PDF. Unrestricted main memory will be used for buffering PDF streams.

Parameters:
  `file` - file to be loaded. `RandomAccessReadBufferedFile` is used to read the file.
  `password` - password to be used for decryption
Returns:
  loaded document
Throws:
  `InvalidPasswordException` - If the password is incorrect.
  `IOException` - in case of a file reading or parsing error

#### loadPDF

    public static PDDocument loadPDF(File file,
                                     String password,
                                     org.apache.pdfbox.io.RandomAccessStreamCache.StreamCacheCreateFunction streamCacheCreateFunction)
                              throws IOException

Parses a PDF.

Parameters:
  `file` - file to be loaded. `RandomAccessReadBufferedFile` is used to read the file.
  `password` - password to be used for decryption
  `streamCacheCreateFunction` - a function to create an instance of a stream cache to be used for buffering new/altered PDF streams
Returns:
  loaded document
Throws:
  `InvalidPasswordException` - If the password is incorrect.
  `IOException` - in case of a file reading or parsing error

#### loadPDF

    public static PDDocument loadPDF(File file,
                                     String password,
                                     InputStream keyStore,
                                     String alias)
                              throws IOException

Parses a PDF. Unrestricted main memory will be used for buffering PDF streams.

Parameters:
  `file` - file to be loaded. `RandomAccessReadBufferedFile` is used to read the file.
  `password` - password to be used for decryption
  `keyStore` - key store to be used for decryption when using public key security
  `alias` - alias to be used for decryption when using public key security
Returns:
  loaded document
Throws:
  `IOException` - in case of a file reading or parsing error

#### loadPDF

    public static PDDocument loadPDF(File file,
                                     String password,
                                     InputStream keyStore,
                                     String alias,
                                     org.apache.pdfbox.io.RandomAccessStreamCache.StreamCacheCreateFunction streamCacheCreateFunction)
                              throws IOException

Parses a PDF.

Parameters:
  `file` - file to be loaded. `RandomAccessReadBufferedFile` is used to read the file.
  `password` - password to be used for decryption
  `keyStore` - key store to be used for decryption when using public key security
  `alias` - alias to be used for decryption when using public key security
  `streamCacheCreateFunction` - a function to create an instance of a stream cache to be used for buffering new/altered PDF streams
Returns:
  loaded document
Throws:
  `IOException` - in case of a file reading or parsing error

#### loadPDF

    public static PDDocument loadPDF(org.apache.pdfbox.io.RandomAccessRead randomAccessRead)
                              throws IOException

Parses a PDF. Unrestricted main memory will be used for buffering PDF new streams.

Parameters:
  `randomAccessRead` - random access read representing the pdf to be loaded. To pass an InputStream, wrap it into a `RandomAccessReadBuffer`.
Returns:
  loaded document
Throws:
  `InvalidPasswordException` - If the PDF required a non-empty password.
  `IOException` - In case of a reading or parsing error.

#### loadPDF

    public static PDDocument loadPDF(org.apache.pdfbox.io.RandomAccessRead randomAccessRead,
                                     org.apache.pdfbox.io.RandomAccessStreamCache.StreamCacheCreateFunction streamCacheCreateFunction)
                              throws IOException

Parses a PDF.

Parameters:
  `randomAccessRead` - random access read representing the pdf to be loaded. To pass an InputStream, wrap it into a `RandomAccessReadBuffer`.
  `streamCacheCreateFunction` - a function to create an instance of a stream cache to be used for buffering new/altered PDF streams
Returns:
  loaded document
Throws:
  `InvalidPasswordException` - If the PDF required a non-empty password.
  `IOException` - In case of a reading or parsing error.

#### loadPDF

    public static PDDocument loadPDF(org.apache.pdfbox.io.RandomAccessRead randomAccessRead,
                                     String password)
                              throws IOException

Parses a PDF. Unrestricted main memory will be used for buffering new/altered PDF streams.

Parameters:
  `randomAccessRead` - random access read representing the pdf to be loaded. To pass an InputStream, wrap it into a `RandomAccessReadBuffer`.
  `password` - password to be used for decryption
Returns:
  loaded document
Throws:
  `InvalidPasswordException` - If the password is incorrect.
  `IOException` - In case of a reading or parsing error.

#### loadPDF

    public static PDDocument loadPDF(org.apache.pdfbox.io.RandomAccessRead randomAccessRead,
                                     String password,
                                     InputStream keyStore,
                                     String alias)
                              throws IOException

Parses a PDF. Unrestricted main memory will be used for buffering new/altered PDF streams.

Parameters:
  `randomAccessRead` - random access read representing the pdf to be loaded. To pass an InputStream, wrap it into a `RandomAccessReadBuffer`.
  `password` - password to be used for decryption
  `keyStore` - key store to be used for decryption when using public key security
  `alias` - alias to be used for decryption when using public key security
Returns:
  loaded document
Throws:
  `IOException` - In case of a reading or parsing error.

#### loadPDF

    public static PDDocument loadPDF(org.apache.pdfbox.io.RandomAccessRead randomAccessRead,
                                     String password,
                                     org.apache.pdfbox.io.RandomAccessStreamCache.StreamCacheCreateFunction streamCacheCreateFunction)
                              throws IOException

Parses a PDF.

Parameters:
  `randomAccessRead` - random access read representing the pdf to be loaded. To pass an InputStream, wrap it into a `RandomAccessReadBuffer`.
  `password` - password to be used for decryption
  `streamCacheCreateFunction` - a function to create an instance of a stream cache to be used for buffering new/altered PDF streams
Returns:
  loaded document
Throws:
  `InvalidPasswordException` - If the password is incorrect.
  `IOException` - In case of a reading or parsing error.

#### loadPDF

    public static PDDocument loadPDF(org.apache.pdfbox.io.RandomAccessRead randomAccessRead,
                                     String password,
                                     InputStream keyStore,
                                     String alias,
                                     org.apache.pdfbox.io.RandomAccessStreamCache.StreamCacheCreateFunction streamCacheCreateFunction)
                              throws IOException

Parses a PDF.

Parameters:
  `randomAccessRead` - random access read representing the pdf to be loaded. To pass an InputStream, wrap it into a `RandomAccessReadBuffer`.
  `password` - password to be used for decryption
  `keyStore` - key store to be used for decryption when using public key security
  `alias` - alias to be used for decryption when using public key security
  `streamCacheCreateFunction` - a function to create an instance of a stream cache to be used for buffering new/altered PDF streams
Returns:
  loaded document
Throws:
  `IOException` - in case of a file reading or parsing error