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

Public Member Functions

def FileSpec (document)
 Constructor. More...
 
def Embed (file_path)
 Embed the whole content of a file which is specified by file path. More...
 
def ExportToFile (path)
 Export the file data that represented in current file specification directly into a file. More...
 
def ExportToFileStream (stream)
 Export the file data that represented in current file specification through a stream callback object. More...
 
def GetAssociteFileRelationship ()
 (Only supported in PDF 2.0) Get the associated file relationship when current file specification is used as an associated file. More...
 
def GetChecksum ()
 Get the checksum for embedded file. More...
 
def GetCompressedEmbeddedFileSize ()
 Get the compressed file size of embedded file. More...
 
def GetCreationDateTime ()
 Get creation date and time about when the embedded file was created. More...
 
def GetDescription ()
 Get the descriptive text associated with current file specification. More...
 
def GetDict ()
 Get the PDF dictionary of current file specification. More...
 
def GetFileData ()
 Get the file data of embedded file. More...
 
def GetFileName ()
 Get the file name. More...
 
def GetFileSize ()
 Get the size of embedded file (uncompressed file size). More...
 
def GetModifiedDateTime ()
 Get modified date and time about when the embedded file was last modified. More...
 
def GetSubtype ()
 (Only support in PDF 2.0) Get the MIME type value for "Subtype" key for embedded file when current file specification is used as an associated file. More...
 
def IsEmbedded ()
 Check whether current file specification object represents an embedded file or not. More...
 
def IsEmpty ()
 Check whether current object is empty or not. More...
 
def SetAssociteFileRelationship (associfile_relationship)
 (Only supported in PDF 2.0) Set the associated file relationship when current file specification is used as an associated file. More...
 
def SetChecksum (checksum)
 Set the checksum for embedded file. (Not affect local file) More...
 
def SetCreationDateTime (date_time)
 Set the creation date and time for the embedded file. (Not affect local file) More...
 
def SetDescription (description)
 Set the descriptive text associated with current file specification. More...
 
def SetFileName (file_name)
 Set the file name. More...
 
def SetModifiedDateTime (date_time)
 Set last modified date and time for the embedded file. (Not affect local file) More...
 
def SetSubtype (subtype)
 (Only support in PDF 2.0) Set the MIME type value for "Subtype" key for embedded file (Not affect local file) when current file specification is used as an associated file. More...
 

Detailed Description

A PDF file can refer to the contents of another file by using a file specification. File specification can simply represents the file path of another file, or represents the whole content of another file, which is embedded to current PDF file.

Constructor & Destructor Documentation

◆ FileSpec()

def FoxitPDFSDKPython3.FileSpec.FileSpec (   document)

Constructor.

Constructor, with another file specification object.

Constructor, from an existing file specification PDF object in a PDF document.

This constructor is to construct a new file specification object (without any data).

Parameters
[in]documentA valid PDF document object, to which the new file specification object will belongs.
[in]documentA valid PDF document object, to which the file specification PDF object belongs.
[in]pdf_objectA valid PDF object which represents an existing file specification object in the PDF document. It should be either a dictionary object or a PDF reference object:
  • If it is a PDF dictionary object, it should be a file specification dictionary.

  • If it is a PDF reference object, it should refer to a file specification dictionary.

This PDF object can be retrieved from FoxitPDFSDKPython3.PDFNameTree in type FoxitPDFSDKPython3.PDFNameTree.e_EmbeddedFiles .
[in]otherAnother file specification object.

Member Function Documentation

◆ Embed()

def FoxitPDFSDKPython3.FileSpec.Embed (   file_path)

Embed the whole content of a file which is specified by file path.

Embed a file by using FoxitPDFSDKPython3.StreamCallback .

(Only support in PDF 2.0) Embed the whole content of a PDF stream object or a PDF reference object which refers to a PDF stream object, when current file specification object is used as an associated file.

When this function succeeds, the whole content of specified file will be embedded to the PDF document that current file specification belongs to.

Parameters
[in]file_pathA full path of an existing local file.
Returns
true means success, while false means failure.

When this function succeeds, the whole content of specified PDF stream object will be embedded to the PDF document that current file specification belongs to.

Parameters
[in]pdf_objectA valid PDF object. It should be either a PDF stream object or a PDF reference object which refers to a PDF stream object.
Returns
true means success, while false means failure.

When this function succeeds, please keep input stream callback object valid until the PDF file (which current file specification belongs to) is saved or closed.

Parameters
[in]streamA FoxitPDFSDKPython3.StreamCallback object which is implemented by user to read the file content.
Returns
true means success, while false means failure.

◆ ExportToFile()

def FoxitPDFSDKPython3.FileSpec.ExportToFile (   path)

Export the file data that represented in current file specification directly into a file.

Parameters
[in]pathA full path of a file to which the data will be saved.
Returns
true means success, while false means failure.

◆ ExportToFileStream()

def FoxitPDFSDKPython3.FileSpec.ExportToFileStream (   stream)

Export the file data that represented in current file specification through a stream callback object.

Parameters
[in]streamA FoxitPDFSDKPython3.StreamCallback object which is implemented by user to save the file data.
Returns
true means success, while false means failure.

◆ GetAssociteFileRelationship()

def FoxitPDFSDKPython3.FileSpec.GetAssociteFileRelationship ( )

(Only supported in PDF 2.0) Get the associated file relationship when current file specification is used as an associated file.

Returns
The associated file relationship. Please refer to values starting from FoxitPDFSDKPython3.AssociatedFiles.e_RelationshipSource and this should be one of these values.

◆ GetChecksum()

def FoxitPDFSDKPython3.FileSpec.GetChecksum ( )

Get the checksum for embedded file.

This function is only useful when current file specification object represents an embedded file. A 16-byte string that is the checksum of the bytes of the uncompressed embedded file. The checksum is calculated by applying the standard MD5 message-digest algorithm to the bytes of the embedded file stream.
If current file specification object does not represent an embedded file, this function will return an empty string.

Returns
The checksum string.

◆ GetCompressedEmbeddedFileSize()

def FoxitPDFSDKPython3.FileSpec.GetCompressedEmbeddedFileSize ( )

Get the compressed file size of embedded file.

This function is only useful when current file specification object represents an embedded file. If current file specification object does not represent an embedded file, this function will return 0 directly.

Returns
Compressied file size of embedded file.

◆ GetCreationDateTime()

def FoxitPDFSDKPython3.FileSpec.GetCreationDateTime ( )

Get creation date and time about when the embedded file was created.

This function is only useful when current file specification object represents an embedded file. If current file specification object does not represent an embedded file, this function will return a date and time object will all value 0.

Returns
The creation date time of embedded file.

◆ GetDescription()

def FoxitPDFSDKPython3.FileSpec.GetDescription ( )

Get the descriptive text associated with current file specification.

Returns
The descriptive text.

◆ GetDict()

def FoxitPDFSDKPython3.FileSpec.GetDict ( )

Get the PDF dictionary of current file specification.

Returns
A PDF dictionary object. If there is any error, this function will return null.

◆ GetFileData()

def FoxitPDFSDKPython3.FileSpec.GetFileData ( )

Get the file data of embedded file.

Returns
A FoxitPDFSDKPython3.FileReaderCallback object. User can call functions in class FoxitPDFSDKPython3.FileReaderCallback to read the file data.

◆ GetFileName()

def FoxitPDFSDKPython3.FileSpec.GetFileName ( )

Get the file name.

Returns
The file name. If no file name can be found, this function will return an empty string.

◆ GetFileSize()

def FoxitPDFSDKPython3.FileSpec.GetFileSize ( )

Get the size of embedded file (uncompressed file size).

This function is only useful when current file specification object represents an embedded file. If current file specification object does not represent an embedded file, this function will return 0 directly.

Returns
File size of embedded file (uncompressed file size).

◆ GetModifiedDateTime()

def FoxitPDFSDKPython3.FileSpec.GetModifiedDateTime ( )

Get modified date and time about when the embedded file was last modified.

This function is only useful when current file specification object represents an embedded file. If current file specification object does not represent an embedded file, this function will return a date and time object will all value 0.

Returns
The modified date time of embedded file.

◆ GetSubtype()

def FoxitPDFSDKPython3.FileSpec.GetSubtype ( )

(Only support in PDF 2.0) Get the MIME type value for "Subtype" key for embedded file when current file specification is used as an associated file.

This function is only useful when current file specification object represents an embedded file and used as associated file.

Returns
The subtype string.

◆ IsEmbedded()

def FoxitPDFSDKPython3.FileSpec.IsEmbedded ( )

Check whether current file specification object represents an embedded file or not.

Returns
true means current file specification object represents an embedded file. false means current file specification object does not represent an embedded file.

◆ IsEmpty()

def FoxitPDFSDKPython3.FileSpec.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.

◆ SetAssociteFileRelationship()

def FoxitPDFSDKPython3.FileSpec.SetAssociteFileRelationship (   associfile_relationship)

(Only supported in PDF 2.0) Set the associated file relationship when current file specification is used as an associated file.

This function is required for a newly created associated file specification object.

Parameters
[in]associfile_relationshipThe associated file relationship to be set. Please refer to values starting from FoxitPDFSDKPython3.AssociatedFiles.e_RelationshipSource and this would be one of these values.
Returns
None.

◆ SetChecksum()

def FoxitPDFSDKPython3.FileSpec.SetChecksum (   checksum)

Set the checksum for embedded file. (Not affect local file)

This function is only useful if current file specification object represents an embedded file.
A 16-byte string that is the checksum of the bytes of the uncompressed embedded file. The checksum is calculated by applying the standard MD5 message-digest algorithm to the bytes of the embedded file stream.

Parameters
[in]checksumA checksum to be set.
Returns
None.

◆ SetCreationDateTime()

def FoxitPDFSDKPython3.FileSpec.SetCreationDateTime (   date_time)

Set the creation date and time for the embedded file. (Not affect local file)

This function is only useful when current file specification object represents an embedded file.

Parameters
[in]date_timeThe creation date and time to be set.
Returns
None.

◆ SetDescription()

def FoxitPDFSDKPython3.FileSpec.SetDescription (   description)

Set the descriptive text associated with current file specification.

Parameters
[in]descriptionA descriptive text to be set. It should not be an empty string.
Returns
None.

◆ SetFileName()

def FoxitPDFSDKPython3.FileSpec.SetFileName (   file_name)

Set the file name.

This function is required for a new file specification object (not constructed from an existing file specification PDF object).

Parameters
[in]file_nameThe file name to be set. It should not be an empty string.
Returns
None.

◆ SetModifiedDateTime()

def FoxitPDFSDKPython3.FileSpec.SetModifiedDateTime (   date_time)

Set last modified date and time for the embedded file. (Not affect local file)

This function is only useful when current file specification object represents an embedded file.

Parameters
[in]date_timeThe last modified date and time to be set.
Returns
None.

◆ SetSubtype()

def FoxitPDFSDKPython3.FileSpec.SetSubtype (   subtype)

(Only support in PDF 2.0) Set the MIME type value for "Subtype" key for embedded file (Not affect local file) when current file specification is used as an associated file.

This function is only useful when current file specification object represents an embedded file and used as associated file.

Parameters
[in]subtypeA valid MIME type value.
Returns
None.