Foxit PDF SDK
|
Public Member Functions | |
Attachments (const PDFDoc &doc, const objects::PDFNameTree &nametree=foxit::pdf::objects::PDFNameTree()) | |
Constructor, with parameters. from a PDF document object and an EmbeddedFiles name tree (if any). More... | |
Attachments (const Attachments &other) | |
Constructor, with another attachments object. More... | |
~Attachments () | |
Destructor. | |
bool | AddEmbeddedFile (const WString &key, const FileSpec &file_spec) |
Add an embedded attachment (as file specification object) with new key name. More... | |
bool | AddFromFilePath (const WString &key, const wchar_t *file_path) |
Add a new attachment from specified file path with new key name. More... | |
bool | ExtractEmbeddedFileTo (const WString &key, const wchar_t *dst_file_path) |
Extract an attachment and save it to a specified file path. More... | |
int | GetCount () |
Get the count of attachments. More... | |
FileSpec | GetEmbeddedFile (const WString &key) |
Get the attachment (as file specification object) of a specified key. More... | |
WString | GetKey (int index) |
Get the key of an attachment defined in the EmbeddedFiles name tree, by index. More... | |
objects::PDFNameTree | GetNameTree () const |
Get the EmbeddedFiles name tree. More... | |
bool | IsEmpty () const |
Check whether current object is empty or not. More... | |
bool | operator != (const Attachments &other) const |
Not equal operator. More... | |
Attachments & | operator= (const Attachments &other) |
Assign operator. More... | |
bool | operator== (const Attachments &other) const |
Equal operator. More... | |
bool | RemoveAllEmbeddedFiles () |
Remove all attachments. More... | |
bool | RemoveEmbeddedFile (const WString &key) |
Remove an attachment by key. More... | |
bool | SetEmbeddedFile (const WString &key, const FileSpec &file_spec) |
Set an embedded attachment (as file specification object) for a specified key. More... | |
![]() | |
FS_HANDLE | Handle () const |
Get the handle of current object. More... | |
In application, document's embedded files are known as PDF attachments. This class offers a more convenient way, than class objects::PDFNameTree, to get/set embedded files (also known as attachment files) in EmbeddedFiles name tree of a PDF document.
|
explicit |
Constructor, with parameters. from a PDF document object and an EmbeddedFiles name tree (if any).
[in] | doc | A valid PDF document object. |
[in] | nametree | A PDF name tree object that represents an EmbeddedFiles name tree. If this PDF name tree object is constructed by default constructor and has not been set any value, that means the attachments object will be constructed from PDF document; otherwise, please ensure it belongs to the PDF document specified by parameter doc. Default value: a PDF name tree object by default constructor and not set any value. |
foxit::pdf::Attachments::Attachments | ( | const Attachments & | other | ) |
Constructor, with another attachments object.
[in] | other | Another attachments object. |
Add an embedded attachment (as file specification object) with new key name.
All attachments in EmbeddedFiles name tree are ordered by their keys. When a new attachment is added, Foxit PDF SDK will find a suitable place in the name tree to add it. After adding successfully, the indexes of some old keys may be changed.
[in] | key | New key string. If this is an empty string, the name of input file_spec will be used as the new key. This new key should not have existed in the PDF document to which current attachments object belongs. |
[in] | file_spec | A file specification object to be added with new key. It should be valid and should has been embedded to the same PDF document as current attachments object. |
bool foxit::pdf::Attachments::AddFromFilePath | ( | const WString & | key, |
const wchar_t * | file_path | ||
) |
Add a new attachment from specified file path with new key name.
All attachments in EmbeddedFiles name tree are ordered by their keys. When a new attachment is added, Foxit PDF SDK will find a suitable place in the name tree to add it. After adding successfully, the indexes of some old keys may be changed.
[in] | key | New key string. If this is an empty string, the name of input file_spec will be used as the new key. This new key should not have existed in the PDF document to which current attachments object belongs. |
[in] | file_path | A file path to specify a file to be embedded to the PDF document and also added to EmbeddedFiles name tree. |
bool foxit::pdf::Attachments::ExtractEmbeddedFileTo | ( | const WString & | key, |
const wchar_t * | dst_file_path | ||
) |
Extract an attachment and save it to a specified file path.
[in] | key | Key string. This should not be an empty string. |
[in] | dst_file_path | A file path, to which the data of attachment will be saved. This should not be an empty string. |
int foxit::pdf::Attachments::GetCount | ( | ) |
Get the count of attachments.
Get the attachment (as file specification object) of a specified key.
[in] | key | Key string. It should not be an empty string. |
WString foxit::pdf::Attachments::GetKey | ( | int | index | ) |
Get the key of an attachment defined in the EmbeddedFiles name tree, by index.
[in] | index | Index of the key string to be retrieved. Valid range: from 0 to (count-1). count is returned by function Attachments::GetCount. |
objects::PDFNameTree foxit::pdf::Attachments::GetNameTree | ( | ) | const |
Get the EmbeddedFiles name tree.
bool foxit::pdf::Attachments::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::Attachments::operator != | ( | const Attachments & | other | ) | const |
Not equal operator.
[in] | other | Another attachments object. This function will check if current object is not equal to this one. |
Attachments& foxit::pdf::Attachments::operator= | ( | const Attachments & | other | ) |
Assign operator.
[in] | other | Another attachments object, whose value would be assigned to current object. |
bool foxit::pdf::Attachments::operator== | ( | const Attachments & | other | ) | const |
Equal operator.
[in] | other | Another attachments object. This function will check if current object is equal to this one. |
bool foxit::pdf::Attachments::RemoveAllEmbeddedFiles | ( | ) |
Remove all attachments.
bool foxit::pdf::Attachments::RemoveEmbeddedFile | ( | const WString & | key | ) |
Remove an attachment by key.
If the input key does not exist in EmbeddedFiles name tree, this function will return true directly.
[in] | key | Key string. This should not be an empty string. |
Set an embedded attachment (as file specification object) for a specified key.
[in] | key | Key string. It should not be an empty string. This name should have existed in current PDF document. |
[in] | file_spec | A file specification object to be set to the key's value. It should be valid and should has been embedded to the same PDF document as current attachments object. |