Foxit PDF SDK

Instance Methods | Properties | List of all members
FSFileSpec Class Reference
Inheritance diagram for FSFileSpec:

## Instance Methods
(BOOL) | - embed:
| Embed the whole content of a file which is specified by file path. More...
(BOOL) | - embedWithPDFObject:
| (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. More...
(BOOL) | - embedWithStreamCallback:
| Embed a file by using FSFileStreamCallback. More...
(BOOL) | - exportToFile:
| Export the file data that represented in current file specification directly into a file. More...
(BOOL) | - exportToFileStream:
| Export the file data that represented in current file specification through a stream callback object. More...
(long long) | - getCompressedEmbeddedFileSize
| Get the compressed file size of embedded file. More...
(FSPDFDictionary *) | - getDict
| Get the PDF dictionary of current file specification. More...
(id< FSFileReaderCallback >) | - getFileData
| Get the file data of embedded file. More...
(long long) | - getFileSize
| Get the size of embedded file (uncompressed file size). More...
(id) | - initWithDocument:
| Constructor. More...
(id) | - initWithDocument:pdf_object:
| Constructor, from an existing file specification PDF object in a PDF document. More...
(id) | - initWithOther:
| Constructor, with another file specification object. More...
(BOOL) | - isEmbedded
| Check whether current file specification object represents an embedded file or not. More...
(BOOL) | - isEmpty
| Check whether current object is empty or not. More...

## Properties
FSAssociatedFilesRelationship | associteFileRelationship
| (Only supported in PDF 2.0) Get or Set the associated file relationship when current file specification is used as an associated file.
NSData * | checksum
| Get or Set the checksum for embedded file. More...
FSDateTime * | creationDateTime
| Get or Set creation date and time about when the embedded file was created. More...
NSString * | description
| Get or Set the descriptive text associated with current file specification.
NSString * | fileName
| Get or Set the file name.
FSDateTime * | modifiedDateTime
| Get or Set modified date and time about when the embedded file was last modified. More...
NSString * | subtype
| (Only support in PDF 2.0) Get or Set the MIME type value for "Subtype" key for embedded 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.

## Method Documentation

## ◆ embed:()

- (BOOL) embed: |  | (NSString *) | file_path |

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

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_path | A full path of an existing local file.

Returns
  YES means success, while NO means failure.

## ◆ embedWithPDFObject:()

- (BOOL) embedWithPDFObject: |  | (FSPDFObject*) | pdf_object |

(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 PDF stream object will be embedded to the PDF document that current file specification belongs to.

Parameters

  [in] | pdf_object | A valid PDF object. It should be either a PDF stream object or a PDF reference object which refers to a PDF stream object.

Returns
  YES means success, while NO means failure.

## ◆ embedWithStreamCallback:()

- (BOOL) embedWithStreamCallback: |  | (id<FSFileStreamCallback>) | stream |

Embed a file by using FSFileStreamCallback.

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] | stream | A FSFileStreamCallback object which is implemented by user to read the file content.

Returns
  YES means success, while NO means failure.

## ◆ exportToFile:()

- (BOOL) exportToFile: |  | (NSString *) | path |

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

Parameters

  [in] | path | A full path of a file to which the data will be saved.

Returns
  YES means success, while NO means failure.

## ◆ exportToFileStream:()

- (BOOL) exportToFileStream: |  | (id<FSFileStreamCallback>) | stream |

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

Parameters

  [in] | stream | A FSFileStreamCallback object which is implemented by user to save the file data.

Returns
  YES means success, while NO means failure.

## ◆ getCompressedEmbeddedFileSize()

- (long long) 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.

## ◆ getDict()

- (FSPDFDictionary *) getDict |  |  |

Get the PDF dictionary of current file specification.

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

## ◆ getFileData()

- (id< FSFileReaderCallback >) getFileData |  |  |

Get the file data of embedded file.

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

## ◆ getFileSize()

- (long long) 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).

## ◆ initWithDocument:()

- (id) initWithDocument: |  | (FSPDFDoc*) | document |

Constructor.

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

Parameters

  [in] | document | A valid PDF document object, to which the new file specification object will belongs.

## ◆ initWithDocument:pdf_object:()

- (id) initWithDocument: |  | (FSPDFDoc*) | document
pdf_object: |  | (FSPDFObject*) | pdf_object

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

Parameters

  [in] | document | A valid PDF document object, to which the file specification PDF object belongs.
  [in] | pdf_object | A 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 FSPDFNameTree in type FSPDFNameTreeEmbeddedFiles.

## ◆ initWithOther:()

- (id) initWithOther: |  | (FSFileSpec*) | other |

Constructor, with another file specification object.

Parameters

  [in] | other | Another file specification object.

## ◆ isEmbedded()

- (BOOL) isEmbedded |  |  |

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

Returns
  YES means current file specification object represents an embedded file. NO means current file specification object does not represent an embedded file.

## ◆ isEmpty()

- (BOOL) isEmpty |  |  |

Check whether current object is empty or not.

When the current object is empty, that means current object is useless.

Returns
  YES means current object is empty, while NO means not.

## Property Documentation

## ◆ checksum

- (NSData *) checksum
| read write nonatomic weak

Get or Set 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.

## ◆ creationDateTime

- (FSDateTime *) creationDateTime
| read write nonatomic weak

Get or Set 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.

## ◆ modifiedDateTime

- (FSDateTime *) modifiedDateTime
| read write nonatomic weak

Get or Set 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.

## ◆ subtype

- (NSString *) subtype
| read write nonatomic weak

(Only support in PDF 2.0) Get or Set 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.