|
Foxit PDF SDK
|
Public 类型 | |
| enum | Flags { e_FlagReadOnly = 0x01, e_FlagRequired = 0x02, e_FlagNoExport = 0x04, e_FlagButtonNoToggleToOff = 0x100, e_FlagButtonRadiosInUnison = 0x200, e_FlagTextMultiline = 0x100, e_FlagTextPassword = 0x200, e_FlagTextFileSelect = 0x400, e_FlagTextNoSpellCheck = 0x800, e_FlagTextDoNotScroll = 0x1000, e_FlagTextComb = 0x2000, e_FlagComboEdit = 0x100, e_FlagChoiceMultiSelect = 0x100, e_FlagTextRichText = 0x4000, e_FlagChoiceSort = 0x200, e_FlagChoiceCommitOnSelChange = 0x400 } |
| 表单字段标志的枚举。 更多... | |
| enum | Type { e_TypeUnknown = 0, e_TypePushButton = 1, e_TypeCheckBox = 2, e_TypeRadioButton = 3, e_TypeComboBox = 4, e_TypeListBox = 5, e_TypeTextField = 6, e_TypeSignature = 7 } |
| 表单字段类型的枚举。 更多... | |
Public 成员函数 | |
| Field (const PDFDoc &document, objects::PDFDictionary *field_dict) | |
| 从字段字典构造函数。 更多... | |
| Field (const Field &field) | |
| 构造函数,使用另一个表单字段对象。 更多... | |
| ~Field () | |
| 析构函数。 | |
| common::Alignment | GetAlignment () const |
| 获取对齐值。 更多... | |
| WString | GetAlternateName () const |
| 获取备用名称。 更多... | |
| Control | GetControl (int index) |
| 通过索引获取表单控件。 更多... | |
| Control | GetControl (const foxit::pdf::PDFPage &page, int index) |
| 在指定PDF页面中通过索引获取表单控件。 更多... | |
| int | GetControlCount () const |
| 获取表单控件数量。 更多... | |
| int | GetControlCount (const foxit::pdf::PDFPage &page) const |
| 获取指定PDF页面中的表单控件数量。 更多... | |
| DefaultAppearance | GetDefaultAppearance () const |
| 获取默认外观数据。 更多... | |
| WString | GetDefaultValue () const |
| 获取默认值。 更多... | |
| objects::PDFObject * | GetDefaultValueObj () const |
| 获取字段默认值的PDF对象。 更多... | |
| objects::PDFDictionary * | GetDict () const |
| 获取当前对象的PDF字典。 更多... | |
| uint32 | GetFlags () const |
| 获取字段标志。 更多... | |
| objects::PDFObject * | GetInheritedAttribute (const char *attribute_name) const |
| 获取指定属性的PDF对象,该属性可能从字段树中的祖先节点继承。 更多... | |
| WString | GetMappingName () const |
| 获取映射名称。 更多... | |
| int | GetMaxLength () const |
| 获取字段文本的最大长度(以字符为单位)。 更多... | |
| WString | GetName () const |
| 获取字段名称。 更多... | |
| ChoiceOptionArray | GetOptions () const |
| 获取列表框或组合框的选项。 更多... | |
| int | GetTopVisibleIndex () |
| 获取可滚动列表框的选项顶部索引。 更多... | |
| Type | GetType () const |
| 获取字段类型。 更多... | |
| WString | GetValue () const |
| 获取值。 更多... | |
| objects::PDFObject * | GetValueObj () const |
| 获取字段值的PDF对象。 更多... | |
| bool | IsEmpty () const |
| 检查当前对象是否为空。 更多... | |
| bool | operator != (const Field &other) const |
| 不等于操作符。 更多... | |
| Field & | operator= (const Field &other) |
| 赋值操作符。 更多... | |
| bool | operator== (const Field &other) const |
| 等于操作符。 更多... | |
| bool | Reset () |
| 将当前字段中的数据重置为其默认值。(不支持签名字段) 更多... | |
| void | SetAlignment (common::Alignment alignment) |
| 设置表单的对齐属性,作为文档范围的默认值。(不支持签名字段) 更多... | |
| void | SetAlternateName (const wchar_t *alternate_name) |
| 设置备用名称。(不支持签名字段) 更多... | |
| void | SetDefaultAppearance (const DefaultAppearance &default_ap) |
| 设置默认外观数据。 更多... | |
| void | SetDefaultValue (const wchar_t *value) |
| 设置默认值。 更多... | |
| void | SetFlags (uint32 flags) |
| 设置字段标志。 更多... | |
| void | SetMappingName (const wchar_t *name) |
| 设置映射名称。(不支持签名字段) 更多... | |
| void | SetMaxLength (int max_length) |
| 设置字段文本的最大长度(以字符为单位)。 更多... | |
| void | SetOptions (const ChoiceOptionArray &option_array) |
| 设置列表框或组合框的选项。 更多... | |
| void | SetTopVisibleIndex (int index) |
| 设置可滚动列表框的顶部索引。 更多... | |
| void | SetValue (const wchar_t *value) |
| 设置值。 更多... | |
Public 成员函数 继承自 foxit::Base | |
| FS_HANDLE | Handle () const |
| 获取当前对象的句柄。 更多... | |
在PDF文档中,表单字段出现在页面的任何组合上,所有这些字段组成一个跨越整个文档的 单一全局交互式表单。函数Form::GetField可用于从交互式表单获取表单字段。 此类提供了获取表单字段一些信息/属性、将表单字段重置为其默认值以及从表单字段获取 表单控件的函数。
当表单字段的类型为Field::e_TypeSignature时, 表单字段对象实际上是一个签名对象。
要访问附加操作,请使用Field对象构造actions::AdditionalAction对象。
表单字段标志的枚举。
此枚举的值可以单独使用或组合使用。
| foxit::pdf::interform::Field::Field | ( | const PDFDoc & | document, |
| objects::PDFDictionary * | field_dict | ||
| ) |
从字段字典构造函数。
| [in] | document | 一个有效的PDF文档。 |
| [in] | field_dict | 表示表单字段的PDF字典。它应该属于参数document指定的PDF文档。 |
| foxit::pdf::interform::Field::Field | ( | const Field & | field | ) |
构造函数,使用另一个表单字段对象。
| [in] | field | 另一个表单字段对象。 |
| common::Alignment foxit::pdf::interform::Field::GetAlignment | ( | ) | const |
获取对齐值。
对齐是可变文本的属性,仅对文本字段、列表框和组合框有用, 这些字段可能包含可变文本作为其内容。
如果文本字段或列表框有自己的对齐值,则将忽略文档范围的默认对齐值; 否则,将为文本字段或列表框使用文档范围的默认对齐值。
| WString foxit::pdf::interform::Field::GetAlternateName | ( | ) | const |
获取备用名称。
备用字段名称用于在用户界面中必须标识字段的任何地方 (例如在引用字段的错误或状态消息中)代替实际字段名称。 此文本在提取文档内容以支持残障用户的可访问性或其他目的时也很有用。
| Control foxit::pdf::interform::Field::GetControl | ( | int | index | ) |
| Control foxit::pdf::interform::Field::GetControl | ( | const foxit::pdf::PDFPage & | page, |
| int | index | ||
| ) |
在指定PDF页面中通过索引获取表单控件。
| [in] | page | 有效的PDF页面对象。它应该与当前表单字段在同一文档中。 |
| [in] | index | 表单控件索引。有效范围:从0到(count-1)。 count由函数Field::GetControlCount使用 相同参数page返回。 |
| int foxit::pdf::interform::Field::GetControlCount | ( | ) | const |
获取表单控件数量。
| int foxit::pdf::interform::Field::GetControlCount | ( | const foxit::pdf::PDFPage & | page | ) | const |
获取指定PDF页面中的表单控件数量。
| [in] | page | 有效的PDF页面对象。它应该与当前表单字段在同一文档中。 |
| DefaultAppearance foxit::pdf::interform::Field::GetDefaultAppearance | ( | ) | const |
获取默认外观数据。
| WString foxit::pdf::interform::Field::GetDefaultValue | ( | ) | const |
获取默认值。
适用于除按钮以外的所有字段。
| objects::PDFObject* foxit::pdf::interform::Field::GetDefaultValueObj | ( | ) | const |
获取字段默认值的PDF对象。
字段默认值的格式因字段类型而异。有关更多详细信息, 请参考《PDF参考1.7》P676中的"表8.69 所有字段字典的通用条目"。
| objects::PDFDictionary* foxit::pdf::interform::Field::GetDict | ( | ) | const |
获取当前对象的PDF字典。
| uint32 foxit::pdf::interform::Field::GetFlags | ( | ) | const |
| objects::PDFObject* foxit::pdf::interform::Field::GetInheritedAttribute | ( | const char * | attribute_name | ) | const |
获取指定属性的PDF对象,该属性可能从字段树中的祖先节点继承。
某些字段属性被指定为可继承的,例如"Ff"、"V"、"DV"等。 请参考《PDF参考1.7》P675中的"表8.69 所有字段字典的通用条目"。 如果没有由attribute_name指定的条目或发生任何错误,此函数将返回NULL。
| [in] | attribute_name | 要查找的属性名称。 |
| WString foxit::pdf::interform::Field::GetMappingName | ( | ) | const |
获取映射名称。
映射名称用于从文档导出交互式表单字段数据时使用。
| int foxit::pdf::interform::Field::GetMaxLength | ( | ) | const |
获取字段文本的最大长度(以字符为单位)。
适用于文本字段。对于不适用的字段类型,此函数将返回0。
| WString foxit::pdf::interform::Field::GetName | ( | ) | const |
获取字段名称。
| ChoiceOptionArray foxit::pdf::interform::Field::GetOptions | ( | ) | const |
获取列表框或组合框的选项。
适用于列表框和组合框。对于不适用的字段类型, 此函数将返回空数组。
| int foxit::pdf::interform::Field::GetTopVisibleIndex | ( | ) |
获取可滚动列表框的选项顶部索引。
适用于列表框。对于不适用的字段类型, 此函数将返回0。
选项的顶部索引是列表中第一个可见选项的索引。
| Type foxit::pdf::interform::Field::GetType | ( | ) | const |
获取字段类型。
| WString foxit::pdf::interform::Field::GetValue | ( | ) | const |
获取值。
适用于除按钮以外的所有字段。 对于不适用的字段类型,将返回空字符串。 对于复选框和单选框,此函数将返回外观状态值。
| objects::PDFObject* foxit::pdf::interform::Field::GetValueObj | ( | ) | const |
获取字段值的PDF对象。
字段值的格式因字段类型而异。有关更多详细信息,请参考 《PDF参考1.7》P676中的"表8.69 所有字段字典的通用条目"。
| bool foxit::pdf::interform::Field::IsEmpty | ( | ) | const |
检查当前对象是否为空。
当当前对象为空时,意味着当前对象无用。
| bool foxit::pdf::interform::Field::operator != | ( | const Field & | other | ) | const |
不等于操作符。
| [in] | other | 另一个表单字段对象。此函数将检查当前对象是否不等于此对象。 |
赋值操作符。
| [in] | other | 另一个表单字段对象,其值将被赋给当前对象。 |
| bool foxit::pdf::interform::Field::operator== | ( | const Field & | other | ) | const |
等于操作符。
| [in] | other | 另一个表单字段对象。此函数将检查当前对象是否等于此对象。 |
| bool foxit::pdf::interform::Field::Reset | ( | ) |
将当前字段中的数据重置为其默认值。(不支持签名字段)
| void foxit::pdf::interform::Field::SetAlignment | ( | common::Alignment | alignment | ) |
设置表单的对齐属性,作为文档范围的默认值。(不支持签名字段)
对齐是可变文本的属性,仅对文本字段、列表框和组合框有用, 这些字段可能包含可变文本作为其内容。
如果文本字段或列表框有自己的对齐值,则将忽略文档范围的默认对齐值; 否则,将为文本字段或列表框使用文档范围的默认对齐值。
如果当前表单字段是签名字段,此函数不执行任何操作。
| [in] | alignment | 可变文本的新默认对齐类型。请参考从 common::e_AlignmentLeft开始的值,这应该是其中一个值。 如果使用其他值设置,默认将使用common::e_AlignmentLeft。 |
| void foxit::pdf::interform::Field::SetAlternateName | ( | const wchar_t * | alternate_name | ) |
设置备用名称。(不支持签名字段)
备用字段名称用于在用户界面中必须标识字段的任何地方 (例如在引用字段的错误或状态消息中)代替实际字段名称。 此文本在提取文档内容以支持残障用户的可访问性或其他目的时也很有用。
如果当前表单字段是签名字段,此函数不执行任何操作。
| [in] | alternate_name | 新的备用名称字符串。它不应该是空字符串。 |
| void foxit::pdf::interform::Field::SetDefaultAppearance | ( | const DefaultAppearance & | default_ap | ) |
设置默认外观数据。
| [in] | default_ap | 新的默认外观。输入数据的flags可用于决定 哪些信息要用新数据更新;对于那些没有更新的数据, 它们将继续使用旧数据。 如果输入默认外观数据的text_size为0,意味着文本大小 应该自动计算。 |
| void foxit::pdf::interform::Field::SetDefaultValue | ( | const wchar_t * | value | ) |
设置默认值。
适用于除按钮以外的所有字段。 对于不适用的字段类型,此函数不执行任何操作。
| [in] | value | 新的默认值字符串。它不应该是空字符串。 |
| void foxit::pdf::interform::Field::SetFlags | ( | uint32 | flags | ) |
| void foxit::pdf::interform::Field::SetMappingName | ( | const wchar_t * | name | ) |
设置映射名称。(不支持签名字段)
映射名称用于从文档导出交互式表单字段数据时使用。 如果当前表单字段是签名字段,此函数不执行任何操作。
| [in] | name | 新的映射名称字符串。它不应该是空字符串。 |
| void foxit::pdf::interform::Field::SetMaxLength | ( | int | max_length | ) |
设置字段文本的最大长度(以字符为单位)。
适用于文本字段。对于不适用的字段类型,此函数不执行任何操作。
| [in] | max_length | 字段文本的新最大长度。它应该是非负数。 |
| void foxit::pdf::interform::Field::SetOptions | ( | const ChoiceOptionArray & | option_array | ) |
设置列表框或组合框的选项。
适用于列表框和组合框。对于不适用的字段类型, 此函数不执行任何操作。
| [in] | option_array | 要设置到列表框或组合框的选项数组。 |
| void foxit::pdf::interform::Field::SetTopVisibleIndex | ( | int | index | ) |
设置可滚动列表框的顶部索引。
适用于列表框。对于不适用的字段类型, 此函数不执行任何操作。
选项的顶部索引是列表中第一个可见选项的索引。
| [in] | index | 列表中第一个可见选项的索引。 |
| void foxit::pdf::interform::Field::SetValue | ( | const wchar_t * | value | ) |
设置值。
适用于除按钮以外的所有字段。对于不适用的字段类型, 此函数不执行任何操作。
特别地,对于组合框和文本字段,当成功设置值时,此函数还将 触发相关的计算和格式化事件并更新字段的外观。
| [in] | value | 新值字符串。特别地,当当前字段是列表框字段时,此参数可以 包含多个值: 当要设置多个值时,每个值应该用"()"包装。例如, "(ABC)(CCC)" 表示设置两个值 "ABC" 和 "CCC"。 如果值包含"()"或"\"作为其内容,请在每个"()"或"\"字符前 添加额外的"\"作为转义字符。例如:
|