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#include <vector>
8
10
11#include "forward_declarations.h"
12#include "wrapper_base.h"
13
14namespace PDF {
15
20{
21public:
22 virtual ~SignHandler() = default;
23
27 virtual std::string GetFilter() = 0;
28
32 virtual std::string GetSubFilter() = 0;
33
38 virtual void FillSigDict(Object dict) = 0;
39
43 virtual size_t GetNumCerts() = 0;
44
50 virtual std::vector<uint8_t> GetCertData(size_t index) = 0;
51
55 virtual size_t EstimateMaxSize() = 0;
56
63 virtual std::vector<uint8_t> Sign(const uint8_t* data, size_t size) = 0;
64};
65
71class FormField : public detail::RefCountedHandle<PDField> {
72public:
78 static FormField CreateFromPdfObject(const Object& object);
79
85
90 PDAtom GetFieldType() const;
91
96 bool IsTerminal() const;
97
102 PDFieldFlags GetFlags() const;
103
108 std::wstring GetFullName() const;
109
114 size_t GetNumWidgets() const;
115
121 Annot GetWidget(size_t index) const;
122
127 size_t GetChoiceNumOptions() const;
128
134 std::wstring GetChoiceOption(size_t index) const;
135
140 bool IsSignBlank() const;
141
147 void SetSignLock(PDAtom action, Object fields, PDSignLockPerms perms);
148
152 PDAtom GetSignLockAction() const;
153
158
163
169 void SignApprove(std::shared_ptr<SignHandler> signer, const std::wstring& reason);
170
177 void SignCertify(std::shared_ptr<SignHandler> signer, const std::wstring& reason, PDSignLockPerms perms = kPDSignLockPermsAllowFormFill);
178
182 void SignClear();
183
188 bool SignVerify() const;
189
195
199 std::wstring GetSignReason() const;
200
205
210
215 std::vector<uint8_t> GetSignCertificate(size_t index) const;
216
222 int GetSignRevision() const;
223
224 PDF_CXX_CORE_WRAPPER_DEFINE_MEMBERS_(FormField, PDField)
225};
226
227} // namespace PDF
228
229#include "form_field_impl.inl"
230
231#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:226
@ kPDSignLockPermsAllowFormFill
Definition acroform.h:229
Represents an annotation in a PDF document.
Definition annot.h:24
Represents a form field in a PDF document.
Definition form_field.h:71
PDAtom GetSignLockAction() const
Get the lock action for a signature form field.
static FormField CreateFromPdfObject(const Object &object)
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...
Object GetPdfObject() const
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.
Annot GetWidget(size_t index) const
Get the widget at the specified index.
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.
bool IsTerminal() const
Checks if the form field is a terminal 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.
size_t GetNumWidgets() const
Get the number of widgets associated with the form field.
Represents a PDF object.
Definition object.h:20
A callback interface for signing a PDF document.
Definition form_field.h:20
virtual void FillSigDict(Object dict)=0
Fill the signature value dictionary with additional entries.
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::vector< uint8_t > Sign(const uint8_t *data, size_t size)=0
Sign the specified data.
virtual std::string GetSubFilter()=0
Get the subfilter for the signature.
virtual size_t GetNumCerts()=0
Get the number of certificates.
Definition types.h:23