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 DSSDocument
addDssDictionary(DSSDocument document, List<DSSDictionaryCallback> callbacks, String pwd)
This method adds the DSS dictionary (Baseline-LT)DSSDocument
addNewSignatureField(DSSDocument document, SignatureFieldParameters parameters, String pwd)
This method allows to add a new signature field to an existing encrypted pdf documentprotected void
checkDocumentPermissions(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 PdfDocumentReader
loadPdfDocumentReader(byte[] binaries, String passwordProtection)
LoadsPdfDocumentReader
instanceprotected PdfDocumentReader
loadPdfDocumentReader(DSSDocument dssDocument, String passwordProtection)
LoadsPdfDocumentReader
instanceDSSDocument
sign(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:AbstractPDFSignatureService
This method checks if the document is not encrypted or with limited edition rights- Specified by:
checkDocumentPermissions
in classAbstractPDFSignatureService
- Parameters:
toSignDocument
- the document which will be modifiedpwd
-String
password protection phrase used to encrypt the document
-
digest
Description copied from interface:PDFSignatureService
Returns 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:PDFSignatureService
Signs 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:PDFSignatureService
This 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:PDFSignatureService
Returns 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:PDFSignatureService
This 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:AbstractPDFSignatureService
LoadsPdfDocumentReader
instance- Specified by:
loadPdfDocumentReader
in classAbstractPDFSignatureService
- Parameters:
dssDocument
-DSSDocument
to readpasswordProtection
-String
the 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:AbstractPDFSignatureService
LoadsPdfDocumentReader
instance- Specified by:
loadPdfDocumentReader
in classAbstractPDFSignatureService
- Parameters:
binaries
- a byte arraypasswordProtection
-String
the password used to protect the document- Throws:
IOException
- in case of loading error
-