Package eu.europa.esig.dss.pdf.openpdf
Class ITextPDFSignatureService
java.lang.Object
eu.europa.esig.dss.pdf.AbstractPDFSignatureService
eu.europa.esig.dss.pdf.openpdf.ITextPDFSignatureService
- All Implemented Interfaces:
PDFSignatureService
public class ITextPDFSignatureService extends AbstractPDFSignatureService
Implementation of PDFSignatureService using iText
-
Field Summary
Fields inherited from class eu.europa.esig.dss.pdf.AbstractPDFSignatureService
serviceMode, signatureDrawerFactory -
Constructor Summary
Constructors Constructor Description ITextPDFSignatureService(PDFServiceMode serviceMode, ITextSignatureDrawerFactory signatureDrawerFactory)Constructor for the ITextPDFSignatureService -
Method Summary
Modifier and Type Method Description DSSDocumentaddDssDictionary(DSSDocument document, List<DSSDictionaryCallback> callbacks, String pwd)This method adds the DSS dictionary (Baseline-LT)DSSDocumentaddNewSignatureField(DSSDocument document, SignatureFieldParameters parameters, String pwd)This method allows to add a new signature field to an existing encrypted pdf documentprotected voidcheckDocumentPermissions(DSSDocument toSignDocument, String pwd)This method checks if the document is not encrypted or with limited edition rightsbyte[]digest(DSSDocument toSignDocument, PAdESCommonParameters parameters)Returns the digest value of a PDF documentList<String>getAvailableSignatureFields(DSSDocument document, String pwd)Returns not-signed signature fields from an encrypted documentprotected PdfDocumentReaderloadPdfDocumentReader(byte[] binaries, String passwordProtection)LoadsPdfDocumentReaderinstanceprotected PdfDocumentReaderloadPdfDocumentReader(DSSDocument dssDocument, String passwordProtection)LoadsPdfDocumentReaderinstanceDSSDocumentsign(DSSDocument toSignDocument, byte[] signatureValue, PAdESCommonParameters parameters)Signs a PDF documentMethods inherited from class eu.europa.esig.dss.pdf.AbstractPDFSignatureService
addDssDictionary, addNewSignatureField, buildKnownObjects, extractBeforeSignatureValue, getAvailableSignatureFields, getRevisions, getSignatureValue, getTokenDigest, getType, isContentValueEqualsByteRangeExtraction, isDocTimestamp, isDocumentTimestampLayer, isSignature
-
Constructor Details
-
ITextPDFSignatureService
public ITextPDFSignatureService(PDFServiceMode serviceMode, ITextSignatureDrawerFactory signatureDrawerFactory)Constructor for the ITextPDFSignatureService- Parameters:
serviceMode- current instance is used to generate DocumentTypestamp or Signature signature layersignatureDrawerFactory- drawer factory implementation to be used
-
-
Method Details
-
checkDocumentPermissions
Description copied from class:AbstractPDFSignatureServiceThis method checks if the document is not encrypted or with limited edition rights- Specified by:
checkDocumentPermissionsin classAbstractPDFSignatureService- Parameters:
toSignDocument- the document which will be modifiedpwd-Stringpassword protection phrase used to encrypt the document
-
digest
Description copied from interface:PDFSignatureServiceReturns the digest value of a PDF document- Parameters:
toSignDocument- the document to be signedparameters- the signature/timestamp parameters- Returns:
- the digest value
-
sign
public DSSDocument sign(DSSDocument toSignDocument, byte[] signatureValue, PAdESCommonParameters parameters)Description copied from interface:PDFSignatureServiceSigns a PDF document- Parameters:
toSignDocument- the pdf documentsignatureValue- the signature valueparameters- the signature/timestamp parameters
-
addDssDictionary
public DSSDocument addDssDictionary(DSSDocument document, List<DSSDictionaryCallback> callbacks, String pwd)Description copied from interface:PDFSignatureServiceThis method adds the DSS dictionary (Baseline-LT)- Parameters:
document- the document to be extendedcallbacks- the callbacks to retrieve the revocation data,...pwd- the password protection used to create the encrypted document- Returns:
- the pdf document with the added dss dictionary
-
getAvailableSignatureFields
Description copied from interface:PDFSignatureServiceReturns not-signed signature fields from an encrypted document- Parameters:
document- the pdf documentpwd- the password protection phrase used to encrypt the document- Returns:
- the list of not signed signature field names
-
addNewSignatureField
public DSSDocument addNewSignatureField(DSSDocument document, SignatureFieldParameters parameters, String pwd)Description copied from interface:PDFSignatureServiceThis method allows to add a new signature field to an existing encrypted pdf document- Parameters:
document- the pdf documentparameters- the parameters with the coordinates,... of the signature fieldpwd- the password protection used to create the encrypted document- Returns:
- the pdf document with the new added signature field
-
loadPdfDocumentReader
protected PdfDocumentReader loadPdfDocumentReader(DSSDocument dssDocument, String passwordProtection) throws IOExceptionDescription copied from class:AbstractPDFSignatureServiceLoadsPdfDocumentReaderinstance- Specified by:
loadPdfDocumentReaderin classAbstractPDFSignatureService- Parameters:
dssDocument-DSSDocumentto readpasswordProtection-Stringthe password used to protect the document- Throws:
IOException- in case of loading error
-
loadPdfDocumentReader
protected PdfDocumentReader loadPdfDocumentReader(byte[] binaries, String passwordProtection) throws IOExceptionDescription copied from class:AbstractPDFSignatureServiceLoadsPdfDocumentReaderinstance- Specified by:
loadPdfDocumentReaderin classAbstractPDFSignatureService- Parameters:
binaries- a byte arraypasswordProtection-Stringthe password used to protect the document- Throws:
IOException- in case of loading error
-