Foxit PDF SDK
FoxitPDFSDKPython3.Attachments Class Reference
Inheritance diagram for FoxitPDFSDKPython3.Attachments:
FoxitPDFSDKPython3.Base

Public Member Functions

def Attachments (other)
 Constructor, with another attachments object.
More...
 
def AddEmbeddedFile (key, file_spec)
 Add an embedded attachment (as file specification object) with new key name.
More...
 
def AddFromFilePath (key, file_path)
 Add a new attachment from specified file path with new key name.
More...
 
def ExtractEmbeddedFileTo (key, dst_file_path)
 Extract an attachment and save it to a specified file path.
More...
 
def GetCount ()
 Get the count of attachments.
More...
 
def GetEmbeddedFile (key)
 Get the attachment (as file specification object) of a specified key.
More...
 
def GetKey (index)
 Get the key of an attachment defined in the EmbeddedFiles name tree, by index.
More...
 
def GetNameTree ()
 Get the EmbeddedFiles name tree.
More...
 
def IsEmpty ()
 Check whether current object is empty or not.
More...
 
def RemoveAllEmbeddedFiles ()
 Remove all attachments.
More...
 
def RemoveEmbeddedFile (key)
 Remove an attachment by key.
More...
 
def SetEmbeddedFile (key, file_spec)
 Set an embedded attachment (as file specification object) for a specified key.
More...
 

Detailed Description

In application, document's embedded files are known as PDF attachments. This class offers a more convenient way, than class FoxitPDFSDKPython3.PDFNameTree , to get/set embedded files (also known as attachment files) in EmbeddedFiles name tree of a PDF document.

See also
PDFDoc
FoxitPDFSDKPython3.PDFNameTree

Constructor & Destructor Documentation

◆ Attachments()

def FoxitPDFSDKPython3.Attachments.Attachments (   other)

Constructor, with another attachments object.

Parameters
[in]otherAnother attachments object.

Member Function Documentation

◆ AddEmbeddedFile()

def FoxitPDFSDKPython3.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]keyNew 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_specA 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()

def FoxitPDFSDKPython3.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]keyNew 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_pathA 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.

◆ ExtractEmbeddedFileTo()

def FoxitPDFSDKPython3.Attachments.ExtractEmbeddedFileTo (   key,
  dst_file_path 
)

Extract an attachment and save it to a specified file path.

Parameters
[in]keyKey string. This should not be an empty string.
[in]dst_file_pathA 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()

def FoxitPDFSDKPython3.Attachments.GetCount ( )

Get the count of attachments.

Returns
The count of attachments.

◆ GetEmbeddedFile()

def FoxitPDFSDKPython3.Attachments.GetEmbeddedFile (   key)

Get the attachment (as file specification object) of a specified key.

Parameters
[in]keyKey string. It should not be an empty string.
Returns
A file specification object.

◆ GetKey()

def FoxitPDFSDKPython3.Attachments.GetKey (   index)

Get the key of an attachment defined in the EmbeddedFiles name tree, by index.

Parameters
[in]indexIndex of the key string to be retrieved. Valid range: from 0 to (count-1). count is returned by function FoxitPDFSDKPython3.Attachments.GetCount .
Returns
A key string.

◆ GetNameTree()

def FoxitPDFSDKPython3.Attachments.GetNameTree ( )

Get the EmbeddedFiles name tree.

Returns
The EmbeddedFiles name tree.

◆ IsEmpty()

def FoxitPDFSDKPython3.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()

def FoxitPDFSDKPython3.Attachments.RemoveAllEmbeddedFiles ( )

Remove all attachments.

Returns
true means success, while false means failure.

◆ RemoveEmbeddedFile()

def FoxitPDFSDKPython3.Attachments.RemoveEmbeddedFile (   key)

Remove an attachment by key.

If the input key does not exist in EmbeddedFiles name tree, this function will return true directly.

Parameters
[in]keyKey string. This should not be an empty string.
Returns
true means success, while false means failure.

◆ SetEmbeddedFile()

def FoxitPDFSDKPython3.Attachments.SetEmbeddedFile (   key,
  file_spec 
)

Set an embedded attachment (as file specification object) for a specified key.

Parameters
[in]keyKey string. It should not be an empty string. This name should have existed in current PDF document.
[in]file_specA 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.