Xceed Words for .NET v3.0 Documentation
Sign(String,String,DigitalCertificate,SignOptions) Method
Example 


Xceed.Words.NET Assembly > Xceed.Words.NET Namespace > DocX Class > Sign Method : Sign(String,String,DigitalCertificate,SignOptions) Method
The path of the document to sign.
The path to store the signed document.
The certificate used to sign the document.
The options set to sign the document. By default, null.
Signs an input document with a certificate and sign options, and saves the result in an output document.
Syntax
'Declaration
 
Public Overloads Shared Sub Sign( _

   ByVal inputFileName As String, _

   ByVal outputFileName As String, _

   ByVal certificate As DigitalCertificate, _

   Optional ByVal signOptions As SignOptions _

) 
'Usage
 
Dim inputFileName As String

Dim outputFileName As String

Dim certificate As DigitalCertificate

Dim signOptions As SignOptions

 

DocX.Sign(inputFileName, outputFileName, certificate, signOptions)
public static void Sign( 

   string inputFileName,

   string outputFileName,

   DigitalCertificate certificate,

   SignOptions signOptions

)

Parameters

inputFileName
The path of the document to sign.
outputFileName
The path to store the signed document.
certificate
The certificate used to sign the document.
signOptions
The options set to sign the document. By default, null.
Example
// Add the SignatureLine to the document.

mySignatureLine = document.AddSignatureLine();



// Insert the SignatureLine in a document's paragraph.

myParagraph.AppendSignatureLine( mySignatureLine );



// Create a digital certificate in order to sign the document, by using a pfx file and its password.

var certificate = DigitalCertificate.Create( "CustomCertificate.pfx", "xceed" );



  // Create SignOptions for the SignatureLine.

  // Use the SignatureLineId to match the SignatureLine id and set the image used to sign the SignatureLine.

  var signOptions = new SignOptions()

  {

    SignatureLineId = mySignatureLine.Id,

    SignatureLineImage = "MarkStoneSignature.png",

    Comments = "This document is now signed by Mark Stone."

  };   



  // Sign the document with the certificate and the SignOptions, related to the SignatureLine.

  DocX.Sign( "DocumentToSign.docx", "SignedDocument.docx", certificate, signOptions );
Requirements

Target Platforms: Windows 11, Windows 10, Windows 7, Windows, 11, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

DocX Class
DocX Members
Overload List