Package eu.europa.esig.dss.pdf
Interface PdfDocumentReader
- All Superinterfaces:
AutoCloseable
,Closeable
- All Known Implementing Classes:
ITextDocumentReader
,PdfBoxDocumentReader
Reads the PDF Document
-
Method Summary
Modifier and TypeMethodDescriptionboolean
This method verifies whether creation of new signature fields is allowed by the PDF permissions dictionaryboolean
This method verifies whether fill-in of existing signature fields is allowed by PDF document permissions dictionaryvoid
Deprecated.since DSS 5.12.Extracts PdfSignatureDictionaries present in the signaturegenerateImageScreenshot
(int page) Generates the image screenshot for the given page of the PDFgenerateImageScreenshotWithoutAnnotations
(int page, List<PdfAnnotation> addedAnnotations) Generates the image screenshot by hiding the given list ofannotationBoxes
Returns a document catalog as a dictionaryReturns value of /DocMDP dictionary defining the permitted modification in a PDF, when presentLoads the last DSS dictionary from the document if exists NOTE: can return null if DSS dictionary is not presentint
Returns an amount of pages found in the documentgetPageBox
(int page) Returns a page box dimensionsint
getPageRotation
(int page) This method returns a corresponding page's rotation within the documentgetPdfAnnotations
(int page) Retrieves all annotations found in the documentboolean
This method checks whether the document is encryptedboolean
This method verifies if the document has been opened with a full owner access (all modifications are permitted)boolean
isSignatureCoversWholeDocument
(PdfSignatureDictionary signatureDictionary) Checks if a signature for the given PDF Signature Dictionary covers the whole documentboolean
This method verifies whether a PDF contains a usage rights signature
-
Method Details
-
getDSSDictionary
PdfDssDict getDSSDictionary()Loads the last DSS dictionary from the document if exists NOTE: can return null if DSS dictionary is not present- Returns:
PdfDssDict
-
extractSigDictionaries
Extracts PdfSignatureDictionaries present in the signature- Returns:
- a map between
PdfSignatureDictionary
and relatedPdfSignatureField
s - Throws:
IOException
- if an exception occurs
-
isSignatureCoversWholeDocument
Checks if a signature for the given PDF Signature Dictionary covers the whole document- Parameters:
signatureDictionary
-PdfSignatureDictionary
to check the result for- Returns:
- TRUE if the signature covers the whole document, false otherwise
-
getNumberOfPages
int getNumberOfPages()Returns an amount of pages found in the document- Returns:
- number of pages
-
getPageBox
Returns a page box dimensions- Parameters:
page
- number of a page to get annotation box of- Returns:
AnnotationBox
representing page dimensions
-
getPageRotation
int getPageRotation(int page) This method returns a corresponding page's rotation within the document- Parameters:
page
- number of a page to get rotation of- Returns:
- rotation degrees
-
getPdfAnnotations
Retrieves all annotations found in the document- Parameters:
page
- number- Returns:
- a list of
PdfAnnotation
s associated with the given page - Throws:
IOException
- if an exception occurs
-
generateImageScreenshot
Generates the image screenshot for the given page of the PDF- Parameters:
page
- number to be generated- Returns:
BufferedImage
screenshot for the given page- Throws:
IOException
- if an exception occurs
-
generateImageScreenshotWithoutAnnotations
BufferedImage generateImageScreenshotWithoutAnnotations(int page, List<PdfAnnotation> addedAnnotations) throws IOException Generates the image screenshot by hiding the given list ofannotationBoxes
- Parameters:
page
- number to be generatedaddedAnnotations
- a list ofPdfAnnotation
s to be hidden- Returns:
BufferedImage
screenshot for the given page- Throws:
IOException
- if an exception occurs
-
checkDocumentPermissions
Deprecated.since DSS 5.12. Please useeu.europa.esig.dss.pdf.PdfPermissionsChecker
class. See also {code #canFillSignatureForm} and#canCreateSignatureField
for custom handling.This method checks if the document is not encrypted or with limited edition rights -
isEncrypted
boolean isEncrypted()This method checks whether the document is encrypted- Returns:
- TRUE if the document is encrypted, FALSE otherwise
-
isOpenWithOwnerAccess
boolean isOpenWithOwnerAccess()This method verifies if the document has been opened with a full owner access (all modifications are permitted)- Returns:
- TRUE if the document has been open with a full access, FALSE otherwise
-
canFillSignatureForm
boolean canFillSignatureForm()This method verifies whether fill-in of existing signature fields is allowed by PDF document permissions dictionary- Returns:
- TRUE if fill-in signature forms is permitted, FALSE otherwise
-
canCreateSignatureField
boolean canCreateSignatureField()This method verifies whether creation of new signature fields is allowed by the PDF permissions dictionary- Returns:
- TRUE if the new signature field creation is permitted, FALSE otherwise
-
getCertificationPermission
CertificationPermission getCertificationPermission()Returns value of /DocMDP dictionary defining the permitted modification in a PDF, when present- Returns:
CertificationPermission
-
isUsageRightsSignaturePresent
boolean isUsageRightsSignaturePresent()This method verifies whether a PDF contains a usage rights signature- Returns:
- TRUE of a PDF contains a usage rights signature, FALSE otherwise
-
getCatalogDictionary
PdfDict getCatalogDictionary()Returns a document catalog as a dictionary- Returns:
PdfDict
-