Package de.xima.fc.pdf.loader
Class PdDocumentLoader
- java.lang.Object
-
- de.xima.fc.pdf.loader.PdDocumentLoader
-
public final class PdDocumentLoader extends Object
Helper methods for loading aPDDocument
.- Since:
- 7.2.0
- Author:
- XIMA MEDIA GmbH
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.apache.pdfbox.pdmodel.PDDocument
load(byte[] pdf, String password)
Loads a PDF file via PDFBox into aPDDocument
.static org.apache.pdfbox.pdmodel.PDDocument
load(File pdf, String password)
Loads a PDF file via PDFBox into aPDDocument
.static org.apache.pdfbox.pdmodel.PDDocument
load(InputStream pdf, String password)
Loads a PDF file via PDFBox into aPDDocument
.static org.apache.pdfbox.pdmodel.PDDocument
load(Path pdf, String password)
Loads a PDF file via PDFBox into aPDDocument
.
-
-
-
Method Detail
-
load
public static org.apache.pdfbox.pdmodel.PDDocument load(byte[] pdf, String password) throws org.apache.pdfbox.pdmodel.encryption.InvalidPasswordException, IOException
Loads a PDF file via PDFBox into aPDDocument
. Make sure toclose
the document when done, prefer using a try-with-resources-statement.- Parameters:
pdf
- PDF file to open.password
- Password when the PDF is encrypted. Can benull
when not encrypted.- Returns:
- The loaded PDF document.
- Throws:
org.apache.pdfbox.pdmodel.encryption.InvalidPasswordException
- When the PDF is encrypted and the password in invalid.IOException
- When the PDF document could not be loaded.
-
load
public static org.apache.pdfbox.pdmodel.PDDocument load(File pdf, String password) throws org.apache.pdfbox.pdmodel.encryption.InvalidPasswordException, IOException
Loads a PDF file via PDFBox into aPDDocument
. Make sure toclose
the document when done, prefer using a try-with-resources-statement.- Parameters:
pdf
- PDF file to open.password
- Password when the PDF is encrypted. Can benull
when not encrypted.- Returns:
- The loaded PDF document.
- Throws:
org.apache.pdfbox.pdmodel.encryption.InvalidPasswordException
- When the PDF is encrypted and the password in invalid.IOException
- When the PDF document could not be loaded.
-
load
public static org.apache.pdfbox.pdmodel.PDDocument load(InputStream pdf, String password) throws org.apache.pdfbox.pdmodel.encryption.InvalidPasswordException, IOException
Loads a PDF file via PDFBox into aPDDocument
. Make sure toclose
the document when done, prefer using a try-with-resources-statement.- Parameters:
pdf
- PDF file to open.password
- Password when the PDF is encrypted. Can benull
when not encrypted.- Returns:
- The loaded PDF document.
- Throws:
org.apache.pdfbox.pdmodel.encryption.InvalidPasswordException
- When the PDF is encrypted and the password in invalid.IOException
- When the PDF document could not be loaded.
-
load
public static org.apache.pdfbox.pdmodel.PDDocument load(Path pdf, String password) throws org.apache.pdfbox.pdmodel.encryption.InvalidPasswordException, IOException
Loads a PDF file via PDFBox into aPDDocument
. Make sure toclose
the document when done, prefer using a try-with-resources-statement.- Parameters:
pdf
- PDF file to open.password
- Password when the PDF is encrypted. Can benull
when not encrypted.- Returns:
- The loaded PDF document.
- Throws:
org.apache.pdfbox.pdmodel.encryption.InvalidPasswordException
- When the PDF is encrypted and the password in invalid.IOException
- When the PDF document could not be loaded.
-
-