Foxit PDF SDK
fs_pdfattachments.h
Go to the documentation of this file.
1 
15 #ifndef FS_PDFATTACHMENTS_H_
16 #define FS_PDFATTACHMENTS_H_
17 
18 #include "common/fs_common.h"
19 #include "pdf/fs_filespec.h"
21 
27 namespace foxit {
31 namespace pdf {
40 class Attachments FS_FINAL : public Base {
41  public:
64  explicit Attachments(const PDFDoc& doc, const objects::PDFNameTree& nametree = foxit::pdf::objects::PDFNameTree());
66  ~Attachments();
72  Attachments(const Attachments& other);
80  Attachments& operator = (const Attachments& other);
81 
89  bool operator == (const Attachments& other) const;
97  bool operator != (const Attachments& other) const;
98 
106  bool IsEmpty() const;
107 
113  int GetCount();
114 
123  WString GetKey(int index);
124 
132  FileSpec GetEmbeddedFile(const WString& key);
133 
144  bool SetEmbeddedFile(const WString& key, const FileSpec& file_spec);
145 
161  bool AddEmbeddedFile(const WString& key, const FileSpec& file_spec);
162 
178  bool AddFromFilePath(const WString& key, const wchar_t* file_path);
179 
190  bool RemoveEmbeddedFile(const WString& key);
191 
197  bool RemoveAllEmbeddedFiles();
198 
208  bool ExtractEmbeddedFileTo(const WString& key, const wchar_t* dst_file_path);
209 
216 
217  // User is strongly recommended NOT to use this method; otherwise unknown situation may occur.
218  explicit Attachments(FS_HANDLE handle = NULL);
219 };
220 } // namespace pdf
221 } // namespace foxit
222 
223 #endif // FS_PDFATTACHMENTS_H_
224 
bool IsEmpty() const
Check whether current object is empty or not.
FileSpec GetEmbeddedFile(const WString &key)
Get the attachment (as file specification object) of a specified key.
bool SetEmbeddedFile(const WString &key, const FileSpec &file_spec)
Set an embedded attachment (as file specification object) for a specified key.
Header file for file specification related definitions and classes.
WIDE STRING CLASS.
Definition: fx_string.h:1452
Definition: fs_pdfdoc.h:389
WString GetKey(int index)
Get the key of an attachment defined in the EmbeddedFiles name tree, by index.
~Attachments()
Destructor.
bool RemoveAllEmbeddedFiles()
Remove all attachments.
Attachments & operator=(const Attachments &other)
Assign operator.
void * FS_HANDLE
Handle type.
Definition: fs_basictypes.h:216
objects::PDFNameTree GetNameTree() const
Get the EmbeddedFiles name tree.
Header file for common definitions and classes.
bool operator !=(const Attachments &other) const
Not equal operator.
bool AddEmbeddedFile(const WString &key, const FileSpec &file_spec)
Add an embedded attachment (as file specification object) with new key name.
Definition: fs_pdfnametree.h:67
Definition: fs_basictypes.h:399
Definition: fs_filespec.h:38
Header file for PDF name tree related definitions and classes.
Foxit namespace.
Definition: fs_compare.h:27
bool ExtractEmbeddedFileTo(const WString &key, const wchar_t *dst_file_path)
Extract an attachment and save it to a specified file path.
int GetCount()
Get the count of attachments.
#define NULL
The null-pointer value.
Definition: fx_system.h:767
bool operator==(const Attachments &other) const
Equal operator.
bool AddFromFilePath(const WString &key, const wchar_t *file_path)
Add a new attachment from specified file path with new key name.
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).
Definition: fs_pdfattachments.h:40
bool RemoveEmbeddedFile(const WString &key)
Remove an attachment by key.