Package eu.europa.esig.dss.pdf.pdfbox
Class PdfBoxDocumentReader
java.lang.Object
eu.europa.esig.dss.pdf.pdfbox.PdfBoxDocumentReader
- All Implemented Interfaces:
PdfDocumentReader
,Closeable
,AutoCloseable
public class PdfBoxDocumentReader extends Object implements PdfDocumentReader
-
Constructor Summary
Constructors Constructor Description PdfBoxDocumentReader(byte[] binaries, String passwordProtection)
The PDFBox implementation of the ReaderPdfBoxDocumentReader(DSSDocument dssDocument)
Default constructor of the PDFBox implementation of the ReaderPdfBoxDocumentReader(DSSDocument dssDocument, String passwordProtection)
The PDFBox implementation of the Reader -
Method Summary
Modifier and Type Method Description void
close()
Map<PdfSignatureDictionary,List<String>>
extractSigDictionaries()
Extracts PdfSignatureSictionaries present in the signaturePdfDssDict
getDSSDictionary()
Loads the last DSS dictionary from the document if exists NOTE: can return null if DSS dictionary is not presentboolean
isSignatureCoversWholeDocument(PdfSignatureDictionary signatureDictionary)
Checks if a signature for the given PDF Signature Dictionary covers the whole document
-
Constructor Details
-
PdfBoxDocumentReader
Default constructor of the PDFBox implementation of the Reader- Parameters:
dssDocument
-DSSDocument
to read- Throws:
IOException
- if an exception occursInvalidPasswordException
- if the password is not provided or invalid for a protected document
-
PdfBoxDocumentReader
public PdfBoxDocumentReader(DSSDocument dssDocument, String passwordProtection) throws IOException, InvalidPasswordExceptionThe PDFBox implementation of the Reader- Parameters:
dssDocument
-DSSDocument
to readpasswordProtection
-String
a password to open a protected document- Throws:
IOException
- if an exception occursInvalidPasswordException
- if the password is not provided or invalid for a protected document
-
PdfBoxDocumentReader
public PdfBoxDocumentReader(byte[] binaries, String passwordProtection) throws IOException, InvalidPasswordExceptionThe PDFBox implementation of the Reader- Parameters:
binaries
- a byte array of a PDF to readpasswordProtection
-String
a password to open a protected document- Throws:
IOException
- if an exception occursInvalidPasswordException
- if the password is not provided or invalid for a protected document
-
-
Method Details
-
getDSSDictionary
Description copied from interface:PdfDocumentReader
Loads the last DSS dictionary from the document if exists NOTE: can return null if DSS dictionary is not present- Specified by:
getDSSDictionary
in interfacePdfDocumentReader
- Returns:
PdfDssDict
-
extractSigDictionaries
Description copied from interface:PdfDocumentReader
Extracts PdfSignatureSictionaries present in the signature- Specified by:
extractSigDictionaries
in interfacePdfDocumentReader
- Returns:
- a map between
PdfSignatureDictionary
and related field names - Throws:
IOException
- if an exception occurs
-
isSignatureCoversWholeDocument
Description copied from interface:PdfDocumentReader
Checks if a signature for the given PDF Signature Dictionary covers the whole document- Specified by:
isSignatureCoversWholeDocument
in interfacePdfDocumentReader
- Parameters:
signatureDictionary
-PdfSignatureDictionary
to check the result for- Returns:
- TRUE if the signature covers the whole document, false otherwise
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-