Signature Information in C++
Contents
[
Hide
]
Use PdfFileSignature for this task. The examples below retain the original C++ code and API Reference steps.
Get signature information
List signature names and print the first signature’s signer, date, reason, and location.
- Create PdfFileSignature.
- Bind the PDF input with Facade::BindPdf().
- Read signature identifiers with PdfFileSignature::GetSignatureNames().
- List signature names with PdfFileSignature::GetSignNames().
- Read the signer name with PdfFileSignature::GetSignerName().
- Read the signing date with PdfFileSignature::GetDateTime().
- Read the signing reason with PdfFileSignature::GetReason().
- Read the signing location with PdfFileSignature::GetLocation().
- Print the results or diagnostic messages shown in the example.
#include <Aspose.PDF.Cpp/Facades/PdfFileSignature.h>
#include <Aspose.PDF.Cpp/Facades/SignatureName.h>
#include <iostream>
#include <system/collections/ilist.h>
#include <system/date_time.h>
#include <system/string.h>
namespace Facades::Examples::PDF_FileSignature
{
using namespace System;
using namespace Aspose::Pdf;
using namespace Aspose::Pdf::Facades;
void GetSignatureInformation(String inputFile)
{
auto pdfSignature = MakeObject<PdfFileSignature>();
pdfSignature->BindPdf(inputFile);
auto signatureName = pdfSignature->GetSignatureNames()->idx_get(0);
for (const auto &name : pdfSignature->GetSignNames())
std::cout << "Signature Name: " << name << std::endl;
std::cout << "Signer: " << pdfSignature->GetSignerName(signatureName) << std::endl;
std::cout << "Date: " << pdfSignature->GetDateTime(signatureName).ToString() << std::endl;
std::cout << "Reason: " << pdfSignature->GetReason(signatureName) << std::endl;
std::cout << "Location: " << pdfSignature->GetLocation(signatureName) << std::endl;
}
} // namespace Facades::Examples::PDF_FileSignature