Public Member Functions | |
Metadata (const PDFDoc &document) | |
Constructor, from a PDF document object. More... | |
Metadata (const Metadata &other) | |
Constructor, with another Metadata object. More... | |
~Metadata () | |
Destructor. | |
DateTime | GetCreationDateTime () const |
Get creation date time. More... | |
WStringArray | GetCustomerKeys () |
Get customer keys from metadata. More... | |
DateTime | GetModifiedDateTime () const |
Get modified date time. More... | |
WStringArray | GetValues (const wchar_t *key) const |
Get metadata value(s). More... | |
bool | HasKey (const wchar_t *key) const |
Check whether the related PDF document has a specified metadata key or not. More... | |
bool | IsEmpty () const |
Check whether current object is empty or not. More... | |
bool | operator!= (const Metadata &other) const |
Not equal operator. More... | |
Metadata & | operator= (const Metadata &other) |
Assign operator. More... | |
bool | operator== (const Metadata &other) const |
Equal operator. More... | |
void | RemoveCustomerKey (const wchar_t *key) |
Remove a specified customer key (along with related value). More... | |
void | SetCreationDateTime (const DateTime &date_time) |
Set creation date time. More... | |
void | SetModifiedDateTime (const DateTime &date_time) |
Set modified date time. More... | |
bool | SetValues (const wchar_t *key, const WStringArray &value_array) |
Set metadata value(s). More... | |
![]() | |
FS_HANDLE | Handle () const |
Get the handle of current object. More... | |
In PDF document, metadata information is stored in document's Info dictionary or in metadata stream (represented in Extensible Markup Language, known as XML). When a key exists in both Info dictionary and metadata stream, the latest modified one will be used.
This class is constructed from PDF document object and is used to get or set metadata information from both document's Info dictionary and metadata stream.
|
explicit |
Constructor, from a PDF document object.
If there exists metadata information in the specified PDF document, this function is just to construct a Metadata object to be associated with these information. If there is no such information in the specified PDF document, the constructed Metadata object can be used to set metadata information to PDF document.
[in] | document | A valid PDF document object. |
foxit::pdf::Metadata::Metadata | ( | const Metadata & | other | ) |
DateTime foxit::pdf::Metadata::GetCreationDateTime | ( | ) | const |
Get creation date time.
WStringArray foxit::pdf::Metadata::GetCustomerKeys | ( | ) |
Get customer keys from metadata.
In Info dictionary and metadata stream, they have some standard keys which have same feature but different name. For this case, Foxit PDF SDK will use the standard key names in Info dictionary. Besides these standard keys, other keys will be treated as customer keys.
DateTime foxit::pdf::Metadata::GetModifiedDateTime | ( | ) | const |
Get modified date time.
WStringArray foxit::pdf::Metadata::GetValues | ( | const wchar_t * | key | ) | const |
Get metadata value(s).
For a metadata key, it may contain single or multiple values.
[in] | key | Metadata key string. It should not be an empty string. Currently it can be one of the following keys: "Title", "Author", "Subject", "Keywords", "Creator", "Producer", "Trapped", "CreationDate", "ModDate", "pdfaid". It can also be some other custom information keys if they're supported by the PDF file. For "CreationDate" and "ModDate", user is recommended to use functions Metadata::GetCreationDateTime and Metadata::GetModifiedDateTime to get the date information. |
bool foxit::pdf::Metadata::HasKey | ( | const wchar_t * | key | ) | const |
Check whether the related PDF document has a specified metadata key or not.
[in] | key | The metadata key to be checked. |
bool foxit::pdf::Metadata::IsEmpty | ( | ) | const |
Check whether current object is empty or not.
When the current object is empty, that means current object is useless.
bool foxit::pdf::Metadata::operator!= | ( | const Metadata & | other | ) | const |
Not equal operator.
[in] | other | Another Metadata object. This function will check if current object is not equal to this one. |
Assign operator.
[in] | other | Another Metadata object, whose value would be assigned to current object. |
bool foxit::pdf::Metadata::operator== | ( | const Metadata & | other | ) | const |
Equal operator.
[in] | other | Another Metadata object. This function will check if current object is equal to this one. |
void foxit::pdf::Metadata::RemoveCustomerKey | ( | const wchar_t * | key | ) |
Remove a specified customer key (along with related value).
[in] | key | A customer key string. It should not be an empty string. This should be one of the keys retrieved from function Metadata::GetCustomerKeys. |
void foxit::pdf::Metadata::SetCreationDateTime | ( | const DateTime & | date_time | ) |
Set creation date time.
[in] | date_time | New creation date time. Please refer to comment of class DateTime to check the valid range for each member. |
void foxit::pdf::Metadata::SetModifiedDateTime | ( | const DateTime & | date_time | ) |
Set modified date time.
[in] | date_time | New modified date time. Please refer to comment of class DateTime to check the valid range for each member. |
bool foxit::pdf::Metadata::SetValues | ( | const wchar_t * | key, |
const WStringArray & | value_array | ||
) |
Set metadata value(s).
This function is used to set single or multiple values to a specified metadata key:
[in] | key | Metadata key string. It should not be an empty string. Currently it can be one of the following keys: "Title", "Author", "Subject", "Keywords", "Creator", "Producer", "Trapped", "CreationDate", "ModDate", "pdfaid". It can also be some other custom information keys if they're supported by the PDF file. For "CreationDate" and "ModDate", user is recommended to use functions Metadata::SetCreationDateTime and Metadata::SetModifiedDateTime to set the date information. |
[in] | value_array | An string array of metadata value(s). |