Sometimes you need to tweak a signed PDF because the signing date needs updating or a new regulation calls for an upgraded version. Instead of redoing the entire PDF from scratch, you can quickly edit signatures in PDF files to save time and preserve the original document structure. This tutorial explains the step-by-step process of managing and editing PDF e-signatures in .NET apps using the secure, scalable .NET REST API.
Steps to Edit Signatures in PDF in .NET
- Install GroupDocs.Signature Cloud SDK for .NET from NuGet
- Use the Configuration class to set up your client credentials
- Initialize the SignApi class and configure SearchBarcodeOptions
- Apply SearchSettings for the input PDF file and process the search request
- Prepare UpdateOptions for all available e-signs and define UpdateSettings
- Edit the PDF e-signatures using the UpdateSignatures method
The outlined steps allow developers to modify e-signatures in PDF documents using the Cloud REST API without dealing with complex local installations or compatibility headaches. The programmatic approach helps avoid re-signing and recreating documents. You can maintain integrity and seamlessly adjust to new legal and company requirements. Automated workflow boosts your real-world applications like contract management systems, e-signing platforms, and legal document repositories, thus elevating the entire document lifecycle.
Code to Edit Signatures in PDF in .NET
using GroupDocs.Signature.Cloud.Sdk.Api; | |
using GroupDocs.Signature.Cloud.Sdk.Client; | |
using GroupDocs.Signature.Cloud.Sdk.Model; | |
using GroupDocs.Signature.Cloud.Sdk.Model.Requests; | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
// Configure API credentials | |
string MyClientId = "your-client-id"; | |
string MyClientSecret = "your-client-secret"; | |
var configuration = new Configuration(MyClientId, MyClientSecret); | |
// Initialize the SignApi class | |
var apiInstance = new SignApi(configuration); | |
// 1. Set up barcode signature search options | |
var searchBarcodeOptions = new SearchBarcodeOptions | |
{ | |
SignatureType = SignOptions.SignatureTypeEnum.Barcode, | |
MatchType = SearchBarcodeOptions.MatchTypeEnum.Contains, | |
Text = "12345678910", | |
BarcodeType = "Code128", | |
AllPages = true | |
}; | |
// 2. Add e-signature search settings | |
var searchSettings = new SearchSettings | |
{ | |
FileInfo = new GroupDocs.Signature.Cloud.Sdk.Model.FileInfo | |
{ | |
FilePath = "SampleFiles/source_signed.pdf" | |
}, | |
Options = new List<SearchOptions> { searchBarcodeOptions } | |
}; | |
// 3. Search existing barcode signatures | |
var searchRequest = new SearchSignaturesRequest(searchSettings); | |
var searchResult = apiInstance.SearchSignatures(searchRequest); | |
// 4. Prepare update options for all found signatures | |
var updateOptionsList = new List<UpdateOptions>(); | |
foreach (var signature in searchResult.Signatures) | |
{ | |
var editOptions = new UpdateOptions | |
{ | |
SignatureType = UpdateOptions.SignatureTypeEnum.Barcode, | |
Left = 300, | |
Top = 500, | |
Width = 350, | |
Height = 150, | |
IsSignature = true, | |
SignatureId = signature.SignatureId | |
}; | |
updateOptionsList.Add(editOptions); | |
} | |
// 5. Set up e-sign update settings | |
var updateSettings = new UpdateSettings | |
{ | |
FileInfo = new GroupDocs.Signature.Cloud.Sdk.Model.FileInfo | |
{ | |
FilePath = "SampleFiles/source_signed.pdf" | |
}, | |
Options = updateOptionsList, | |
}; | |
// 6. Send esignature update request and process it | |
var updateRequest = new UpdateSignaturesRequest(updateSettings); | |
var updateResult = apiInstance.UpdateSignatures(updateRequest); | |
} | |
} |
If you are developing a .NET application that handles signed PDF files, boasting the ability to edit signatures in PDF in .NET using GroupDocs.Signature Cloud .NET REST API is a massive upgrade. It makes your cloud-based C# apps work faster, smarter, and much easier to maintain across Windows, macOS, and Linux. Our Cloud API is easy to integrate, leaving you more time to build awesome, user-focused features.
Check out our article on Removing Barcode Signatures from PDFs using the .NET REST API to explore document e-sign management options.