Foxit PDF SDK

fs_ofdsign.h
1 #ifndef FS_OFD_SIGN_H_
2 #define FS_OFD_SIGN_H_
3
4 #include "common/fs_common.h"
5
11 namespace foxit {
15 namespace ofd {
16 class OFDDoc;
20 namespace ofdseal {
21 class Oes;
22
24 class ImagePosition FS_FINAL : public Object {
25 public:
37 ImagePosition(int page_index, float x, float y, bool is_centered = true, float width = -1.0f, float height = -1.0f) :
38 page_index(page_index),
39 x(x),
40 y(y),
41 is_centered(is_centered),
42 width(width),
43 height(height) {
44 }
45
51 ImagePosition(const ImagePosition& other) {
52 this->page_index = other.page_index;
53 this->x = other.x;
54 this->y = other.y;
55 this->is_centered = other.is_centered;
56 this->width = other.width;
57 this->height = other.height;
58 }
59
67 ImagePosition& operator=(const ImagePosition& other) {
68 this->page_index = other.page_index;
69 this->x = other.x;
70 this->y = other.y;
71 this->is_centered = other.is_centered;
72 this->width = other.width;
73 this->height = other.height;
74 return *this;
75 }
76
90 void Set(int page_index, float x, float y, bool is_centered = true, float width = -1.0f, float height = -1.0f) {
91 this->page_index = page_index;
92 this->x = x;
93 this->y = y;
94 this->is_centered = is_centered;
95 this->width = width;
96 this->height = height;
97 }
98
103 int page_index;
104
109 float x;
110
115 float y;
116
121 bool is_centered;
122
127 float width;
128
133 float height;
134 };
135
136 FSDK_DEFINE_ARRAY(ImagePositionArray, ImagePosition)
137
138
139 class StraddlePosition FS_FINAL : public Object {
140 public:
142 typedef enum _StraddlePositionType {
144 e_StraddlePositionTypeLeft = 0,
146 e_StraddlePositionTypeTop = 1,
148 e_StraddlePositionTypeRight = 2,
150 e_StraddlePositionTypeBottom = 3
151 } StraddlePositionType;
152
154 typedef enum _StraddleProportionType {
156 e_StraddleProportionOneFifth = 1,
158 e_StraddleProportionTwoFifth = 2,
160 e_StraddleProportionThreeFifth = 3,
162 e_StraddleProportionFourFifth = 4
163 } StraddleProportionType;
164
165
177 StraddlePosition(StraddlePositionType position, StraddleProportionType proportion, float first_page_percent, int start_page_index, int page_count) :
178 position(position),
179 proportion(proportion),
180 first_page_percent(first_page_percent),
181 start_page_index(start_page_index),
182 page_count(page_count) {
183 }
184
190 StraddlePosition(const StraddlePosition& other) {
191 this->position = other.position;
192 this->proportion = other.proportion;
193 this->first_page_percent = other.first_page_percent;
194 this->start_page_index = other.start_page_index;
195 this->page_count = other.page_count;
196 }
197
205 StraddlePosition& operator=(const StraddlePosition& other) {
206 this->position = other.position;
207 this->proportion = other.proportion;
208 this->first_page_percent = other.first_page_percent;
209 this->start_page_index = other.start_page_index;
210 this->page_count = other.page_count;
211 return *this;
212 }
213
227 void Set(StraddlePositionType position, StraddleProportionType proportion, float first_page_percent, int start_page_index, int page_count) {
228 this->position = position;
229 this->proportion = proportion;
230 this->first_page_percent = first_page_percent;
231 this->start_page_index = start_page_index;
232 this->page_count = page_count;
233 }
234
240 StraddlePositionType position;
241
247 StraddleProportionType proportion;
248
253 float first_page_percent;
254
259 int start_page_index;
260
265 int page_count;
266 };
267
269 class PublicProperties FS_FINAL : public Object {
270 public:
276 typedef enum _LockType {
278 e_SealSignLockTypeNone = 0,
280 e_SealSignLockTypeSignatureXml = 1,
282 e_SealSignLockTypSignatureXmlAndOFDXml = 2
283 } LockType;
284
285
299 PublicProperties(bool image_visible = true, LockType lock_type = e_SealSignLockTypeNone, bool protect_annotations = false, bool protect_attachments = false, const String& directory_name = "") :
300 image_visible(image_visible),
301 lock_type(lock_type),
302 protect_annotations(protect_annotations),
303 protect_attachments(protect_attachments),
304 directory_name(directory_name) {
305 }
306
312 PublicProperties(const PublicProperties& other) {
313 this->image_visible = other.image_visible;
314 this->lock_type = other.lock_type;
315 this->protect_annotations = other.protect_annotations;
316 this->protect_attachments = other.protect_attachments;
317 this->directory_name = other.directory_name;
318 }
319
327 PublicProperties& operator = (const PublicProperties& other) {
328 this->image_visible = other.image_visible;
329 this->lock_type = other.lock_type;
330 this->protect_annotations = other.protect_annotations;
331 this->protect_attachments = other.protect_attachments;
332 this->directory_name = other.directory_name;
333 return *this;
334 }
335
351 void Set(bool image_visible, LockType lock_type, bool protect_annotations, bool protect_attachments, const String& dir_name) {
352 this->image_visible = image_visible;
353 this->lock_type = lock_type;
354 this->protect_annotations = protect_annotations;
355 this->protect_attachments = protect_attachments;
356 this->directory_name = dir_name;
357 }
358
364 bool image_visible;
365
371 LockType lock_type;
372
378 bool protect_annotations;
379
385 bool protect_attachments;
386
391 String directory_name;
392 };
393
395 class SealDoc FS_FINAL : public Base {
396 public:
402 explicit SealDoc(OFDDoc doc);
403
405 ~SealDoc();
406
412 SealDoc(const SealDoc& other);
413
421 SealDoc& operator = (const SealDoc& other);
422
430 bool operator == (const SealDoc& other) const;
431
439 bool operator != (const SealDoc& other) const;
440
448 bool IsEmpty() const;
449
460 bool SignWithPage(const Seal& seal, const ImagePosition& position, const String& dest_file, const PublicProperties& properties = PublicProperties());
461
472 bool SignWithPage(const Seal& seal, const ImagePosition& position, const WString& dest_file, const PublicProperties& properties = PublicProperties());
473
484 bool SignWithPage(const Seal& seal, const ImagePosition& position, foxit::common::file::WriterCallback* writer_callback, const PublicProperties& properties = PublicProperties());
485
498 bool SignWithMultiPage(const Seal& seal, const foxit::Int32Array& page_index_array, const ImagePosition& position, const String& dest_file, const PublicProperties& properties = PublicProperties());
499
512 bool SignWithMultiPage(const Seal& seal, const foxit::Int32Array& page_index_array, const ImagePosition& position, const WString& dest_file, const PublicProperties& properties = PublicProperties());
513
526 bool SignWithMultiPage(const Seal& seal, const foxit::Int32Array& page_index_array, const ImagePosition& position, foxit::common::file::WriterCallback* writer_callback, const PublicProperties& properties = PublicProperties());
527
541 bool SignWithMultiPage(const Seal& seal, const String& page_scope, const ImagePosition& position, const String& dest_file, const PublicProperties& properties = PublicProperties());
542
556 bool SignWithMultiPage(const Seal& seal, const String& page_scope, const ImagePosition& position, const WString& dest_file, const PublicProperties& properties = PublicProperties());
557
571 bool SignWithMultiPage(const Seal& seal, const String& page_scope, const ImagePosition& position, foxit::common::file::WriterCallback* writer_callback, const PublicProperties& properties = PublicProperties());
572
583 bool SignWithStraddle(const Seal& seal, const StraddlePosition& position, const String& dest_file, const PublicProperties& properties = PublicProperties());
584
595 bool SignWithStraddle(const Seal& seal, const StraddlePosition& position, const WString& dest_file, const PublicProperties& properties = PublicProperties());
596
607 bool SignWithStraddle(const Seal& seal, const StraddlePosition& position, foxit::common::file::WriterCallback* writer_callback, const PublicProperties& properties = PublicProperties());
608
619 bool SignWithMultiPosition(const Seal& seal, const ImagePositionArray& position_array, const String& dest_file, const PublicProperties& properties = PublicProperties());
620
631 bool SignWithMultiPosition(const Seal& seal, const ImagePositionArray& position_array, const WString& dest_file, const PublicProperties& properties = PublicProperties());
632
643 bool SignWithMultiPosition(const Seal& seal, const ImagePositionArray& position_array, foxit::common::file::WriterCallback* writer_callback, const PublicProperties& properties = PublicProperties());
644
645 explicit SealDoc(FS_HANDLE handle);
646 };
647
649 class SignatureProperties FS_FINAL : public Object {
650 public:
658 SignatureProperties(const String& company = String(), const String& provider_name = String(), const String& version = String()) :
659 company(company),
660 provider_name(provider_name),
661 version(version) {
662 }
663
669 SignatureProperties(SignatureProperties& other) {
670 this->company = other.company;
671 this->provider_name = other.provider_name;
672 this->version = other.version;
673 }
674
682 SignatureProperties& operator=(const SignatureProperties& other) {
683 this->company = other.company;
684 this->provider_name = other.provider_name;
685 this->version = other.version;
686 return *this;
687 }
688
698 void Set(const String& company, const String& provider_name, const String& version) {
699 this->company = company;
700 this->provider_name = provider_name;
701 this->version = version;
702 }
703
708 String company;
709
714 String provider_name;
715
720 String version;
721 };
722
724 class CertificateSignDoc FS_FINAL : public Base {
725 public:
733 explicit CertificateSignDoc(OFDDoc doc, const String& cert_file, const String& cert_password);
734
742 explicit CertificateSignDoc(OFDDoc doc, const WString& cert_file, const String& cert_password);
743
745 ~CertificateSignDoc();
746
752 CertificateSignDoc(const CertificateSignDoc& other);
753
761 CertificateSignDoc& operator = (const CertificateSignDoc& other);
762
770 bool operator == (const CertificateSignDoc& other) const;
771
779 bool operator != (const CertificateSignDoc& other) const;
780
788 bool IsEmpty() const;
789
799 bool SignWithNone(const String& dest_file, const SignatureProperties& signature_properties = SignatureProperties(), const PublicProperties& properties = PublicProperties());
800
810 bool SignWithNone(const WString& dest_file, const SignatureProperties& signature_properties = SignatureProperties(), const PublicProperties& properties = PublicProperties());
811
821 bool SignWithNone(foxit::common::file::WriterCallback* writer_callback, const SignatureProperties& signature_properties = SignatureProperties(), const PublicProperties& properties = PublicProperties());
822
834 bool SignWithImage(const String& image_file, const ImagePosition& position, const String& dest_file, const SignatureProperties& signature_properties = SignatureProperties(), const PublicProperties& properties = PublicProperties());
835
847 bool SignWithImage(const WString& image_file, const ImagePosition& position, const WString& dest_file, const SignatureProperties& signature_properties = SignatureProperties(), const PublicProperties& properties = PublicProperties());
848
860 bool SignWithImage(const String& image_file, const ImagePosition& position, foxit::common::file::WriterCallback* writer_callback, const SignatureProperties& signature_properties = SignatureProperties(), const PublicProperties& properties = PublicProperties());
861
875 bool SignWithStraddle(const String& image_file, float image_width, float image_height, const StraddlePosition& position, const String& dest_file, const SignatureProperties& signature_properties = SignatureProperties(), const PublicProperties& properties = PublicProperties());
876
890 bool SignWithStraddle(const WString& image_file, float image_width, float image_height, const StraddlePosition& position, const WString& dest_file, const SignatureProperties& signature_properties = SignatureProperties(), const PublicProperties& properties = PublicProperties());
891
905 bool SignWithStraddle(const String& image_file, float image_width, float image_height, const StraddlePosition& position, foxit::common::file::WriterCallback* writer_callback, const SignatureProperties& signature_properties = SignatureProperties(), const PublicProperties& properties = PublicProperties());
906
907 explicit CertificateSignDoc(FS_HANDLE handle);
908 };
909
910 } // namespace ofdseal
911 } // namespace ofd
912 } // namespace foxit
913
914 #endif // _BUILD_OFDSDK_
foxit::ofd::ofdseal::CertificateSignDoc::operator==
bool operator==(const CertificateSignDoc &other) const
相等操作符。
foxit::ofd::ofdseal::PublicProperties::e_SealSignLockTypeNone
锁定类型：无。
Definition: fs_ofdsign.h:278
foxit::ofd::ofdseal::SealDoc::IsEmpty
bool IsEmpty() const
检查当前对象是否为空。
foxit::ofd::ofdseal::CertificateSignDoc::operator !=
bool operator !=(const CertificateSignDoc &other) const
不相等操作符。
foxit::ofd::ofdseal::SealDoc::operator=
SealDoc & operator=(const SealDoc &other)
赋值操作符。
foxit::ofd::ofdseal::SealDoc::~SealDoc
~SealDoc()
析构函数。
foxit::ofd::ofdseal::ImagePosition::Set
void Set(int page_index, float x, float y, bool is_centered=true, float width=-1.0f, float height=-1.0f)
设置值。
Definition: fs_ofdsign.h:90
foxit::ofd::ofdseal::ImagePosition::y
float y
图像所在的Y坐标.
Definition: fs_ofdsign.h:115
IFX_FileWrite
文件写入接口。
Definition: fx_stream.h:470
foxit::ofd::ofdseal::StraddlePosition::start_page_index
int start_page_index
起始页面索引。
Definition: fs_ofdsign.h:259
foxit::Object
CFX_Object Object
对象类型。
Definition: fs_basictypes.h:220
foxit::ofd::ofdseal::StraddlePosition
Definition: fs_ofdsign.h:139
foxit::ofd::ofdseal::SignatureProperties::version
String version
签名提供版本。
Definition: fs_ofdsign.h:720
foxit::ofd::ofdseal::ImagePosition::x
float x
图像所在的X坐标.
Definition: fs_ofdsign.h:109
foxit::ofd::ofdseal::PublicProperties::image_visible
bool image_visible
签名或签章图片是否可见。 true表示可见，false表示不可见.
Definition: fs_ofdsign.h:364
foxit::ofd::ofdseal::StraddlePosition::position
StraddlePositionType position
骑缝章位置。 请参考从 StraddlePositionType::e_StraddlePositionTypeLeft 开始的值， 这应该是这些值中的一个。
Definition: fs_ofdsign.h:240
CFX_WideString
宽字符串类
Definition: fx_string.h:1457
foxit::ofd::ofdseal::PublicProperties::protect_annotations
bool protect_annotations
是否保护注释。 true表示保护，false表示不保护。
Definition: fs_ofdsign.h:378
foxit::ofd::ofdseal::SealDoc::SignWithMultiPage
bool SignWithMultiPage(const Seal &seal, const foxit::Int32Array &page_index_array, const ImagePosition &position, const String &dest_file, const PublicProperties &properties=PublicProperties())
在多页相同位置对OFD文档进行签章。
foxit::ofd::ofdseal::StraddlePosition::StraddlePosition
StraddlePosition(StraddlePositionType position, StraddleProportionType proportion, float first_page_percent, int start_page_index, int page_count)
带参数的构造函数。
Definition: fs_ofdsign.h:177
foxit::ofd::ofdseal::CertificateSignDoc::operator=
CertificateSignDoc & operator=(const CertificateSignDoc &other)
赋值操作符。
foxit::ofd::ofdseal::PublicProperties::directory_name
String directory_name
签名或签章目录名称。设置此参数，主要用于签章OFD文件合并。
Definition: fs_ofdsign.h:391
foxit::ofd::ofdseal::SealDoc::operator==
bool operator==(const SealDoc &other) const
相等操作符。
foxit::ofd::ofdseal::CertificateSignDoc::SignWithStraddle
bool SignWithStraddle(const String &image_file, float image_width, float image_height, const StraddlePosition &position, const String &dest_file, const SignatureProperties &signature_properties=SignatureProperties(), const PublicProperties &properties=PublicProperties())
对OFD文档进行数字签名，并添加跨页签名图像，即骑缝章。
foxit::ofd::ofdseal::ImagePosition::operator=
ImagePosition & operator=(const ImagePosition &other)
赋值操作符。
Definition: fs_ofdsign.h:67
foxit::ofd::ofdseal::PublicProperties::operator=
PublicProperties & operator=(const PublicProperties &other)
赋值操作符。
Definition: fs_ofdsign.h:327
foxit::ofd::ofdseal::SealDoc::SignWithMultiPosition
bool SignWithMultiPosition(const Seal &seal, const ImagePositionArray &position_array, const String &dest_file, const PublicProperties &properties=PublicProperties())
在多位置对OFD文档进行签章。
foxit::ofd::ofdseal::SealDoc::SignWithStraddle
bool SignWithStraddle(const Seal &seal, const StraddlePosition &position, const String &dest_file, const PublicProperties &properties=PublicProperties())
在跨页位置对OFD文档进行签章，即骑缝章。
foxit::ofd::ofdseal::SealDoc::SealDoc
SealDoc(OFDDoc doc)
带参数的构造函数。
foxit::ofd::ofdseal::CertificateSignDoc::SignWithImage
bool SignWithImage(const String &image_file, const ImagePosition &position, const String &dest_file, const SignatureProperties &signature_properties=SignatureProperties(), const PublicProperties &properties=PublicProperties())
对OFD文档进行数字签名，并添加签名图像。
foxit::ofd::ofdseal::Seal
Definition: fs_ofdoesseal.h:22
foxit::ofd::ofdseal::StraddlePosition::page_count
int page_count
添加骑缝章的页面数量。
Definition: fs_ofdsign.h:265
foxit::ofd::ofdseal::PublicProperties::lock_type
LockType lock_type
签名或签章锁定类型。 请参考从 LockType::e_SealSignLockTypeNone 开始的值， 这应该是这些值中的一个。
Definition: fs_ofdsign.h:371
foxit::ofd::ofdseal::CertificateSignDoc::CertificateSignDoc
CertificateSignDoc(OFDDoc doc, const String &cert_file, const String &cert_password)
带参数的构造函数。
foxit::ofd::ofdseal::StraddlePosition::proportion
StraddleProportionType proportion
骑缝章比例。 请参考从 StraddleProportionType::e_StraddleProportionOneFifth 开始的值， 这应该是这些值中的一个。
Definition: fs_ofdsign.h:247
foxit::ofd::ofdseal::SealDoc::operator !=
bool operator !=(const SealDoc &other) const
不相等操作符。
foxit::ofd::ofdseal::SignatureProperties::company
String company
签名提供公司名称。
Definition: fs_ofdsign.h:708
foxit::ofd::ofdseal::StraddlePosition::StraddlePosition
StraddlePosition(const StraddlePosition &other)
构造函数，通过另一个骑缝章位置对象。
Definition: fs_ofdsign.h:190
foxit::ofd::ofdseal::ImagePosition::ImagePosition
ImagePosition(int page_index, float x, float y, bool is_centered=true, float width=-1.0f, float height=-1.0f)
带参数的构造函数。
Definition: fs_ofdsign.h:37
CFX_ArrayTemplate< int32 >
foxit::ofd::ofdseal::CertificateSignDoc
Definition: fs_ofdsign.h:724
foxit::ofd::ofdseal::StraddlePosition::operator=
StraddlePosition & operator=(const StraddlePosition &other)
赋值操作符。
Definition: fs_ofdsign.h:205
foxit::FS_HANDLE
void * FS_HANDLE
句柄类型。
Definition: fs_basictypes.h:213
foxit::String
CFX_ByteString String
字节字符串。
Definition: fs_basictypes.h:224
fs_common.h
通用定义和类的头文件。
foxit::ofd::ofdseal::CertificateSignDoc::IsEmpty
bool IsEmpty() const
检查当前对象是否为空。
foxit::ofd::ofdseal::SignatureProperties
Definition: fs_ofdsign.h:649
foxit::ofd::OFDDoc
Definition: fs_ofddoc.h:271
foxit::ofd::ofdseal::ImagePosition::ImagePosition
ImagePosition(const ImagePosition &other)
构造函数，通过另一个ImagePosition对象。
Definition: fs_ofdsign.h:51
foxit::ofd::ofdseal::SignatureProperties::SignatureProperties
SignatureProperties(const String &company=String(), const String &provider_name=String(), const String &version=String())
带参数的构造函数。
Definition: fs_ofdsign.h:658
foxit::ofd::ofdseal::PublicProperties::e_SealSignLockTypeSignatureXml
锁定类型：锁定Signatures.xml。
Definition: fs_ofdsign.h:280
foxit::ofd::ofdseal::StraddlePosition::first_page_percent
float first_page_percent
第一页面骑缝章所占比例，范围为0.0到100.0之间的值。
Definition: fs_ofdsign.h:253
foxit::ofd::ofdseal::PublicProperties
Definition: fs_ofdsign.h:269
foxit::Base
Definition: fs_basictypes.h:465
foxit::ofd::ofdseal::PublicProperties::Set
void Set(bool image_visible, LockType lock_type, bool protect_annotations, bool protect_attachments, const String &dir_name)
设置值。
Definition: fs_ofdsign.h:351
foxit::ofd::ofdseal::ImagePosition
Definition: fs_ofdsign.h:24
foxit::ofd::ofdseal::PublicProperties::e_SealSignLockTypSignatureXmlAndOFDXml
锁定类型：锁定Signatures.xml和OFD.xml。
Definition: fs_ofdsign.h:282
foxit::ofd::ofdseal::SealDoc
Definition: fs_ofdsign.h:395
foxit
Foxit命名空间。
Definition: fs_taggedpdf.h:27
foxit::ofd::ofdseal::SignatureProperties::SignatureProperties
SignatureProperties(SignatureProperties &other)
构造函数，通过另一个签名属性对象。
Definition: fs_ofdsign.h:669
foxit::ofd::ofdseal::SealDoc::SignWithPage
bool SignWithPage(const Seal &seal, const ImagePosition &position, const String &dest_file, const PublicProperties &properties=PublicProperties())
在特定页特定位置对OFD文档进行签章。
CFX_ByteString
字节字符串类
Definition: fx_string.h:317
foxit::ofd::ofdseal::PublicProperties::PublicProperties
PublicProperties(const PublicProperties &other)
构造函数，通过另一个公共属性对象。
Definition: fs_ofdsign.h:312
foxit::ofd::ofdseal::StraddlePosition::StraddlePositionType
StraddlePositionType
Definition: fs_ofdsign.h:142
foxit::ofd::ofdseal::PublicProperties::LockType
LockType
OFD签名/签章锁定类型定义枚举类型.
Definition: fs_ofdsign.h:276
foxit::ofd::ofdseal::ImagePosition::page_index
int page_index
图像所在页的索引.
Definition: fs_ofdsign.h:103
foxit::ofd::ofdseal::SignatureProperties::Set
void Set(const String &company, const String &provider_name, const String &version)
设置值。
Definition: fs_ofdsign.h:698
foxit::ofd::ofdseal::SignatureProperties::provider_name
String provider_name
签名提供者名称。
Definition: fs_ofdsign.h:714
foxit::ofd::ofdseal::CertificateSignDoc::~CertificateSignDoc
~CertificateSignDoc()
析构函数。
foxit::ofd::ofdseal::ImagePosition::height
float height
图像的高度.
Definition: fs_ofdsign.h:133
foxit::ofd::ofdseal::ImagePosition::is_centered
bool is_centered
图像是否居中. true表示居中，false表示不居中.
Definition: fs_ofdsign.h:121
foxit::ofd::ofdseal::ImagePosition::width
float width
图像的宽度.
Definition: fs_ofdsign.h:127
foxit::ofd::ofdseal::PublicProperties::protect_attachments
bool protect_attachments
是否保护附件。 true表示保护，false表示不保护。
Definition: fs_ofdsign.h:385
foxit::ofd::ofdseal::PublicProperties::PublicProperties
PublicProperties(bool image_visible=true, LockType lock_type=e_SealSignLockTypeNone, bool protect_annotations=false, bool protect_attachments=false, const String &directory_name="")
带参数的构造函数。
Definition: fs_ofdsign.h:299
foxit::ofd::ofdseal::SignatureProperties::operator=
SignatureProperties & operator=(const SignatureProperties &other)
赋值操作符。
Definition: fs_ofdsign.h:682
foxit::ofd::ofdseal::CertificateSignDoc::SignWithNone
bool SignWithNone(const String &dest_file, const SignatureProperties &signature_properties=SignatureProperties(), const PublicProperties &properties=PublicProperties())
对OFD文档进行数字签名，但不添加签名图像。
foxit::ofd::ofdseal::StraddlePosition::Set
void Set(StraddlePositionType position, StraddleProportionType proportion, float first_page_percent, int start_page_index, int page_count)
设置值。
Definition: fs_ofdsign.h:227
foxit::ofd::ofdseal::StraddlePosition::StraddleProportionType
StraddleProportionType
Definition: fs_ofdsign.h:154