Package org.apache.pdfbox
Class Loader
- java.lang.Object
-
- org.apache.pdfbox.Loader
-
public class Loader extends java.lang.ObjectUtility methods to load different types of documents
-
-
Constructor Summary
Constructors Modifier Constructor Description privateLoader()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static FDFDocumentloadFDF(java.io.File file)This will load a document from a file.static FDFDocumentloadFDF(java.io.InputStream input)This will load a document from an input stream.static FDFDocumentloadFDF(java.lang.String filename)This will load a document from a file.static PDDocumentloadPDF(byte[] input)Parses a PDF.static PDDocumentloadPDF(byte[] input, java.lang.String password)Parses a PDF.static PDDocumentloadPDF(byte[] input, java.lang.String password, java.io.InputStream keyStore, java.lang.String alias)Parses a PDF.static PDDocumentloadPDF(byte[] input, java.lang.String password, java.io.InputStream keyStore, java.lang.String alias, RandomAccessStreamCache.StreamCacheCreateFunction streamCacheCreateFunction)Parses a PDF.static PDDocumentloadPDF(java.io.File file)Parses a PDF.static PDDocumentloadPDF(java.io.File file, java.lang.String password)Parses a PDF.static PDDocumentloadPDF(java.io.File file, java.lang.String password, java.io.InputStream keyStore, java.lang.String alias)Parses a PDF.static PDDocumentloadPDF(java.io.File file, java.lang.String password, java.io.InputStream keyStore, java.lang.String alias, RandomAccessStreamCache.StreamCacheCreateFunction streamCacheCreateFunction)Parses a PDF.static PDDocumentloadPDF(java.io.File file, java.lang.String password, RandomAccessStreamCache.StreamCacheCreateFunction streamCacheCreateFunction)Parses a PDF.static PDDocumentloadPDF(java.io.File file, RandomAccessStreamCache.StreamCacheCreateFunction streamCacheCreateFunction)Parses a PDF.static PDDocumentloadPDF(RandomAccessRead randomAccessRead)Parses a PDF.static PDDocumentloadPDF(RandomAccessRead randomAccessRead, java.lang.String password)Parses a PDF.static PDDocumentloadPDF(RandomAccessRead randomAccessRead, java.lang.String password, java.io.InputStream keyStore, java.lang.String alias)Parses a PDF.static PDDocumentloadPDF(RandomAccessRead randomAccessRead, java.lang.String password, java.io.InputStream keyStore, java.lang.String alias, RandomAccessStreamCache.StreamCacheCreateFunction streamCacheCreateFunction)Parses a PDF.static PDDocumentloadPDF(RandomAccessRead randomAccessRead, java.lang.String password, RandomAccessStreamCache.StreamCacheCreateFunction streamCacheCreateFunction)Parses a PDF.static PDDocumentloadPDF(RandomAccessRead randomAccessRead, RandomAccessStreamCache.StreamCacheCreateFunction streamCacheCreateFunction)Parses a PDF.static FDFDocumentloadXFDF(java.io.File file)This will load a document from a file.static FDFDocumentloadXFDF(java.io.InputStream input)This will load a document from an input stream.static FDFDocumentloadXFDF(java.lang.String filename)This will load a document from a file.
-
-
-
Method Detail
-
loadFDF
public static FDFDocument loadFDF(java.lang.String filename) throws java.io.IOException
This will load a document from a file.- Parameters:
filename- The name of the file to load.RandomAccessReadBufferedFileis used to read the file.- Returns:
- The document that was loaded.
- Throws:
java.io.IOException- If there is an error reading from the stream.
-
loadFDF
public static FDFDocument loadFDF(java.io.File file) throws java.io.IOException
This will load a document from a file.- Parameters:
file- The name of the file to load.RandomAccessReadBufferedFileis used to read the file.- Returns:
- The document that was loaded.
- Throws:
java.io.IOException- If there is an error reading from the stream.
-
loadFDF
public static FDFDocument loadFDF(java.io.InputStream input) throws java.io.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 streamRandomAccessReadBufferis used- Returns:
- The document that was loaded.
- Throws:
java.io.IOException- If there is an error reading from the stream.
-
loadXFDF
public static FDFDocument loadXFDF(java.lang.String filename) throws java.io.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:
java.io.IOException- If there is an error reading from the stream.
-
loadXFDF
public static FDFDocument loadXFDF(java.io.File file) throws java.io.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:
java.io.IOException- If there is an error reading from the stream.
-
loadXFDF
public static FDFDocument loadXFDF(java.io.InputStream input) throws java.io.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:
java.io.IOException- If there is an error reading from the stream.
-
loadPDF
public static PDDocument loadPDF(byte[] input) throws java.io.IOException
Parses a PDF. Unrestricted main memory will be used for buffering PDF streams.- Parameters:
input- byte array that contains the document.RandomAccessReadBufferis used to read the data.- Returns:
- loaded document
- Throws:
InvalidPasswordException- If the PDF required a non-empty password.java.io.IOException- In case of a reading or parsing error.
-
loadPDF
public static PDDocument loadPDF(byte[] input, java.lang.String password) throws java.io.IOException
Parses a PDF. Unrestricted main memory will be used for buffering PDF streams.- Parameters:
input- byte array that contains the document.RandomAccessReadBufferis used to read the data.password- password to be used for decryption- Returns:
- loaded document
- Throws:
InvalidPasswordException- If the password is incorrect.java.io.IOException- In case of a reading or parsing error.
-
loadPDF
public static PDDocument loadPDF(byte[] input, java.lang.String password, java.io.InputStream keyStore, java.lang.String alias) throws java.io.IOException
Parses a PDF. Unrestricted main memory will be used for buffering PDF streams.- Parameters:
input- byte array that contains the document.RandomAccessReadBufferis used to read the data.password- password to be used for decryptionkeyStore- key store to be used for decryption when using public key securityalias- alias to be used for decryption when using public key security- Returns:
- loaded document
- Throws:
InvalidPasswordException- If the password is incorrect.java.io.IOException- In case of a reading or parsing error.
-
loadPDF
public static PDDocument loadPDF(byte[] input, java.lang.String password, java.io.InputStream keyStore, java.lang.String alias, RandomAccessStreamCache.StreamCacheCreateFunction streamCacheCreateFunction) throws java.io.IOException
Parses a PDF.- Parameters:
input- byte array that contains the document.RandomAccessReadBufferis used to read the data.password- password to be used for decryptionkeyStore- key store to be used for decryption when using public key securityalias- alias to be used for decryption when using public key securitystreamCacheCreateFunction- 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.java.io.IOException- In case of a reading or parsing error.
-
loadPDF
public static PDDocument loadPDF(java.io.File file) throws java.io.IOException
Parses a PDF. Unrestricted main memory will be used for buffering PDF streams.- Parameters:
file- file to be loaded.RandomAccessReadBufferedFileis used to read the file.- Returns:
- loaded document
- Throws:
InvalidPasswordException- If the file required a non-empty password.java.io.IOException- in case of a file reading or parsing error
-
loadPDF
public static PDDocument loadPDF(java.io.File file, RandomAccessStreamCache.StreamCacheCreateFunction streamCacheCreateFunction) throws java.io.IOException
Parses a PDF.- Parameters:
file- file to be loaded.RandomAccessReadBufferedFileis 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.java.io.IOException- in case of a file reading or parsing error
-
loadPDF
public static PDDocument loadPDF(java.io.File file, java.lang.String password) throws java.io.IOException
Parses a PDF. Unrestricted main memory will be used for buffering PDF streams.- Parameters:
file- file to be loaded.RandomAccessReadBufferedFileis used to read the file.password- password to be used for decryption- Returns:
- loaded document
- Throws:
InvalidPasswordException- If the password is incorrect.java.io.IOException- in case of a file reading or parsing error
-
loadPDF
public static PDDocument loadPDF(java.io.File file, java.lang.String password, RandomAccessStreamCache.StreamCacheCreateFunction streamCacheCreateFunction) throws java.io.IOException
Parses a PDF.- Parameters:
file- file to be loaded.RandomAccessReadBufferedFileis used to read the file.password- password to be used for decryptionstreamCacheCreateFunction- 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.java.io.IOException- in case of a file reading or parsing error
-
loadPDF
public static PDDocument loadPDF(java.io.File file, java.lang.String password, java.io.InputStream keyStore, java.lang.String alias) throws java.io.IOException
Parses a PDF. Unrestricted main memory will be used for buffering PDF streams.- Parameters:
file- file to be loaded.RandomAccessReadBufferedFileis used to read the file.password- password to be used for decryptionkeyStore- key store to be used for decryption when using public key securityalias- alias to be used for decryption when using public key security- Returns:
- loaded document
- Throws:
java.io.IOException- in case of a file reading or parsing error
-
loadPDF
public static PDDocument loadPDF(java.io.File file, java.lang.String password, java.io.InputStream keyStore, java.lang.String alias, RandomAccessStreamCache.StreamCacheCreateFunction streamCacheCreateFunction) throws java.io.IOException
Parses a PDF.- Parameters:
file- file to be loaded.RandomAccessReadBufferedFileis used to read the file.password- password to be used for decryptionkeyStore- key store to be used for decryption when using public key securityalias- alias to be used for decryption when using public key securitystreamCacheCreateFunction- a function to create an instance of a stream cache to be used for buffering new/altered PDF streams- Returns:
- loaded document
- Throws:
java.io.IOException- in case of a file reading or parsing error
-
loadPDF
public static PDDocument loadPDF(RandomAccessRead randomAccessRead) throws java.io.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 aRandomAccessReadBuffer.- Returns:
- loaded document
- Throws:
InvalidPasswordException- If the PDF required a non-empty password.java.io.IOException- In case of a reading or parsing error.
-
loadPDF
public static PDDocument loadPDF(RandomAccessRead randomAccessRead, RandomAccessStreamCache.StreamCacheCreateFunction streamCacheCreateFunction) throws java.io.IOException
Parses a PDF.- Parameters:
randomAccessRead- random access read representing the pdf to be loaded. To pass an InputStream, wrap it into aRandomAccessReadBuffer.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.java.io.IOException- In case of a reading or parsing error.
-
loadPDF
public static PDDocument loadPDF(RandomAccessRead randomAccessRead, java.lang.String password) throws java.io.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 aRandomAccessReadBuffer.password- password to be used for decryption- Returns:
- loaded document
- Throws:
InvalidPasswordException- If the password is incorrect.java.io.IOException- In case of a reading or parsing error.
-
loadPDF
public static PDDocument loadPDF(RandomAccessRead randomAccessRead, java.lang.String password, java.io.InputStream keyStore, java.lang.String alias) throws java.io.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 aRandomAccessReadBuffer.password- password to be used for decryptionkeyStore- key store to be used for decryption when using public key securityalias- alias to be used for decryption when using public key security- Returns:
- loaded document
- Throws:
java.io.IOException- In case of a reading or parsing error.
-
loadPDF
public static PDDocument loadPDF(RandomAccessRead randomAccessRead, java.lang.String password, RandomAccessStreamCache.StreamCacheCreateFunction streamCacheCreateFunction) throws java.io.IOException
Parses a PDF.- Parameters:
randomAccessRead- random access read representing the pdf to be loaded. To pass an InputStream, wrap it into aRandomAccessReadBuffer.password- password to be used for decryptionstreamCacheCreateFunction- 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.java.io.IOException- In case of a reading or parsing error.
-
loadPDF
public static PDDocument loadPDF(RandomAccessRead randomAccessRead, java.lang.String password, java.io.InputStream keyStore, java.lang.String alias, RandomAccessStreamCache.StreamCacheCreateFunction streamCacheCreateFunction) throws java.io.IOException
Parses a PDF.- Parameters:
randomAccessRead- random access read representing the pdf to be loaded. To pass an InputStream, wrap it into aRandomAccessReadBuffer.password- password to be used for decryptionkeyStore- key store to be used for decryption when using public key securityalias- alias to be used for decryption when using public key securitystreamCacheCreateFunction- a function to create an instance of a stream cache to be used for buffering new/altered PDF streams- Returns:
- loaded document
- Throws:
java.io.IOException- in case of a file reading or parsing error
-
-