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 TypeMethodDescriptionbooleanThis method verifies whether creation of new signature fields is allowed by the PDF permissions dictionarybooleanThis method verifies whether fill-in of existing signature fields is allowed by PDF document permissions dictionaryCreates an emptyPdfArrayCreates an emptyPdfDictExtracts 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 ofannotationBoxesReturns 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 presentintReturns an amount of pages found in the documentgetPageBox(int page) Returns a page box dimensionsintgetPageRotation(int page) This method returns a corresponding page's rotation within the documentgetPdfAnnotations(int page) Retrieves all annotations found in the documentfloatReturns version of the PDF document defined in the document's header.floatReturns version of the PDF document.booleanThis method checks whether the document is encryptedbooleanThis method verifies if the document has been opened with a full owner access (all modifications are permitted)booleanisSignatureCoversWholeDocument(PdfSignatureDictionary signatureDictionary) Checks if a signature for the given PDF Signature Dictionary covers the whole documentbooleanThis method verifies whether a PDF contains a usage rights signaturevoidsetVersion(float version) Sets PDF version number, by upgrading /Catalog dictionary /Version parameter
-
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
PdfSignatureDictionaryand relatedPdfSignatureFields - Throws:
IOException- if an exception occurs
-
isSignatureCoversWholeDocument
Checks if a signature for the given PDF Signature Dictionary covers the whole document- Parameters:
signatureDictionary-PdfSignatureDictionaryto 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:
AnnotationBoxrepresenting 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
PdfAnnotations 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:
BufferedImagescreenshot 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 ofPdfAnnotations to be hidden- Returns:
BufferedImagescreenshot for the given page- Throws:
IOException- if an exception occurs
-
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
-
getPdfHeaderVersion
float getPdfHeaderVersion()Returns version of the PDF document defined in the document's header.- Returns:
- document version from file's header
-
getVersion
float getVersion()Returns version of the PDF document. Returns version defined in the file header, or catalog's /Version, when latest is present.- Returns:
- document version
-
setVersion
void setVersion(float version) Sets PDF version number, by upgrading /Catalog dictionary /Version parameter- Parameters:
version- value (e.g. 1.7)
-
createPdfDict
-
createPdfArray
-