Aspose::Pdf::Facades::PdfFileSignature Class Referencefinal

Represents a class to sign a pdf file with a certificate. More...

Inherits Aspose::Pdf::Facades::SaveableFacade.

Public Member Functions

System::String get_SignatureAppearance ()
 Sets or gets a graphic appearance for the signature. Property value represents image file name. More...
 
void set_SignatureAppearance (System::String value)
 Sets or gets a graphic appearance for the signature. Property value represents image file name. More...
 
bool get_IsCertified ()
 Gets the flag determining whether a document is certified or not. More...
 
System::SharedPtr< System::IO::Streamget_SignatureAppearanceStream ()
 Sets or gets a graphic appearance for the signature. Property value represents image stream. More...
 
void set_SignatureAppearanceStream (System::SharedPtr< System::IO::Stream > value)
 Sets or gets a graphic appearance for the signature. Property value represents image stream. More...
 
 PdfFileSignature ()
 The constructor of PdfFileSignature class. More...
 
 PdfFileSignature (System::String inputFile)
 The constructor of PdfFileSignature class. More...
 
 PdfFileSignature (System::String inputFile, System::String outputFile)
 The constructor of PdfFileSignature class. More...
 
virtual void BindPdf (System::String inputFile)
 Binds a Pdf file for editing. More...
 
virtual void BindPdf (System::SharedPtr< System::IO::Stream > inputStream)
 Binds a Pdf stream for editing. More...
 
virtual void Save (System::String outputFile)
 Saves the result PDF to file. More...
 
virtual void Save (System::SharedPtr< System::IO::Stream > outputStream)
 Saves the result PDF to stream. More...
 
void Sign (int32_t page, System::String SigReason, System::String SigContact, System::String SigLocation, bool visible, System::Drawing::Rectangle annotRect)
 Make a signature on the pdf document. More...
 
void Sign (int32_t page, System::String SigReason, System::String SigContact, System::String SigLocation, bool visible, System::Drawing::Rectangle annotRect, System::SharedPtr< Aspose::Pdf::Forms::Signature > sig)
 Sign the document with the given type signature. More...
 
void Sign (int32_t page, bool visible, System::Drawing::Rectangle annotRect, System::SharedPtr< Aspose::Pdf::Forms::Signature > sig)
 Sign the document with the given type signature. More...
 
void Sign (System::String SigName, System::String SigReason, System::String SigContact, System::String SigLocation, System::SharedPtr< Aspose::Pdf::Forms::Signature > sig)
 Sign the document with the given type signature which is placed in already presented signature field. Before signing signature field must be empty, i.e. field must not contain signature dictionary. Thus pdf document already has signature field, you should not supply the place to stamp the signature, corresponding page and rectangle are taken from signature field which is found by signature name (see SigName parameter). More...
 
void Sign (int32_t page, System::String SigName, System::String SigReason, System::String SigContact, System::String SigLocation, bool visible, System::Drawing::Rectangle annotRect, System::SharedPtr< Aspose::Pdf::Forms::Signature > sig)
 Sign the document with the given type signature which is placed in already presented signature field. Before signing pdf document should already has signature field, corresponding page and rectangle are taken from signature field which is found by signature name (see SigName parameter). More...
 
void Sign (System::String SigName, System::SharedPtr< Aspose::Pdf::Forms::Signature > sig)
 Sign the document with the given type signature which is placed in already presented signature field. Before signing signature field must be empty, i.e. field must not contain signature dictionary. Thus pdf document already has signature field, you should not supply the place to stamp the signature, corresponding page and rectangle are taken from signature field which is found by signature name (see SigName parameter). Such data as signature reason, contact and location must be provided by corresponding properties of the Signature object sig. More...
 
Aspose::Pdf::Forms::DocMDPAccessPermissions GetAccessPermissions ()
 Returns the access permissions value of certified document by the MDP signature type. More...
 
void Certify (int32_t page, System::String SigReason, System::String SigContact, System::String SigLocation, bool visible, System::Drawing::Rectangle annotRect, System::SharedPtr< Aspose::Pdf::Forms::DocMDPSignature > docMdpSignature)
 Certify the document with the MDP signature. Such data as signature reason, contact and location must be provided by corresponding properties of the Signature object sig. More...
 
System::SharedPtr< System::Collections::Generic::IList< System::String > > GetSignNames ()
 Gets the names of all not empty signatures. More...
 
System::SharedPtr< System::Collections::Generic::IList< System::String > > GetBlankSignNames ()
 Gets the names of all empty signature fields. More...
 
bool IsContainSignature ()
 Checks if the pdf has a digital signature or not. More...
 
bool ContainsSignature ()
 Checks if the pdf has a digital signature or not. More...
 
bool ContainsUsageRights ()
 Checks if the pdf has a usage rights or not. More...
 
bool IsCoversWholeDocument (System::String signName)
 Checks if the signature covers the whole document. More...
 
bool CoversWholeDocument (System::String signName)
 Checks if the signature covers the whole document. More...
 
int32_t GetRevision (System::String signName)
 Gets the revision of a signature. More...
 
int32_t GetTotalRevision ()
 Gets the toltal revision. More...
 
void RemoveUsageRights ()
 Removes the usage rights entry. More...
 
void RemoveSignature (System::String signName)
 Remove the signature according to the name of the signature. More...
 
void RemoveSignature (System::String signName, bool removeField)
 Removes the signature according to the name of the signature. More...
 
bool VerifySigned (System::String signName)
 Checks the validity of a signature. More...
 
System::String GetSignerName (System::String signName)
 Gets the name of person or organization who signing the pdf document. More...
 
System::DateTime GetDateTime (System::String signName)
 Gets the signature's datetime. More...
 
System::String GetReason (System::String signName)
 Gets the reason of a signature. More...
 
System::String GetLocation (System::String signName)
 Gets the location of a signature. More...
 
System::String GetContactInfo (System::String signName)
 Gets the contact information of a signature. More...
 
bool VerifySignature (System::String signName)
 Checks the validity of a signature. More...
 
System::SharedPtr< System::IO::StreamExtractImage (System::String signName)
 Extracts signature's image. More...
 
System::SharedPtr< System::IO::StreamExtractCertificate (System::String signName)
 Extracts signature's single X.509 certificate as a stream. More...
 
void Save ()
 Save signed pdf file. Output filename must be provided before with the help of coresponding PdfFileSignature constructor. More...
 
 PdfFileSignature (System::SharedPtr< Aspose::Pdf::Document > document)
 Initializes new PdfFileSignature object on base of the document . More...
 
 PdfFileSignature (System::SharedPtr< Aspose::Pdf::Document > document, System::String outputFile)
 Initializes new PdfFileSignature object on base of the document . More...
 
void SetCertificate (System::String pfx, System::String pass)
 Set certificate file and password for signing routine. More...
 
virtual void Close ()
 Closes the facade. More...
 
- Public Member Functions inherited from Aspose::Pdf::Facades::Facade
System::SharedPtr< Aspose::Pdf::Documentget_Document () const
 Gets the document facade is working on. More...
 
virtual void BindPdf (System::SharedPtr< Aspose::Pdf::Document > srcDoc)
 Initializes the facade. More...
 
void Dispose ()
 Disposes the facade. More...
 
- Public Member Functions inherited from Aspose::Pdf::Facades::IFacade
virtual void BindPdf (System::SharedPtr< Document > srcDoc)=0
 Binds PDF document for editing. More...
 
- Public Member Functions inherited from System::Object
ASPOSECPP_SHARED_API Object ()
 Creates object. Initializes all internal data structures. More...
 
virtual ASPOSECPP_SHARED_API ~Object ()
 Destroys object. Frees all internal data structures. More...
 
ASPOSECPP_SHARED_API Object (Object const &x)
 Copy constructor. Doesn't copy anything, really, just initializes new object and enables copy constructing subclasses. More...
 
Objectoperator= (Object const &x)
 Assignment operator. Doesn't copy anything, really, just initializes new object and enables copy constructing subclasses. More...
 
ObjectSharedRefAdded ()
 Increments shared reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
int SharedRefRemovedSafe ()
 Decrements and returns shared reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
int RemovedSharedRefs (int count)
 Decreases shared reference count by specified value. More...
 
Detail::SmartPtrCounter * WeakRefAdded ()
 Increments weak reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
void WeakRefRemoved ()
 Decrements weak reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
Detail::SmartPtrCounter * GetCounter ()
 Gets reference counter data structure associated with the object. More...
 
int SharedCount () const
 Gets current value of shared refernce counter. More...
 
ASPOSECPP_SHARED_API void Lock ()
 Implements C# lock() statement locking. Call directly or use LockContext sentry object. More...
 
ASPOSECPP_SHARED_API void Unlock ()
 Implements C# lock() statement unlocking. Call directly or use LockContext sentry object. More...
 
virtual ASPOSECPP_SHARED_API bool Equals (ptr obj)
 Compares objects using C# Object.Equals semantics. More...
 
virtual ASPOSECPP_SHARED_API int GetHashCode () const
 Analog of C# Object.GetHashCode() method. Enables hashing of custom objects. More...
 
virtual ASPOSECPP_SHARED_API String ToString () ASPOSE_CONST
 Analog of C# Object.ToString() method. Enables converting custom objects to string. More...
 
virtual ASPOSECPP_SHARED_API ptr MemberwiseClone () const
 Analog of C# Object.MemberwiseClone() method. Enables cloning custom types. More...
 
virtual ASPOSECPP_SHARED_API const TypeInfoGetType () const
 Gets actual type of object. Analog of C# System.Object.GetType() call. More...
 
virtual ASPOSECPP_SHARED_API bool Is (const TypeInfo &targetType) const
 Check if object represents an instance of type described by targetType. Analog of C# 'is' operator. More...
 
virtual ASPOSECPP_SHARED_API void SetTemplateWeakPtr (unsigned int argument)
 Set n'th template argument a weak pointer (rather than shared). Allows switching pointers in containers to weak mode. More...
 
template<>
bool Equals (float const &objA, float const &objB)
 
template<>
bool Equals (double const &objA, double const &objB)
 
template<>
bool ReferenceEquals (String const &str, std::nullptr_t)
 
template<>
bool ReferenceEquals (String const &str1, String const &str2)
 

Additional Inherited Members

- Public Types inherited from System::Object
typedef SmartPtr< Objectptr
 Alias for smart pointer type. More...
 
typedef System::Details::SharedMembersType shared_members_type
 structure to keep list of shared pointers contained in object. More...
 
- Static Public Member Functions inherited from System::Object
static bool ReferenceEquals (ptr const &objA, ptr const &objB)
 Compares objects by reference. More...
 
template<typename T >
static std::enable_if<!IsSmartPtr< T >::value, bool >::type ReferenceEquals (T const &objA, T const &objB)
 Compares objects by reference. More...
 
template<typename T >
static std::enable_if<!IsSmartPtr< T >::value, bool >::type ReferenceEquals (T const &objA, std::nullptr_t)
 Reference-compares value type object with nullptr. More...
 
template<typename T1 , typename T2 >
static std::enable_if< IsSmartPtr< T1 >::value &&IsSmartPtr< T2 >::value, bool >::type Equals (T1 const &objA, T2 const &objB)
 Compares reference type objects in C# style. More...
 
template<typename T1 , typename T2 >
static std::enable_if<!IsSmartPtr< T1 >::value &&!IsSmartPtr< T2 >::value, bool >::type Equals (T1 const &objA, T2 const &objB)
 Compares value type objects in C# style. More...
 
static const TypeInfoType ()
 Impleemnts C# typeof(System.Object) construct. More...
 
- Protected Member Functions inherited from Aspose::Pdf::Facades::SaveableFacade
 SaveableFacade ()
 The constructor. More...
 
 SaveableFacade (System::SharedPtr< Aspose::Pdf::Document > srcDoc)
 The constructor. More...
 
- Protected Member Functions inherited from Aspose::Pdf::Facades::Facade
 Facade ()
 The constructor. More...
 
 Facade (System::SharedPtr< Aspose::Pdf::Document > srcDoc)
 The constructor. More...
 
virtual void BindPdf (System::String srcFile, System::String password)
 Initializes the facade. More...
 
virtual void BindPdf (System::SharedPtr< System::IO::Stream > srcStream, System::String password)
 Initializes the facade. More...
 
virtual void AssertDocument () const
 Asserts if the facade is initialized. More...
 

Detailed Description

Represents a class to sign a pdf file with a certificate.

Constructor & Destructor Documentation

◆ PdfFileSignature() [1/5]

Aspose::Pdf::Facades::PdfFileSignature::PdfFileSignature ( )

The constructor of PdfFileSignature class.

◆ PdfFileSignature() [2/5]

Aspose::Pdf::Facades::PdfFileSignature::PdfFileSignature ( System::String  inputFile)

The constructor of PdfFileSignature class.

Parameters
inputFileThe input file for signature.

◆ PdfFileSignature() [3/5]

Aspose::Pdf::Facades::PdfFileSignature::PdfFileSignature ( System::String  inputFile,
System::String  outputFile 
)

The constructor of PdfFileSignature class.

Parameters
inputFileThe input file for signature.
outputFileThe output file.

◆ PdfFileSignature() [4/5]

Aspose::Pdf::Facades::PdfFileSignature::PdfFileSignature ( System::SharedPtr< Aspose::Pdf::Document document)

Initializes new PdfFileSignature object on base of the document .

Parameters
documentPdf document.

◆ PdfFileSignature() [5/5]

Aspose::Pdf::Facades::PdfFileSignature::PdfFileSignature ( System::SharedPtr< Aspose::Pdf::Document document,
System::String  outputFile 
)

Initializes new PdfFileSignature object on base of the document .

Parameters
documentPdf document.
outputFileThe output file.

Member Function Documentation

◆ BindPdf() [1/2]

virtual void Aspose::Pdf::Facades::PdfFileSignature::BindPdf ( System::String  inputFile)
virtual

Binds a Pdf file for editing.

Parameters
inputFileThe pdf file to be edited.

Reimplemented from Aspose::Pdf::Facades::Facade.

◆ BindPdf() [2/2]

virtual void Aspose::Pdf::Facades::PdfFileSignature::BindPdf ( System::SharedPtr< System::IO::Stream inputStream)
virtual

Binds a Pdf stream for editing.

Parameters
inputStreamThe pdf stream to be edited.

Reimplemented from Aspose::Pdf::Facades::Facade.

◆ Certify()

void Aspose::Pdf::Facades::PdfFileSignature::Certify ( int32_t  page,
System::String  SigReason,
System::String  SigContact,
System::String  SigLocation,
bool  visible,
System::Drawing::Rectangle  annotRect,
System::SharedPtr< Aspose::Pdf::Forms::DocMDPSignature docMdpSignature 
)

Certify the document with the MDP signature. Such data as signature reason, contact and location must be provided by corresponding properties of the Signature object sig.

Parameters
pageThe page on which signature is made.
SigReasonThe reason of signature.
SigContactThe contact of signature.
SigLocationThe location of signature.
visibleThe visiblity of signature.
annotRectThe rect of signature.
docMdpSignatureThe document MDP type of the signature.

◆ Close()

virtual void Aspose::Pdf::Facades::PdfFileSignature::Close ( )
virtual

Closes the facade.

Reimplemented from Aspose::Pdf::Facades::Facade.

◆ ContainsSignature()

bool Aspose::Pdf::Facades::PdfFileSignature::ContainsSignature ( )

Checks if the pdf has a digital signature or not.

Returns
Return a result of bool type.

◆ ContainsUsageRights()

bool Aspose::Pdf::Facades::PdfFileSignature::ContainsUsageRights ( )

Checks if the pdf has a usage rights or not.

Returns
Returns a result of bool type.

◆ CoversWholeDocument()

bool Aspose::Pdf::Facades::PdfFileSignature::CoversWholeDocument ( System::String  signName)

Checks if the signature covers the whole document.

Parameters
signNameThe name of signature.
Returns
Return a result of bool type.

◆ ExtractCertificate()

System::SharedPtr<System::IO::Stream> Aspose::Pdf::Facades::PdfFileSignature::ExtractCertificate ( System::String  signName)

Extracts signature's single X.509 certificate as a stream.

Parameters
signNameThe name of signature.
Returns
If certificate was found returns X.509 single certificate; otherwise, null.

◆ ExtractImage()

System::SharedPtr<System::IO::Stream> Aspose::Pdf::Facades::PdfFileSignature::ExtractImage ( System::String  signName)

Extracts signature's image.

Parameters
signNameThe name of signature.
Returns
If image was successfully found than returns stream object; otherwise, null.

◆ get_IsCertified()

bool Aspose::Pdf::Facades::PdfFileSignature::get_IsCertified ( )

Gets the flag determining whether a document is certified or not.

◆ get_SignatureAppearance()

System::String Aspose::Pdf::Facades::PdfFileSignature::get_SignatureAppearance ( )

Sets or gets a graphic appearance for the signature. Property value represents image file name.

◆ get_SignatureAppearanceStream()

System::SharedPtr<System::IO::Stream> Aspose::Pdf::Facades::PdfFileSignature::get_SignatureAppearanceStream ( )

Sets or gets a graphic appearance for the signature. Property value represents image stream.

◆ GetAccessPermissions()

Aspose::Pdf::Forms::DocMDPAccessPermissions Aspose::Pdf::Facades::PdfFileSignature::GetAccessPermissions ( )

Returns the access permissions value of certified document by the MDP signature type.

Returns
If the document is being certified, than returns access permissions value; otherwise,
Exceptions
System::ApplicationExceptionis thrown.

◆ GetBlankSignNames()

System::SharedPtr<System::Collections::Generic::IList<System::String> > Aspose::Pdf::Facades::PdfFileSignature::GetBlankSignNames ( )

Gets the names of all empty signature fields.

Returns
Return an IList.

◆ GetContactInfo()

System::String Aspose::Pdf::Facades::PdfFileSignature::GetContactInfo ( System::String  signName)

Gets the contact information of a signature.

Parameters
signNameThe name of signature.
Returns
Returns a result of string type.

◆ GetDateTime()

System::DateTime Aspose::Pdf::Facades::PdfFileSignature::GetDateTime ( System::String  signName)

Gets the signature's datetime.

Parameters
signNameThe name of signature.
Returns
Return the result of DateTime type.

◆ GetLocation()

System::String Aspose::Pdf::Facades::PdfFileSignature::GetLocation ( System::String  signName)

Gets the location of a signature.

Parameters
signNameThe name of signature.
Returns
Returns a result of string type.

◆ GetReason()

System::String Aspose::Pdf::Facades::PdfFileSignature::GetReason ( System::String  signName)

Gets the reason of a signature.

Parameters
signNameThe name of signature.
Returns
Returns a result of string type.

◆ GetRevision()

int32_t Aspose::Pdf::Facades::PdfFileSignature::GetRevision ( System::String  signName)

Gets the revision of a signature.

Parameters
signNameThe name of signature.
Returns
Return the number of signature revision.

◆ GetSignerName()

System::String Aspose::Pdf::Facades::PdfFileSignature::GetSignerName ( System::String  signName)

Gets the name of person or organization who signing the pdf document.

Parameters
signNameThe name of signature.
Returns
Returns the result of the signer's name.

◆ GetSignNames()

System::SharedPtr<System::Collections::Generic::IList<System::String> > Aspose::Pdf::Facades::PdfFileSignature::GetSignNames ( )

Gets the names of all not empty signatures.

Returns
Return an IList.
[C#]
string inFile=TestPath + "example1.pdf";
pdfSign.BindPdf(inFile);
IList names=pdfSign.GetSignNames();
for(int i=0;i<names.Count;i++)
{
Console.WriteLine("signature name:"+(string)names[i]);
Console.WriteLine("coverswholedocument:"+pdfSign.IsCoversWholeDocument((string)names[i]));
Console.WriteLine("revision:"+pdfSign.GetRevision((string)names[i]));
Console.WriteLine("verifysigned:"+pdfSign.VerifySigned((string)names[i]));
Console.WriteLine("reason:"+pdfSign.GetReason((string)names[i]));
Console.WriteLine("location:"+pdfSign.GetLocation((string)names[i]));
Console.WriteLine("datatime:"+pdfSign.GetDateTime((string)names[i]));
}
Console.WriteLine("totalvision:"+pdfSign.GetTotalRevision());
[Visual Basic]
Dim pdfSign as PdfFileSignature =new PdfFileSignature
pdfSign.BindPdf(inFile)
Dim names as IList
names=pdfSign.GetSignNames()
For i=0 To names.Count
@verbatim
Console.WriteLine("signature name:" + (string)names[i])
Console.WriteLine("coverswholedocument:" + pdfSign.IsCoversWholeDocument((string)names[i]))
Console.WriteLine("revision:" + pdfSign.GetRevision((string)names[i]))
Console.WriteLine("verifysigned:" + pdfSign.VerifySigned((string)names[i]))
Console.WriteLine("reason:" + pdfSign.GetReason((string)names[i]))
Console.WriteLine("location:" + pdfSign.GetLocation((string)names[i]))
Console.WriteLine("datatime:" + pdfSign.GetDateTime((string)names[i]))
@endverbatim
Next i
Console.WriteLine("totalvision:"+pdfSign.GetTotalRevision())

◆ GetTotalRevision()

int32_t Aspose::Pdf::Facades::PdfFileSignature::GetTotalRevision ( )

Gets the toltal revision.

Returns
Return the total number of signature revision.

◆ IsContainSignature()

bool Aspose::Pdf::Facades::PdfFileSignature::IsContainSignature ( )

Checks if the pdf has a digital signature or not.

Returns
Return a result of bool type.

◆ IsCoversWholeDocument()

bool Aspose::Pdf::Facades::PdfFileSignature::IsCoversWholeDocument ( System::String  signName)

Checks if the signature covers the whole document.

Parameters
signNameThe name of signature.
Returns
Return a result of bool type.

◆ RemoveSignature() [1/2]

void Aspose::Pdf::Facades::PdfFileSignature::RemoveSignature ( System::String  signName)

Remove the signature according to the name of the signature.

Parameters
signNameThe name of signature.
[C#]
string inFile = TestPath + "example1.pdf";
PdfFileSignature pdfSign = new PdfFileSignature();
pdfSign.BindPdf(inFile);
IList names = pdfSign.GetSignNames();
for(int i = 0; i < names.Count; i++)
{
pdfSign.RemoveSignature((string)names[i]);
}
pdfSign.Save(TestPath + "signed_removed.pdf");
[Visual Basic]
Dim pdfSign as PdfFileSignature = new PdfFileSignature
pdfSign.BindPdf(inFile)
Dim names as IList
names = pdfSign.GetSignNames()
For i = 0 To names.Count
pdfSign.RemoveSignature((string)names[i])
pdfSign.Save(TestPath + "signed_removed.pdf")

◆ RemoveSignature() [2/2]

void Aspose::Pdf::Facades::PdfFileSignature::RemoveSignature ( System::String  signName,
bool  removeField 
)

Removes the signature according to the name of the signature.

Parameters
signNameThe name of signature.
removeFieldIf set to true, than removes both of signature and field from document; otherwise, signature only.
[C#]
string inFile = TestPath + "example1.pdf";
PdfFileSignature pdfSign = new PdfFileSignature();
pdfSign.BindPdf(inFile);
IList names = pdfSign.GetSignNames();
for(int i = 0; i < names.Count; i++)
{
pdfSign.RemoveSignature((string)names[i], false);
}
pdfSign.Save(TestPath + "signed_removed.pdf");
[Visual Basic]
Dim pdfSign as PdfFileSignature = new PdfFileSignature
pdfSign.BindPdf(inFile)
Dim names as IList
names = pdfSign.GetSignNames()
For i = 0 To names.Count
pdfSign.RemoveSignature((string)names[i], false)
pdfSign.Save(TestPath + "signed_removed.pdf")

◆ RemoveUsageRights()

void Aspose::Pdf::Facades::PdfFileSignature::RemoveUsageRights ( )

Removes the usage rights entry.

◆ Save() [1/3]

virtual void Aspose::Pdf::Facades::PdfFileSignature::Save ( System::String  outputFile)
virtual

Saves the result PDF to file.

Parameters
outputFileoutput pdf file

Reimplemented from Aspose::Pdf::Facades::SaveableFacade.

◆ Save() [2/3]

virtual void Aspose::Pdf::Facades::PdfFileSignature::Save ( System::SharedPtr< System::IO::Stream outputStream)
virtual

Saves the result PDF to stream.

Parameters
outputStreamoutput pdf stream

Reimplemented from Aspose::Pdf::Facades::SaveableFacade.

◆ Save() [3/3]

void Aspose::Pdf::Facades::PdfFileSignature::Save ( )

Save signed pdf file. Output filename must be provided before with the help of coresponding PdfFileSignature constructor.

◆ set_SignatureAppearance()

void Aspose::Pdf::Facades::PdfFileSignature::set_SignatureAppearance ( System::String  value)

Sets or gets a graphic appearance for the signature. Property value represents image file name.

◆ set_SignatureAppearanceStream()

void Aspose::Pdf::Facades::PdfFileSignature::set_SignatureAppearanceStream ( System::SharedPtr< System::IO::Stream value)

Sets or gets a graphic appearance for the signature. Property value represents image stream.

◆ SetCertificate()

void Aspose::Pdf::Facades::PdfFileSignature::SetCertificate ( System::String  pfx,
System::String  pass 
)

Set certificate file and password for signing routine.

Parameters
pfxPKCS #12 certificate file.
passPassword to get access for the certificate private key.

◆ Sign() [1/6]

void Aspose::Pdf::Facades::PdfFileSignature::Sign ( int32_t  page,
System::String  SigReason,
System::String  SigContact,
System::String  SigLocation,
bool  visible,
System::Drawing::Rectangle  annotRect 
)

Make a signature on the pdf document.

Parameters
pageThe page number on which signature is made.
SigReasonThe reason of signature.
SigContactThe contact of signature.
SigLocationThe location of signature.
visibleThe visiblity of signature.
annotRectThe rect of signature.
[C#]
string inFile = TestPath + "example1.pdf";
string outFile = TestPath + "signature.pdf";
PdfFileSignature pdfSign = new PdfFileSignature();
pdfSign.BindPdf(inFile);
System.Drawing.Rectangle rect = new System.Drawing.Rectangle(100, 100, 200, 200);
pdfSign.SignatureAppearance = TestPath + "butterfly.jpg";
pdfSign.SetCertificate("certificate.pfx", "password");
pdfSign.Sign(2, "Allen", "success", "ChangSha", true, rect);
pdfSign.Save(outFile);
[Visual Basic]
Dim pdfSign = new PdfFileSignature()
pdfSign.BindPdf(inFile)
Dim rect as System.Drawing.Rectangle = new System.Drawing.Rectangle(100, 100, 200, 200)
pdfSign.SetCertificate("certificate.pfx", "password")
pdfSign.Sign(2, "Allen", "success", "ChangSha", true, rect)
pdfSign.SignatureAppearance = TestPath + "butterfly.jpg"
pdfSign.Save(outFile)

◆ Sign() [2/6]

void Aspose::Pdf::Facades::PdfFileSignature::Sign ( int32_t  page,
System::String  SigReason,
System::String  SigContact,
System::String  SigLocation,
bool  visible,
System::Drawing::Rectangle  annotRect,
System::SharedPtr< Aspose::Pdf::Forms::Signature sig 
)

Sign the document with the given type signature.

Parameters
pageThe page number on which signature is made.
SigReasonThe reason of signature.
SigContactThe contact of signature.
SigLocationThe location of signature.
visibleThe visiblity of signature.
annotRectThe rect of signature.
sigThe type of the signature, could be PKCS1, PKCS7 and PKCS7Detached.
[C#]
string inFile = TestPath + "example1.pdf";
string outFile = TestPath + "signature.pdf";
PdfFileSignature pdfSign = new PdfFileSignature(inFile, outFile);
System.Drawing.Rectangle rect = new System.Drawing.Rectangle(100, 100, 200, 100);
pdfSign.SignatureAppearance = TestPath + "butterfly.jpg";
pdfSign.Sign(2, "Allen", "success", "ChangSha", true, rect, new PKCS1("certificate.pfx", "password"));
pdfSign.Save();
[Visual Basic]
Dim inFile As String = TestPath &amp; "example1.pdf"
Dim outFile As String = TestPath &amp; "signature.pdf"
Dim sig As PKCS1 = new PKCS1("certificate.pfx", "password")
Dim pdfSign = new PdfFileSignature(inFile, outFile)
Dim rect as System.Drawing.Rectangle = new System.Drawing.Rectangle(100, 100, 200, 100)
pdfSign.SignatureAppearance = TestPath &amp; "butterfly.jpg"
pdfSign.Sign(2, "Allen", "success", "ChangSha", true, rect, sig)
pdfSign.Save()

◆ Sign() [3/6]

void Aspose::Pdf::Facades::PdfFileSignature::Sign ( int32_t  page,
bool  visible,
System::Drawing::Rectangle  annotRect,
System::SharedPtr< Aspose::Pdf::Forms::Signature sig 
)

Sign the document with the given type signature.

Parameters
pageThe page number on which signature is made.
visibleThe visiblity of signature.
annotRectThe rect of signature.
sigThe type of the signature, could be PKCS1, PKCS7 and PKCS7Detached. Such data as signature reason, contact and location must be already present in this object (see corresponding properties).
[C#]
string inFile = TestPath + "example1.pdf";
string outFile = TestPath + "signature.pdf";
PKCS1 sig = new PKCS1("certificate.pfx", "password");
sig.Reason = "Some reason";
sig.Contact = "Smith";
sig.Location = "New York";
PdfFileSignature pdfSign = new PdfFileSignature(inFile, outFile);
System.Drawing.Rectangle rect = new System.Drawing.Rectangle(100, 100, 200, 100);
pdfSign.SignatureAppearance = TestPath + "butterfly.jpg";
pdfSign.Sign(2, true, rect, sig);
pdfSign.Save();
[Visual Basic]
Dim inFile As String = TestPath &amp; "example1.pdf"
Dim outFile As String = TestPath &amp; "signature.pdf"
Dim sig As PKCS1 = new PKCS1("certificate.pfx", "password")
sig.Reason = "Some reason"
sig.Contact = "Smith"
sig.Location = "New York"
Dim pdfSign = new PdfFileSignature(inFile, outFile)
Dim rect as System.Drawing.Rectangle = new System.Drawing.Rectangle(100, 100, 200, 100)
pdfSign.SignatureAppearance = TestPath &amp; "butterfly.jpg"
pdfSign.Sign(2, true, rect, sig)
pdfSign.Save()

◆ Sign() [4/6]

void Aspose::Pdf::Facades::PdfFileSignature::Sign ( System::String  SigName,
System::String  SigReason,
System::String  SigContact,
System::String  SigLocation,
System::SharedPtr< Aspose::Pdf::Forms::Signature sig 
)

Sign the document with the given type signature which is placed in already presented signature field. Before signing signature field must be empty, i.e. field must not contain signature dictionary. Thus pdf document already has signature field, you should not supply the place to stamp the signature, corresponding page and rectangle are taken from signature field which is found by signature name (see SigName parameter).

Parameters
SigNameThe name of the signature field.
SigReasonThe reason of signature.
SigContactThe contact of signature.
SigLocationThe location of signature.
sigThe type of the signature, could be PKCS1, PKCS7 and PKCS7Detached.
[C#]
string inFile = TestPath + "example1.pdf";
string outFile = TestPath + "signature.pdf";
PKCS1 sig = new PKCS1("certificate.pfx", "password");
PdfFileSignature pdfSign = new PdfFileSignature(inFile, outFile);
pdfSign.SignatureAppearance = TestPath + "butterfly.jpg";
pdfSign.Sign("Signature1", "Allen", "success", "ChangSha", sig);
pdfSign.Save();
[Visual Basic]
Dim inFile As String = TestPath &amp; "example1.pdf"
Dim outFile As String = TestPath &amp; "signature.pdf"
Dim sig As PKCS1 = new PKCS1("certificate.pfx", "password")
Dim pdfSign = new PdfFileSignature(inFile, outFile)
pdfSign.SignatureAppearance = TestPath &amp; "butterfly.jpg"
pdfSign.Sign("Signature1", "Allen", "success", "ChangSha", sig)
pdfSign.Save()

◆ Sign() [5/6]

void Aspose::Pdf::Facades::PdfFileSignature::Sign ( int32_t  page,
System::String  SigName,
System::String  SigReason,
System::String  SigContact,
System::String  SigLocation,
bool  visible,
System::Drawing::Rectangle  annotRect,
System::SharedPtr< Aspose::Pdf::Forms::Signature sig 
)

Sign the document with the given type signature which is placed in already presented signature field. Before signing pdf document should already has signature field, corresponding page and rectangle are taken from signature field which is found by signature name (see SigName parameter).

Parameters
pageThe page number on which signature is made.
SigNameThe name of the signature field.
SigReasonThe reason of signature.
SigContactThe contact of signature.
SigLocationThe location of signature.
visibleThe visiblity of signature.
annotRectThe rect of signature.
sigThe type of the signature, could be PKCS1, PKCS7 and PKCS7Detached.
[C#]
string inFile = TestPath + "blankWithSignature.pdf";
string outFile = TestPath + "signature.pdf";
PKCS7 sig = new PKCS7("certificate.pfx", "password");
PdfFileSignature pdfSign = new PdfFileSignature(inFile);
System.Drawing.Rectangle rect = new System.Drawing.Rectangle(100, 100, 100, 100);
pdfSign.SignatureAppearance = TestPath + "butterfly.jpg"
pdfSign.Sign(1, "Signature1", "ReasonToTest", "ContactMe", "SomeLocation", true, rect, sig);
pdfSign.Save(outFile);
[Visual Basic]
Dim inFile As String = TestPath &amp; "blankWithSignature.pdf"
Dim outFile As String = TestPath &amp; "signature.pdf"
Dim sig As PKCS7 = new PKCS7("certificate.pfx", "password")
Dim pdfSign = new PdfFileSignature(inFile, outFile)
pdfSign.SignatureAppearance = TestPath &amp; "butterfly.jpg"
pdfSign.Sign("Signature1", "ReasonToTest", "ContactMe", "SomeLocation", true, rect, sig)
pdfSign.Save(outFile)

◆ Sign() [6/6]

void Aspose::Pdf::Facades::PdfFileSignature::Sign ( System::String  SigName,
System::SharedPtr< Aspose::Pdf::Forms::Signature sig 
)

Sign the document with the given type signature which is placed in already presented signature field. Before signing signature field must be empty, i.e. field must not contain signature dictionary. Thus pdf document already has signature field, you should not supply the place to stamp the signature, corresponding page and rectangle are taken from signature field which is found by signature name (see SigName parameter). Such data as signature reason, contact and location must be provided by corresponding properties of the Signature object sig.

Parameters
SigNameThe name of the signature field.
sigThe type of the signature, could be PKCS1 (Pkcs1Signature object), PKCS7 and PKCS7 detached (Pkcs7Signature object)
[C#]
string inFile = TestPath + "example1.pdf";
string outFile = TestPath + "signature.pdf";
PKCS1 sig = new PKCS1("certificate.pfx", "password");
sig.Reason = "Some reason";
sig.Contact = "Smith";
sig.Location = "New York";
PdfFileSignature pdfSign = new PdfFileSignature(inFile, outFile);
pdfSign.SignatureAppearance = TestPath + "butterfly.jpg";
pdfSign.Sign("Signature1", sig);
pdfSign.Save();
[Visual Basic]
Dim inFile As String = TestPath &amp; "example1.pdf"
Dim outFile As String = TestPath &amp; "signature.pdf"
Dim sig As PKCS1 = new PKCS1("certificate.pfx", "password")
sig.Reason = "Some reason"
sig.Contact = "Smith"
sig.Location = "New York"
Dim pdfSign = new PdfFileSignature(inFile, outFile)
pdfSign.SignatureAppearance = TestPath &amp; "butterfly.jpg"
pdfSign.Sign("Signature1", sig)
pdfSign.Save()

◆ VerifySignature()

bool Aspose::Pdf::Facades::PdfFileSignature::VerifySignature ( System::String  signName)

Checks the validity of a signature.

Parameters
signNameThe name of signature.
Returns
Return a result of bool type.

◆ VerifySigned()

bool Aspose::Pdf::Facades::PdfFileSignature::VerifySigned ( System::String  signName)

Checks the validity of a signature.

Parameters
signNameThe name of signature.
Returns
Return a result of bool type.