PPTX
DOCX
XLSX
PDF
ODP
PDF
Add digital signature in PDF using via C++
Native and high performance PDF document digital signature generation and verification using server-side Aspose.PDF for .NET APIs, without the use of any software including Adobe PDF - C++.
How to add Digitally Sign to PDF File Using C++ Library
In order to add digital signature in PDF file, we’ll use Aspose.PDF for C++ API which is a feature-rich, powerful and easy to use document manipulation API for cpp platform. Open NuGet package manager, search for Aspose.PDF and install. You may also use the following command from the Package Manager Console.
Package Manager Console Command
PM> Install-Package Aspose.PDF.Cpp
Add Digitally Sign to PDF via C++
You need Aspose.PDF for C++ to try the code in your environment.
- Load the PDF with an instance of Document.
- Load all the PDF files with full path.
- Set the style of text like font, font size, color etc.
- Save PDF file, You will get the document with signature inserted.
- To verify the validity of the signature use PdfFileSignature.VerifySigned() method.
System Requirements
Just make sure that you have the following prerequisites.
- Microsoft Windows or a compatible OS with C++ Runtime Environment for Windows 32 bit, Windows 64 bit, and Linux 64 bit.
- Development environment like Microsoft Visual Studio.
- Aspose.PDF for C++ DLL referenced in your project.
Add Electronic Signature to a PDF File using - C++.
// String for path name.
String _dataDir("C:\\Samples\\");
String inFile = _dataDir + u"DigitallySign.pdf";
String outFile = _dataDir + u"DigitallySign_out.pdf";
auto document = MakeObject<Document>(inFile);
auto signature = MakeObject<PdfFileSignature>(document);
auto pkcs = MakeObject<Aspose::Pdf::Forms::PKCS7>(_dataDir + u"test.pfx", u"Pa$$w0rd2022"); // Use PKCS7/PKCS7Detached objects
System::Drawing::Rectangle rect(300, 100, 400, 200);
signature->Sign(1, true, rect, pkcs);
// Save output PDF file
signature->Save(outFile);