java.lang.Object
eu.europa.esig.dss.pdf.pdfbox.PdfBoxDocumentReader
- All Implemented Interfaces:
eu.europa.esig.dss.pdf.PdfDocumentReader,Closeable,AutoCloseable
public class PdfBoxDocumentReader
extends Object
implements eu.europa.esig.dss.pdf.PdfDocumentReader
The PDFBox implementation of
PdfDocumentReader-
Constructor Summary
ConstructorsConstructorDescriptionPdfBoxDocumentReader(eu.europa.esig.dss.model.DSSDocument dssDocument) Default constructor of the PDFBox implementation of the Reader.PdfBoxDocumentReader(eu.europa.esig.dss.model.DSSDocument dssDocument, String passwordProtection) Constructor of the PDFBox implementation of the Reader with a password protection phrase provided.PdfBoxDocumentReader(eu.europa.esig.dss.model.DSSDocument dssDocument, String passwordProtection, eu.europa.esig.dss.pdf.PdfMemoryUsageSetting pdfMemoryUsageSetting) Constructor of the PDFBox implementation of the Reader with a password protection phrase and memory usage settings provided. -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanvoidclose()org.apache.pdfbox.cos.COSStreamcreateCOSStream(byte[] binaries) Creates aCOSStreamwith givenbinarieseu.europa.esig.dss.pdf.PdfArrayeu.europa.esig.dss.pdf.PdfDictMap<eu.europa.esig.dss.pades.validation.PdfSignatureDictionary, List<eu.europa.esig.dss.pades.validation.PdfSignatureField>> longgenerateDocumentId(eu.europa.esig.dss.pades.PAdESCommonParameters parameters) Computes a DocumentId in a deterministic way based on the givenparametersand the documentgenerateImageScreenshot(int page) generateImageScreenshotWithoutAnnotations(int page, List<eu.europa.esig.dss.pdf.PdfAnnotation> annotations) eu.europa.esig.dss.pdf.PdfDicteu.europa.esig.dss.enumerations.CertificationPermissioneu.europa.esig.dss.pdf.PdfDssDictintorg.apache.pdfbox.cos.COSObjectgetObjectByKey(eu.europa.esig.dss.pades.validation.PdfObjectKey objectKey) GetsCOSObjectfrom the PDF by the givenobjectKeyeu.europa.esig.dss.pdf.AnnotationBoxgetPageBox(int page) intgetPageRotation(int page) org.apache.pdfbox.pdmodel.PDDocumentReturns the current instance ofPDDocumentList<eu.europa.esig.dss.pdf.PdfAnnotation> getPdfAnnotations(int page) floatorg.apache.pdfbox.pdmodel.PDPagegetPDPage(int page) Returns aPDPagefloatbooleanbooleanbooleanisSignatureCoversWholeDocument(eu.europa.esig.dss.pades.validation.PdfSignatureDictionary signatureDictionary) booleanvoidsetVersion(float version)
-
Constructor Details
-
PdfBoxDocumentReader
public PdfBoxDocumentReader(eu.europa.esig.dss.model.DSSDocument dssDocument) throws IOException, eu.europa.esig.dss.pades.exception.InvalidPasswordException Default constructor of the PDFBox implementation of the Reader. This constructor uses in-memory processing of the document.- Parameters:
dssDocument-DSSDocumentto read- Throws:
IOException- if an exception occurseu.europa.esig.dss.pades.exception.InvalidPasswordException- if the password is not provided or invalid for a protected document
-
PdfBoxDocumentReader
public PdfBoxDocumentReader(eu.europa.esig.dss.model.DSSDocument dssDocument, String passwordProtection) throws IOException, eu.europa.esig.dss.pades.exception.InvalidPasswordException Constructor of the PDFBox implementation of the Reader with a password protection phrase provided. This constructor uses in-memory processing of the document.- Parameters:
dssDocument-DSSDocumentto readpasswordProtection-Stringa password to open a protected document- Throws:
IOException- if an exception occurseu.europa.esig.dss.pades.exception.InvalidPasswordException- if the password is not provided or invalid for a protected document
-
PdfBoxDocumentReader
public PdfBoxDocumentReader(eu.europa.esig.dss.model.DSSDocument dssDocument, String passwordProtection, eu.europa.esig.dss.pdf.PdfMemoryUsageSetting pdfMemoryUsageSetting) throws IOException, eu.europa.esig.dss.pades.exception.InvalidPasswordException Constructor of the PDFBox implementation of the Reader with a password protection phrase and memory usage settings provided.- Parameters:
dssDocument-DSSDocumentto readpasswordProtection-Stringa password to open a protected documentpdfMemoryUsageSetting-MemoryUsageSettingPDF loading setting- Throws:
IOException- if an exception occurseu.europa.esig.dss.pades.exception.InvalidPasswordException- if the password is not provided or invalid for a protected document
-
-
Method Details
-
getPDDocument
public org.apache.pdfbox.pdmodel.PDDocument getPDDocument()Returns the current instance ofPDDocument- Returns:
PDDocument
-
getDSSDictionary
public eu.europa.esig.dss.pdf.PdfDssDict getDSSDictionary()- Specified by:
getDSSDictionaryin interfaceeu.europa.esig.dss.pdf.PdfDocumentReader
-
extractSigDictionaries
public Map<eu.europa.esig.dss.pades.validation.PdfSignatureDictionary,List<eu.europa.esig.dss.pades.validation.PdfSignatureField>> extractSigDictionaries() throws IOException- Specified by:
extractSigDictionariesin interfaceeu.europa.esig.dss.pdf.PdfDocumentReader- Throws:
IOException
-
isSignatureCoversWholeDocument
public boolean isSignatureCoversWholeDocument(eu.europa.esig.dss.pades.validation.PdfSignatureDictionary signatureDictionary) - Specified by:
isSignatureCoversWholeDocumentin interfaceeu.europa.esig.dss.pdf.PdfDocumentReader
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
getNumberOfPages
public int getNumberOfPages()- Specified by:
getNumberOfPagesin interfaceeu.europa.esig.dss.pdf.PdfDocumentReader
-
getPageBox
public eu.europa.esig.dss.pdf.AnnotationBox getPageBox(int page) - Specified by:
getPageBoxin interfaceeu.europa.esig.dss.pdf.PdfDocumentReader
-
getPageRotation
public int getPageRotation(int page) - Specified by:
getPageRotationin interfaceeu.europa.esig.dss.pdf.PdfDocumentReader
-
getPdfAnnotations
- Specified by:
getPdfAnnotationsin interfaceeu.europa.esig.dss.pdf.PdfDocumentReader- Throws:
IOException
-
getPDPage
public org.apache.pdfbox.pdmodel.PDPage getPDPage(int page) Returns aPDPage- Parameters:
page- number- Returns:
PDPage
-
getObjectByKey
public org.apache.pdfbox.cos.COSObject getObjectByKey(eu.europa.esig.dss.pades.validation.PdfObjectKey objectKey) GetsCOSObjectfrom the PDF by the givenobjectKey- Parameters:
objectKey-PdfObjectKeyto get object for- Returns:
COSObjectwhen the object corresponding to the defined key found, NULL otherwise
-
createCOSStream
public org.apache.pdfbox.cos.COSStream createCOSStream(byte[] binaries) Creates aCOSStreamwith givenbinaries- Parameters:
binaries- binary array to be included to the stream- Returns:
COSStream
-
generateImageScreenshot
- Specified by:
generateImageScreenshotin interfaceeu.europa.esig.dss.pdf.PdfDocumentReader- Throws:
IOException
-
generateImageScreenshotWithoutAnnotations
public BufferedImage generateImageScreenshotWithoutAnnotations(int page, List<eu.europa.esig.dss.pdf.PdfAnnotation> annotations) throws IOException - Specified by:
generateImageScreenshotWithoutAnnotationsin interfaceeu.europa.esig.dss.pdf.PdfDocumentReader- Throws:
IOException
-
isEncrypted
public boolean isEncrypted()- Specified by:
isEncryptedin interfaceeu.europa.esig.dss.pdf.PdfDocumentReader
-
isOpenWithOwnerAccess
public boolean isOpenWithOwnerAccess()- Specified by:
isOpenWithOwnerAccessin interfaceeu.europa.esig.dss.pdf.PdfDocumentReader
-
canFillSignatureForm
public boolean canFillSignatureForm()- Specified by:
canFillSignatureFormin interfaceeu.europa.esig.dss.pdf.PdfDocumentReader
-
canCreateSignatureField
public boolean canCreateSignatureField()- Specified by:
canCreateSignatureFieldin interfaceeu.europa.esig.dss.pdf.PdfDocumentReader
-
getCertificationPermission
public eu.europa.esig.dss.enumerations.CertificationPermission getCertificationPermission()- Specified by:
getCertificationPermissionin interfaceeu.europa.esig.dss.pdf.PdfDocumentReader
-
isUsageRightsSignaturePresent
public boolean isUsageRightsSignaturePresent()- Specified by:
isUsageRightsSignaturePresentin interfaceeu.europa.esig.dss.pdf.PdfDocumentReader
-
getCatalogDictionary
public eu.europa.esig.dss.pdf.PdfDict getCatalogDictionary()- Specified by:
getCatalogDictionaryin interfaceeu.europa.esig.dss.pdf.PdfDocumentReader
-
generateDocumentId
public long generateDocumentId(eu.europa.esig.dss.pades.PAdESCommonParameters parameters) Computes a DocumentId in a deterministic way based on the givenparametersand the document- Parameters:
parameters-PAdESCommonParameters- Returns:
- deterministic identifier
-
getPdfHeaderVersion
public float getPdfHeaderVersion()- Specified by:
getPdfHeaderVersionin interfaceeu.europa.esig.dss.pdf.PdfDocumentReader
-
getVersion
public float getVersion()- Specified by:
getVersionin interfaceeu.europa.esig.dss.pdf.PdfDocumentReader
-
setVersion
public void setVersion(float version) - Specified by:
setVersionin interfaceeu.europa.esig.dss.pdf.PdfDocumentReader
-
createPdfDict
public eu.europa.esig.dss.pdf.PdfDict createPdfDict()- Specified by:
createPdfDictin interfaceeu.europa.esig.dss.pdf.PdfDocumentReader
-
createPdfArray
public eu.europa.esig.dss.pdf.PdfArray createPdfArray()- Specified by:
createPdfArrayin interfaceeu.europa.esig.dss.pdf.PdfDocumentReader
-