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

Public Member Functions

 AssociatedFiles (AssociatedFiles other)
 Constructor, with another AssociatedFiles object.
More...
 
 AssociatedFiles (PDFDoc pdf_doc) throws com.foxit.sdk.PDFException
 Constructor, with a PDF document.
More...
 
void associateFile (PDFObject pdf_object, FileSpec file_spec) throws com.foxit.sdk.PDFException
 Associate a file (represented by FileSpec) with a PDF dictionary object which represents the dictionary of an annotation, a PDF page, or other object in PDF document.
More...
 
void associateFile (GraphicsObject graphics_object, int mark_content_item_index, PDFObject current_resource, String property_name, FileSpec file_spec) throws com.foxit.sdk.PDFException
 Associate a file (represented by FileSpec) with a marked content item of a specified graphics object.
More...
 
void associateFile (PDFPage page, FileSpec file_spec) throws com.foxit.sdk.PDFException
 Associate a file (represented by FileSpec) with a PDF page.
More...
 
void associateFile (ImageObject image, FileSpec file_spec) throws com.foxit.sdk.PDFException
 Associate a file (represented by FileSpec) with an image graphics object.
More...
 
void associateFile (FormXObject form_xobject, FileSpec file_spec) throws com.foxit.sdk.PDFException
 Associate a file (represented by FileSpec) with a form XObject graphics object.
More...
 
void associateFile (Annot annot, FileSpec file_spec) throws com.foxit.sdk.PDFException
 Associate a file (represented by FileSpec) with a PDF annotation.
More...
 
FileSpec getAssociatedFile (PDFObject pdf_object, int index) throws com.foxit.sdk.PDFException
 Get an associated file (represented by FileSpec) in a specified PDF dictionary object, by index.
More...
 
FileSpec getAssociatedFile (GraphicsObject graphics_object, int index) throws com.foxit.sdk.PDFException
 Get an associated file a graphics object, by index.
More...
 
int getAssociatedFilesCount (PDFObject pdf_object) throws com.foxit.sdk.PDFException
 Get the count of associated files in a PDF dictionary object which represents the dictionary of an annotation, a PDF page, or other object in PDF document.
More...
 
int getAssociatedFilesCount (GraphicsObject graphics_object) throws com.foxit.sdk.PDFException
 Get the count of associated files in a graphics object.
More...
 
boolean isEmpty ()
 Check whether current object is empty or not.
More...
 
void removeAssociatedFile (PDFObject pdf_object, int index) throws com.foxit.sdk.PDFException
 Remove an associated file (represented by FileSpec) in a specified PDF dictionary object, by index.
More...
 
void removeAssociatedFile (GraphicsObject graphics_object, int index) throws com.foxit.sdk.PDFException
 Remove an associated file a graphics object, by index.
More...
 

Static Public Attributes

static final int e_RelationshipAlternative = 3
 The relationship is "Alternative" which means the file specification is an alternative representation of content, for example audio.

 
static final int e_RelationshipData = 2
 The relationship is "Data" which means the file specification represents information used to derive a visual presentation - such as for a table or a graph.

 
static final int e_RelationshipEncryptedPayload = 5
 The relationship is "Encrypted payload" which means the file specification is an encrypted payload document that should be displayed to the user if the PDF processor has the cryptographic filter needed to decrypt the document.

 
static final int e_RelationshipFormData = 6
 The relationship is "Form data" which means the file specification is the data associated with the "AcroForm" dictionary in the PDF file.

 
static final int e_RelationshipSchema = 7
 The relationship is "Schema" which means the file specification is a schema definition for the associated object.

 
static final int e_RelationshipSource = 1
 The relationship is "Source" which means the file specification is the original source material for the associated content.

 
static final int e_RelationshipSupplement = 4
 The relationship is "Supplement" which means the file specification represents a supplemental representation of the original source or data that may be more easily consumable.

 
static final int e_RelationshipUnspecified = 0
 The relationship is not known or cannot be described by other values.

 

Detailed Description

In PDF 2.0, a new concept named "Associated files" is defined. Associated files provide a means to associate content in other formats with objects of a PDF file and identify the relationship between the content and the objects. Such associated files are designated using file specification dictionaries (known as file specification). Associated files could be linked to the PDF document's catalog, a page dictionary, graphics objects, structure elements, XObject, DParts, an annotation dictionary and so on. Specially, associated files with graphics objects means to be associated with the marked content item.
Class AssociatedFiles is the class for managing associate files. It offers the functions to count/get associate files in PDF dictionary or graphics object, to associate files (represented by FileSpec) with catalog, PDF pages, graphics objects, form XObject objects, annotation objects and so on.
Specially, when construct an AssociatedFiles object by function AssociatedFiles::AssociatedFiles, the file version of the related PDF document will be set to 2.0.

Constructor & Destructor Documentation

◆ AssociatedFiles() [1/2]

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

Constructor, with another AssociatedFiles object.

Parameters
otherAnother AssociatedFiles object.

◆ AssociatedFiles() [2/2]

com.foxit.sdk.pdf.AssociatedFiles.AssociatedFiles ( PDFDoc  pdf_doc) throws com.foxit.sdk.PDFException

Constructor, with a PDF document.

When an AssociatedFiles object is constructed by this constructor, the file version of input PDF document will be set to 2.0.

Parameters
pdf_docA valid PDF document object.

Member Function Documentation

◆ associateFile() [1/6]

void com.foxit.sdk.pdf.AssociatedFiles.associateFile ( PDFObject  pdf_object,
FileSpec  file_spec 
) throws com.foxit.sdk.PDFException

Associate a file (represented by FileSpec) with a PDF dictionary object which represents the dictionary of an annotation, a PDF page, or other object in PDF document.

Parameters
pdf_objectA valid PDF object. It should be either a PDF dictionary object or a PDF reference object that refers to a PDF dictionary object.
file_specA FileSpec object to be associated with specified PDF dictionary. It should not be an empty string.
Returns
None.

◆ associateFile() [2/6]

void com.foxit.sdk.pdf.AssociatedFiles.associateFile ( GraphicsObject  graphics_object,
int  mark_content_item_index,
PDFObject  current_resource,
String  property_name,
FileSpec  file_spec 
) throws com.foxit.sdk.PDFException

Associate a file (represented by FileSpec) with a marked content item of a specified graphics object.

Parameters
graphics_objectA valid graphics object.
mark_content_item_indexThe index of marked content item in input graphic object to which the specified FileSpec object is to associated with. Valid range: from 0 to (count-1). count is returned by function graphics::MarkedContent::getItemCount of the marked content related to input graphics object.
current_resourceA resource dictionary of a PDF page to which input graphics object is related. This can also be a PDF reference object that refers to such a PDF dictionary.
property_nameA property name used in "Properties" dictionary of input resource dictionary. It should not be an empty string.
file_specA FileSpec object to be associated with specified marked content item of a specified graphics object. It should not be an empty string.
Returns
None.
Note
When this function succeeds, function GraphicsObjects::generateContent should be called. Please refer to function GraphicsObjects::generateContent for more details.

◆ associateFile() [3/6]

void com.foxit.sdk.pdf.AssociatedFiles.associateFile ( PDFPage  page,
FileSpec  file_spec 
) throws com.foxit.sdk.PDFException

Associate a file (represented by FileSpec) with a PDF page.

In fact, this function is equals to associate a file with a PDF page dictionary.

Parameters
pageA valid PDF page.
file_specA FileSpec object to be associated with specified PDF page. It should not be an empty string.
Returns
None.

◆ associateFile() [4/6]

void com.foxit.sdk.pdf.AssociatedFiles.associateFile ( ImageObject  image,
FileSpec  file_spec 
) throws com.foxit.sdk.PDFException

Associate a file (represented by FileSpec) with an image graphics object.

In fact, this function is equals to associate a file with a PDF dictionary of an image graphics object.

Parameters
imageAn image graphics object. It should not be null.
file_specA FileSpec object to be associated with specified image graphics object. It should not be an empty string.
Returns
None.

◆ associateFile() [5/6]

void com.foxit.sdk.pdf.AssociatedFiles.associateFile ( FormXObject  form_xobject,
FileSpec  file_spec 
) throws com.foxit.sdk.PDFException

Associate a file (represented by FileSpec) with a form XObject graphics object.

In fact, this function is equals to associate a file with a PDF dictionary of a form XObject graphics object.

Parameters
form_xobjectA form XObject graphics object. It should not be null.
file_specA FileSpec object to be associated with specified form XObject graphics object. It should not be an empty string.
Returns
None.

◆ associateFile() [6/6]

void com.foxit.sdk.pdf.AssociatedFiles.associateFile ( Annot  annot,
FileSpec  file_spec 
) throws com.foxit.sdk.PDFException

Associate a file (represented by FileSpec) with a PDF annotation.

In fact, this function is equals to associate a file with a PDF dictionary of a PDF annotation.

Parameters
annotA valid PDF annotation.
file_specA FileSpec object to be associated with specified PDF annotation object. It should not be an empty string.
Returns
None.

◆ getAssociatedFile() [1/2]

FileSpec com.foxit.sdk.pdf.AssociatedFiles.getAssociatedFile ( PDFObject  pdf_object,
int  index 
) throws com.foxit.sdk.PDFException

Get an associated file (represented by FileSpec) in a specified PDF dictionary object, by index.

Parameters
pdf_objectA valid PDF object. It should be either a PDF dictionary object or a PDF reference object that refers to a PDF dictionary object.
indexThe index of an associated file in the specified PDF dictionary object. Valid range: from 0 to (count-1). count is returned by function AssociatedFiles::getAssociatedFilesCount with same parameter object.
Returns
A FileSpec object that represents the expected associated file.

◆ getAssociatedFile() [2/2]

FileSpec com.foxit.sdk.pdf.AssociatedFiles.getAssociatedFile ( GraphicsObject  graphics_object,
int  index 
) throws com.foxit.sdk.PDFException

Get an associated file a graphics object, by index.

One or more files may be associated with sections of content in a content stream by enclosing those sections between the marked content. So, in fact, this function is to get an associated files (specified by index) in the marked content related to the graphics object.

Parameters
graphics_objectA valid PDF graphics object.
indexThe index of an associated file in the specified PDF graphics object. Valid range: from 0 to (count-1). count is returned by function AssociatedFiles::getAssociatedFilesCount with same parameter graphics_object.
Returns
A FileSpec object that represents the expected associated file.

◆ getAssociatedFilesCount() [1/2]

int com.foxit.sdk.pdf.AssociatedFiles.getAssociatedFilesCount ( PDFObject  pdf_object) throws com.foxit.sdk.PDFException

Get the count of associated files in a PDF dictionary object which represents the dictionary of an annotation, a PDF page, or other object in PDF document.

Parameters
pdf_objectA valid PDF object. It should be either a PDF dictionary object or a PDF reference object that refers to a PDF dictionary object.
Returns
The count of associated files.

◆ getAssociatedFilesCount() [2/2]

int com.foxit.sdk.pdf.AssociatedFiles.getAssociatedFilesCount ( GraphicsObject  graphics_object) throws com.foxit.sdk.PDFException

Get the count of associated files in a graphics object.

One or more files may be associated with sections of content in a content stream by enclosing those sections between the marked content. So, in fact, this function is to count associated files in the marked content related to the graphics object.

Parameters
graphics_objectA valid PDF graphics object.
Returns
The count of associated files.

◆ isEmpty()

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

◆ removeAssociatedFile() [1/2]

void com.foxit.sdk.pdf.AssociatedFiles.removeAssociatedFile ( PDFObject  pdf_object,
int  index 
) throws com.foxit.sdk.PDFException

Remove an associated file (represented by FileSpec) in a specified PDF dictionary object, by index.

Parameters
pdf_objectA valid PDF object. It should be either a PDF dictionary object or a PDF reference object that refers to a PDF dictionary object.
indexThe index of an associated file in the specified PDF dictionary object. Valid range: from 0 to (count-1). count is returned by function AssociatedFiles::getAssociatedFilesCount with same parameter object.
Returns
None.

◆ removeAssociatedFile() [2/2]

void com.foxit.sdk.pdf.AssociatedFiles.removeAssociatedFile ( GraphicsObject  graphics_object,
int  index 
) throws com.foxit.sdk.PDFException

Remove an associated file a graphics object, by index.

One or more files may be associated with sections of content in a content stream by enclosing those sections between the marked content. So, in fact, this function is to count associated files in the marked content related to the graphics object.

Parameters
graphics_objectA valid PDF graphics object.
indexThe index of an associated file in the specified PDF graphics object. Valid range: from 0 to (count-1). count is returned by function AssociatedFiles::getAssociatedFilesCount with same parameter graphics_object.
Returns
A FileSpec object that represents the expected associated file.

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