In application, document's embedded files are known as PDF attachments. This class offers a more convenient way, than class PDFNameTree, to get/set embedded files (also known as attachment files) in EmbeddedFiles name tree of a PDF document.
- See also
- PDFDoc
-
PDFNameTree
- Examples
- /Users/ec2-user/gitlab-runner/builds/E-xKdhDo/0/foxit/sdk/mobile/gsdk-doc-auto-build/harmony_nodejs/input/Index.js.
◆ AddEmbeddedFile()
| Attachments.AddEmbeddedFile |
( |
key |
, |
|
|
file_spec |
|
|
) |
| |
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.
- Parameters
-
| [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. |
- Returns
- true means success, while false means failure.
- Examples
- /Users/ec2-user/gitlab-runner/builds/E-xKdhDo/0/foxit/sdk/mobile/gsdk-doc-auto-build/harmony_nodejs/input/Index.js.
◆ AddFromFilePath()
| Attachments.AddFromFilePath |
( |
key |
, |
|
|
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.
- Parameters
-
| [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. |
- Returns
- true means success, while false means failure.
- Examples
- /Users/ec2-user/gitlab-runner/builds/E-xKdhDo/0/foxit/sdk/mobile/gsdk-doc-auto-build/harmony_nodejs/input/Index.js.
◆ constructor()
| Attachments.constructor |
( |
doc |
, |
|
|
nametree |
|
|
) |
| |
Constructor, with parameters. from a PDF document object and an EmbeddedFiles name tree (if any).
-
If no name tree object is specified, this function will construct the attachments object from PDF document: if there exists EmbeddedFiles name tree in the PDF document, this function is just to construct an attachments object to be associated with the name tree; If there is no such name tree in PDF document, the constructed attachments object can be used to create such name tree in PDF document and add some embedded files to the name tree.
-
If an EmbeddedFiles name tree is specified, this function will construct the attachments object from the name tree, along with the related PDF document.
- Parameters
-
| [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. |
- Examples
- /Users/ec2-user/gitlab-runner/builds/E-xKdhDo/0/foxit/sdk/mobile/gsdk-doc-auto-build/harmony_nodejs/input/Index.js.
◆ ExtractEmbeddedFileTo()
| Attachments.ExtractEmbeddedFileTo |
( |
key |
, |
|
|
dst_file_path |
|
|
) |
| |
◆ GetCount()
◆ GetEmbeddedFile()
| Attachments.GetEmbeddedFile |
( |
key |
| ) |
|
◆ GetKey()
| Attachments.GetKey |
( |
index |
| ) |
|
◆ GetNameTree()
| Attachments.GetNameTree |
( |
| ) |
|
◆ IsEmpty()
◆ RemoveAllEmbeddedFiles()
| Attachments.RemoveAllEmbeddedFiles |
( |
| ) |
|
◆ RemoveEmbeddedFile()
| Attachments.RemoveEmbeddedFile |
( |
key |
| ) |
|
◆ SetEmbeddedFile()
| Attachments.SetEmbeddedFile |
( |
key |
, |
|
|
file_spec |
|
|
) |
| |