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 TypeMethodDescriptionvoidThis method checks if the document is not encrypted or with limited edition rightsExtracts 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 documentbooleanisSignatureCoversWholeDocument(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 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
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
-
checkDocumentPermissions
void checkDocumentPermissions()This method checks if the document is not encrypted or with limited edition rights -
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
-