PDF SDK Documentation

Comprehensive Guide for Developers: Features, Integration, and API Reference

Loading...
Searching...
No Matches
form_field.h
1// Copyright (c) 2009-2025 Avanquest Software. All rights reserved.
2
3#ifndef PDFSDK_CXX_PDF_FORM_FIELD_H_INCLUDED_
4#define PDFSDK_CXX_PDF_FORM_FIELD_H_INCLUDED_
5
6#include <string>
7
9
10#include "forward_declarations.h"
11#include "wrapper_base.h"
12
13namespace PDF {
14
19{
20public:
21 virtual ~SignHandler() = default;
22
26 virtual std::string GetFilter() = 0;
27
31 virtual std::string GetSubFilter() = 0;
32
36 virtual size_t GetNumCerts() = 0;
37
43 virtual std::vector<uint8_t> GetCertData(size_t index) = 0;
44
48 virtual size_t EstimateMaxSize() = 0;
49
56 virtual std::vector<uint8_t> Sign(const uint8_t* contents, size_t size) = 0;
57};
58
64class FormField : public detail::RefCountedHandle<PDField> {
65public:
70 PDAtom GetFieldType() const;
71
76 PDFieldFlags GetFlags() const;
77
82 std::wstring GetFullName() const;
83
88 size_t GetChoiceNumOptions() const;
89
95 std::wstring GetChoiceOption(size_t index) const;
96
101 bool IsSignBlank() const;
102
108 void SetSignLock(PDAtom action, Object fields, PDSignLockPerms perms);
109
113 PDAtom GetSignLockAction() const;
114
119
124
130 void SignApprove(std::shared_ptr<SignHandler> signer, const std::wstring& reason);
131
138 void SignCertify(std::shared_ptr<SignHandler> signer, const std::wstring& reason, PDSignLockPerms perms = kPDSignLockPermsAllowFormFill);
139
143 void SignClear();
144
149 bool SignVerify() const;
150
156
160 std::wstring GetSignReason() const;
161
166
171
176 std::vector<uint8_t> GetSignCertificate(size_t index) const;
177
183 int GetSignRevision() const;
184
185 PDF_CXX_CORE_WRAPPER_DEFINE_MEMBERS_(FormField, PDField)
186};
187
188} // namespace PDF
189
190#include "form_field_impl.inl"
191
192#endif // PDFSDK_CXX_PDF_FORM_FIELD_H_INCLUDED_
AcroForm API.
PDSignLockPerms
Controls the permissions and security settings of a signed PDF document.
Definition acroform.h:224
@ kPDSignLockPermsAllowFormFill
Definition acroform.h:227
Represents a form field in a PDF document.
Definition form_field.h:64
PDAtom GetSignLockAction() const
Get the lock action for a signature form field.
void SignApprove(std::shared_ptr< SignHandler > signer, const std::wstring &reason)
Sign the signature form field with an approval signature. A PDF document can have multiple approval s...
std::wstring GetFullName() const
Get the full name of the form field.
int GetSignRevision() const
Get the revision number of the signed signature form field.
Object GetSignLockFields() const
Get the lock fields for a signature form field.
void SetSignLock(PDAtom action, Object fields, PDSignLockPerms perms)
Sets lock parameters for a signature form field.
PDSignLockPerms GetSignLockPerms() const
Get the lock permissions for a signature form field.
void SignCertify(std::shared_ptr< SignHandler > signer, const std::wstring &reason, PDSignLockPerms perms=kPDSignLockPermsAllowFormFill)
Sign the signature form field with a certification signature. A PDF document can have only one certif...
std::wstring GetSignReason() const
Get the reason string of the signed signature form field.
PDAtom GetFieldType() const
Get the type of the form field.
void SignClear()
Clear the signature form field.
size_t GetNumSignCertificates() const
Get the number of certificates in the signed signature form field.
bool SignVerify() const
Verify the signature integrity.
std::wstring GetChoiceOption(size_t index) const
Get the option at the specified index for a choice form field.
PDDateTime GetSignDate() const
Get the signing date of the signed signature form field.
std::vector< uint8_t > GetSignCertificate(size_t index) const
Get the certificate data from the signed signature form field.
PDFieldFlags GetFlags() const
Get the flags of the form field.
size_t GetChoiceNumOptions() const
Get the number of options for a choice form field.
bool IsSignBlank() const
Check if a signature form field is blank.
bool SignDocModifiedAfterSign() const
Check if a document was modified after signing the signature form field.
Represents a PDF object.
Definition object.h:20
A callback interface for signing a PDF document.
Definition form_field.h:19
virtual std::vector< uint8_t > GetCertData(size_t index)=0
Get the certificate data at the specified index.
virtual std::string GetFilter()=0
Get the filter for the signature.
virtual size_t EstimateMaxSize()=0
Estimate the maximum size of the signature contents.
virtual std::string GetSubFilter()=0
Get the subfilter for the signature.
virtual std::vector< uint8_t > Sign(const uint8_t *contents, size_t size)=0
Sign the specified data.
virtual size_t GetNumCerts()=0
Get the number of certificates.
Definition types.h:23