Penneo is all about digitizing the process of signing documents and contacts. The Penneo SDK for .Net enables .Net developers to use digital signing of documents in their .Net code. Get more info at penneo.com about how to become a customer.
The Penneo SDK for .Net requires that you are using netcoreapp3.1 or newer. If you need other target framework support, please contact us at support@penneo.com.
You can install the SDK by simply cloning or downloading the source, or you can use Nuget. We recommend that you use Nuget:
The recommended way to install the Penneo SDK is through Nuget. Nuget is now part of Visual Studio, and can be updated through Visual Studio.
Use the Nuget UI in Visual Studio for installing the Penneo SDK, or use the command prompt:
# Install Penneo SDK
nuget install Penneo.SDK
See additional information about the Penneo .Net SDK package at Penneo Nuget.
You can find out more on how to use Nuget and other best-practices for defining dependencies at nuget.org.
This section documents the different objects available through the SDK and how to use them.
In order to use the SDK, you will have to authenticate against the Penneo API. Authentication is done in a single line of code, using your Penneo API credentials:
// Initialize the connection to the API
PenneoConnector con = new PenneoConnector(key, secret, endpoint);
If you have a reseller account, you can carry out operations on behalf of one of your customers, by specifying the customer id as well:
// Initialize the connection to the API as customer
PenneoConnector con = new PenneoConnector(key, secret, endpoint, customerId);
The endpoint url can point to either the sandbox (for testing) or the live system. Both endpoint urls are available on request.
- Folders Folder objects are containers for case file objects.
- Case files The case file object is a container used to bundle documents and signers. Every signing process starts with a case file.
- Documents The document object represents (and contains) the actual PDF document.
- Signature lines Every signable document must have at least one signature line. Think of it as the dashed line that people used to sign using a pen...
- Signers A signer object represents the person that signs.
- SigningRequests Think of the signing request as being the instructions for the signer on what to sign. It can either be the formal letter accompanying the document, the yellow post-its showing where to sign, or both.
- Case file templates Instead of specifying the mapping between documents and signers explicitly, it is possible to use one of the many pre-defined case file templates provided by Penneo.
- Validations Money laundering regulations require companies to validate the identity of their clients. The validation object can accomplish this, using only a social security number and an electronic ID.
In this example, we show how to create a document with a single signer. The link to the Penneo signing portal, where the actual signing takes place, is printed as a result.
// Create a new case file
var myCaseFile = new CaseFile("Demo case file");
myCaseFile.Persist(con);
// Create a new signable document in this case file
var myDocument = new Document(myCasefile, "Demo Document", "/path/to/pdfFile");
myDocument.MakeSignable();
myDocument.Persist(con);
// Create a new signer that can sign documents in the case file
var mySigner = new Signer(myCaseFile, "John Doe");
mySigner.Persist(con);
// Create a new signature line on the document
var mySignatureLine = new SignatureLine(myDocument, "MySignerRole");
mySignatureLine.Persist(con);
// Map the signer to the signing request
mySignatureLine.SetSigner(con, mySigner);
// Update the signing request for the new signer
var mySigningRequest = mySigner.GetSigningRequest();
mySigningRequest.SuccessUrl = "http://go/here/on/success";
mySigningRequest.FailUrl = "http://go/here/on/failure";
mySigningRequest.Persist(con);
// "Package" the case file for "sending".
myCaseFile.Send(con);
// And finally, print out the link leading to the signing portal.
// The signer uses this link to sign the document.
Console.WriteLine("<a href=\"" + mySigningRequest.GetLink() + "\">Sign now</a>");
In this example we demontrate, how to validate a person from his/her electronic ID and social security number. The result is a link to the Penneo validation page. The person in question must follow the link and complete some actions in order to be validated.
// Create a new validation
var myValidation = new Validation("john Doe");
myValidation.Title = "My new validation";
myValidation.Persist(con);
// Output the validation link.
Console.WriteLine("<a href=\"" + myValidation.GetLink() + "\">Validate now</a>");
Use the DebugLogger
class or implement your own IPenneoLogger
to see more info about the reuqests perfomed.
Note: Please provide the X-Penneo-Request-Id
and the X-B3-TraceId
headers whenever submitting a support ticket.
con.Logger = new DebugLogger(); // debug info will be printed to the debug console
/*
Example tracing headers:
X-B3-TraceId: a9a6ed54760af06f
X-Penneo-Request-Id: 2855de5360cb6f515917a3e62916459c
*/
- API documentation - Information about the Penneo API, methods and responses