Class PdDocumentLoader

java.lang.Object
de.xima.fc.pdf.loader.PdDocumentLoader

public final class PdDocumentLoader extends Object
Helper methods for loading a PDDocument.
Since:
7.2.0
Author:
XIMA MEDIA GmbH
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.apache.pdfbox.pdmodel.PDDocument
    load(byte[] pdf, String password)
    Loads a PDF file via PDFBox into a PDDocument.
    static org.apache.pdfbox.pdmodel.PDDocument
    load(File pdf, String password)
    Loads a PDF file via PDFBox into a PDDocument.
    static org.apache.pdfbox.pdmodel.PDDocument
    load(InputStream pdf, String password)
    Loads a PDF file via PDFBox into a PDDocument.
    static org.apache.pdfbox.pdmodel.PDDocument
    load(Path pdf, String password)
    Loads a PDF file via PDFBox into a PDDocument.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • 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 a PDDocument. Make sure to close 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 be null 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 a PDDocument. Make sure to close 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 be null 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 a PDDocument. Make sure to close 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 be null 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 a PDDocument. Make sure to close 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 be null 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.