com.foxit.sdk.pdf.FileSpec Class Reference
Inheritance diagram for com.foxit.sdk.pdf.FileSpec:
com.foxit.sdk.common.Base

Public Member Functions

 FileSpec (PDFDoc document) throws com.foxit.sdk.PDFException
 Constructor.
More...
 
 FileSpec (PDFDoc document, PDFObject pdf_object) throws com.foxit.sdk.PDFException
 Constructor, from an existing file specification PDF object in a PDF document.
More...
 
 FileSpec (FileSpec other)
 Constructor, with another FileSpec object.
More...
 
boolean embed (String file_path) throws com.foxit.sdk.PDFException
 Embed the whole content of a file which is specified by file path.
More...
 
boolean embed (PDFObject pdf_object) throws com.foxit.sdk.PDFException
 (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...
 
boolean exportToFile (String path) throws com.foxit.sdk.PDFException
 Export the file data that represented in current file specification directly into a file.
More...
 
int getAssociteFileRelationship () throws com.foxit.sdk.PDFException
 (Only supported in PDF 2.0) Get the associated file relationship when current file specification is used as an associated file.
More...
 
byte [] getChecksum () throws com.foxit.sdk.PDFException
 Get the checksum for embedded file.
More...
 
DateTime getCreationDateTime () throws com.foxit.sdk.PDFException
 Get creation date and time about when the embedded file was created.
More...
 
String getDescription () throws com.foxit.sdk.PDFException
 Get the descriptive text associated with current file specification.
More...
 
PDFDictionary getDict () throws com.foxit.sdk.PDFException
 Get the PDF dictionary of current file specification.
More...
 
FileReaderCallback getFileData () throws com.foxit.sdk.PDFException
 Get the file data of embedded file.
More...
 
String getFileName () throws com.foxit.sdk.PDFException
 Get the file name.
More...
 
int getFileSize () throws com.foxit.sdk.PDFException
 Get the size of embedded file.
More...
 
DateTime getModifiedDateTime () throws com.foxit.sdk.PDFException
 Get modified date and time about when the embedded file was last modified.
More...
 
String getSubtype () throws com.foxit.sdk.PDFException
 (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...
 
boolean isEmbedded () throws com.foxit.sdk.PDFException
 Check whether current file specification object represents an embedded file or not.
More...
 
boolean isEmpty ()
 Check whether current object is empty or not.
More...
 
void setAssociteFileRelationship (int associfile_relationship) throws com.foxit.sdk.PDFException
 (Only supported in PDF 2.0) Set the associated file relationship when current file specification is used as an associated file.
More...
 
void setChecksum (byte[] checksum) throws com.foxit.sdk.PDFException
 Set the checksum for embedded file. (Not affect local file)
More...
 
void setCreationDateTime (DateTime date_time) throws com.foxit.sdk.PDFException
 Set the creation date and time for the embedded file. (Not affect local file)
More...
 
void setDescription (String description) throws com.foxit.sdk.PDFException
 Set the descriptive text associated with current file specification.
More...
 
void setFileName (String file_name) throws com.foxit.sdk.PDFException
 Set the file name.
More...
 
void setModifiedDateTime (DateTime date_time) throws com.foxit.sdk.PDFException
 Set last modified date and time for the embedded file. (Not affect local 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() [1/3]

com.foxit.sdk.pdf.FileSpec.FileSpec ( PDFDoc  document) throws com.foxit.sdk.PDFException

Constructor.

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

Parameters
documentA valid PDF document object, to which the new FileSpec object will belongs.

◆ FileSpec() [2/3]

com.foxit.sdk.pdf.FileSpec.FileSpec ( PDFDoc  document,
PDFObject  pdf_object 
) throws com.foxit.sdk.PDFException

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

Parameters
documentA valid PDF document object, to which the file specification PDF object belongs.
pdf_objectA valid PDF object which represents an existing FileSpec 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 PDFNameTree in type objects::e_EmbeddedFiles.

◆ FileSpec() [3/3]

com.foxit.sdk.pdf.FileSpec.FileSpec ( FileSpec  other)

Constructor, with another FileSpec object.

Parameters
otherAnother FileSpec object.

Member Function Documentation

◆ embed() [1/2]

boolean com.foxit.sdk.pdf.FileSpec.embed ( String  file_path) throws com.foxit.sdk.PDFException

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
file_pathA full path of an existing local file.
Returns
true means success, while false means failure.

◆ embed() [2/2]

boolean com.foxit.sdk.pdf.FileSpec.embed ( PDFObject  pdf_object) throws com.foxit.sdk.PDFException

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

◆ exportToFile()

boolean com.foxit.sdk.pdf.FileSpec.exportToFile ( String  path) throws com.foxit.sdk.PDFException

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

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

◆ getAssociteFileRelationship()

int com.foxit.sdk.pdf.FileSpec.getAssociteFileRelationship ( ) throws com.foxit.sdk.PDFException

(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 e_RelationshipSource and this should be one of these values.

◆ getChecksum()

byte[] com.foxit.sdk.pdf.FileSpec.getChecksum ( ) throws com.foxit.sdk.PDFException

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.

◆ getCreationDateTime()

DateTime com.foxit.sdk.pdf.FileSpec.getCreationDateTime ( ) throws com.foxit.sdk.PDFException

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 DateTime object will all value 0.

Returns
The creation date time of embedded file.

◆ getDescription()

String com.foxit.sdk.pdf.FileSpec.getDescription ( ) throws com.foxit.sdk.PDFException

Get the descriptive text associated with current file specification.

Returns
The descriptive text.

◆ getDict()

PDFDictionary com.foxit.sdk.pdf.FileSpec.getDict ( ) throws com.foxit.sdk.PDFException

Get the PDF dictionary of current file specification.

Returns
A PDF dictionary object.

◆ getFileData()

FileReaderCallback com.foxit.sdk.pdf.FileSpec.getFileData ( ) throws com.foxit.sdk.PDFException

Get the file data of embedded file.

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

◆ getFileName()

String com.foxit.sdk.pdf.FileSpec.getFileName ( ) throws com.foxit.sdk.PDFException

Get the file name.

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

◆ getFileSize()

int com.foxit.sdk.pdf.FileSpec.getFileSize ( ) throws com.foxit.sdk.PDFException

Get the 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
File size of embedded file.

◆ getModifiedDateTime()

DateTime com.foxit.sdk.pdf.FileSpec.getModifiedDateTime ( ) throws com.foxit.sdk.PDFException

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 DateTime object will all value 0.

Returns
The modified date time of embedded file.

◆ getSubtype()

String com.foxit.sdk.pdf.FileSpec.getSubtype ( ) throws com.foxit.sdk.PDFException

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

boolean com.foxit.sdk.pdf.FileSpec.isEmbedded ( ) throws com.foxit.sdk.PDFException

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

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

◆ isEmpty()

boolean com.foxit.sdk.pdf.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()

void com.foxit.sdk.pdf.FileSpec.setAssociteFileRelationship ( int  associfile_relationship) throws com.foxit.sdk.PDFException

(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
associfile_relationshipThe associated file relationship to be set. Please refer to values starting from {} and this would be one of these values.
Returns
None.

◆ setChecksum()

void com.foxit.sdk.pdf.FileSpec.setChecksum ( byte []  checksum) throws com.foxit.sdk.PDFException

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
checksumA checksum to be set.
Returns
None.

◆ setCreationDateTime()

void com.foxit.sdk.pdf.FileSpec.setCreationDateTime ( DateTime  date_time) throws com.foxit.sdk.PDFException

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
date_timeThe creation date and time to be set.
Returns
None.

◆ setDescription()

void com.foxit.sdk.pdf.FileSpec.setDescription ( String  description) throws com.foxit.sdk.PDFException

Set the descriptive text associated with current file specification.

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

◆ setFileName()

void com.foxit.sdk.pdf.FileSpec.setFileName ( String  file_name) throws com.foxit.sdk.PDFException

Set the file name.

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

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

◆ setModifiedDateTime()

void com.foxit.sdk.pdf.FileSpec.setModifiedDateTime ( DateTime  date_time) throws com.foxit.sdk.PDFException

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
date_timeThe last modified date and time to be set.
Returns
None.

Foxit Software Corporation Logo
@2018 Foxit Software Incorporated. All rights reserved.