|
| Attachments (PDFDoc doc, PDFNameTree nametree) |
| Constructor, with parameters. from a PDF document object and an EmbeddedFiles name tree (if any). More...
|
|
| Attachments (Attachments other) |
| Constructor, with another attachments object. More...
|
|
boolean | addEmbeddedFile (String key, FileSpec file_spec) throws com.foxit.sdk.PDFException |
| Add an embedded attachment (as file specification object) with new key name. More...
|
|
boolean | addFromFilePath (String key, String file_path) throws com.foxit.sdk.PDFException |
| Add a new attachment from specified file path with new key name. More...
|
|
synchronized void | delete () |
| Clean up related resources immediately. More...
|
|
boolean | extractEmbeddedFileTo (String key, String dst_file_path) throws com.foxit.sdk.PDFException |
| Extract an attachment and save it to a specified file path. More...
|
|
int | getCount () throws com.foxit.sdk.PDFException |
| Get the count of attachments. More...
|
|
FileSpec | getEmbeddedFile (String key) throws com.foxit.sdk.PDFException |
| Get the attachment (as file specification object) of a specified key. More...
|
|
String | getKey (int index) throws com.foxit.sdk.PDFException |
| Get the key of an attachment defined in the EmbeddedFiles name tree, by index. More...
|
|
PDFNameTree | getNameTree () |
| Get the EmbeddedFiles name tree. More...
|
|
boolean | isEmpty () |
| Check whether current object is empty or not. More...
|
|
boolean | removeAllEmbeddedFiles () throws com.foxit.sdk.PDFException |
| Remove all attachments. More...
|
|
boolean | removeEmbeddedFile (String key) throws com.foxit.sdk.PDFException |
| Remove an attachment by key. More...
|
|
boolean | setEmbeddedFile (String key, FileSpec file_spec) throws com.foxit.sdk.PDFException |
| Set an embedded attachment (as file specification object) for a specified key. More...
|
|
synchronized void | delete () |
| Clean up related resources immediately. More...
|
|
In application, document's embedded files are known as PDF attachments. This class offers a more convenient way, than class com.foxit.sdk.pdf.objects.PDFNameTree , to get/set embedded files (also known as attachment files) in EmbeddedFiles name tree of a PDF document.
- See also
- PDFDoc
-
com.foxit.sdk.pdf.objects.PDFNameTree
◆ Attachments() [1/2]
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. |
◆ Attachments() [2/2]
com.foxit.sdk.pdf.Attachments.Attachments |
( |
Attachments |
other | ) |
|
Constructor, with another attachments object.
- Parameters
-
[in] | other | Another attachments object. |
◆ addEmbeddedFile()
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.
◆ addFromFilePath()
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.
◆ delete()
synchronized void com.foxit.sdk.pdf.Attachments.delete |
( |
| ) |
|
Clean up related resources immediately.
- Returns
- None.
- Note
- Once this function is called, current object cannot be used anymore.
◆ extractEmbeddedFileTo()
boolean com.foxit.sdk.pdf.Attachments.extractEmbeddedFileTo |
( |
String |
key, |
|
|
String |
dst_file_path |
|
) |
| throws com.foxit.sdk.PDFException |
Extract an attachment and save it to a specified file path.
- Parameters
-
[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. |
- Returns
- true means success, while false means failure.
◆ getCount()
Get the count of attachments.
- Returns
- The count of attachments.
◆ getEmbeddedFile()
Get the attachment (as file specification object) of a specified key.
- Parameters
-
[in] | key | Key string. It should not be an empty string. |
- Returns
- A file specification object.
◆ getKey()
Get the key of an attachment defined in the EmbeddedFiles name tree, by index.
- Parameters
-
[in] | index | Index of the key string to be retrieved. Valid range: from 0 to (count-1). count is returned by function Attachments.getCount . |
- Returns
- A key string.
◆ getNameTree()
PDFNameTree com.foxit.sdk.pdf.Attachments.getNameTree |
( |
| ) |
|
Get the EmbeddedFiles name tree.
- Returns
- The EmbeddedFiles name tree.
◆ isEmpty()
boolean com.foxit.sdk.pdf.Attachments.isEmpty |
( |
| ) |
|
Check whether current object is empty or not.
When the current object is empty, that means current object is useless.
- Returns
- true means current object is empty, while false means not.
◆ removeAllEmbeddedFiles()
Remove all attachments.
- Returns
- true means success, while false means failure.
◆ removeEmbeddedFile()
Remove an attachment by key.
If the input key does not exist in EmbeddedFiles name tree, this function will return true directly.
- Parameters
-
[in] | key | Key string. This should not be an empty string. |
- Returns
- true means success, while false means failure.
◆ setEmbeddedFile()
Set an embedded attachment (as file specification object) for a specified key.
- Parameters
-
[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. |
- Returns
- true means success, while false means failure.