Package com.itextpdf.kernel.pdf.filespec
Class PdfFileSpec
- Direct Known Subclasses:
-
PdfDictionaryFS
,PdfStringFS
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic PdfFileSpec
createEmbeddedFileSpec
(PdfDocument doc, byte[] fileStore, String fileDisplay, PdfDictionary fileParameter, PdfName afRelationshipValue) Create an embedded file specification.static PdfFileSpec
createEmbeddedFileSpec
(PdfDocument doc, byte[] fileStore, String fileDisplay, PdfName afRelationshipValue) Create an embedded file specification.static PdfFileSpec
createEmbeddedFileSpec
(PdfDocument doc, byte[] fileStore, String description, String fileDisplay, PdfDictionary fileParameter, PdfName afRelationshipValue) Create an embedded file specification.static PdfFileSpec
createEmbeddedFileSpec
(PdfDocument doc, byte[] fileStore, String description, String fileDisplay, PdfName afRelationshipValue) Create an embedded file specification.static PdfFileSpec
createEmbeddedFileSpec
(PdfDocument doc, byte[] fileStore, String description, String fileDisplay, PdfName mimeType, PdfDictionary fileParameter, PdfName afRelationshipValue) Create an embedded file specification.static PdfFileSpec
createEmbeddedFileSpec
(PdfDocument doc, InputStream is, String description, String fileDisplay, PdfName mimeType, PdfDictionary fileParameter, PdfName afRelationshipValue) Create an embedded file specification.static PdfFileSpec
createEmbeddedFileSpec
(PdfDocument doc, InputStream is, String description, String fileDisplay, PdfName mimeType, PdfName afRelationshipValue) Create an embedded file specification.static PdfFileSpec
createEmbeddedFileSpec
(PdfDocument doc, String filePath, String fileDisplay, PdfName afRelationshipValue) Create an embedded file specification.static PdfFileSpec
createEmbeddedFileSpec
(PdfDocument doc, String filePath, String description, String fileDisplay, PdfName afRelationshipValue) Create an embedded file specification.static PdfFileSpec
createEmbeddedFileSpec
(PdfDocument doc, String filePath, String description, String fileDisplay, PdfName mimeType, PdfDictionary fileParameter, PdfName afRelationshipValue) Create an embedded file specification.static PdfFileSpec
createEmbeddedFileSpec
(PdfDocument doc, String filePath, String description, String fileDisplay, PdfName mimeType, PdfName afRelationshipValue) Create an embedded file specification.static PdfFileSpec
createExternalFileSpec
(PdfDocument doc, String filePath) Create an external file specification.static PdfFileSpec
createExternalFileSpec
(PdfDocument doc, String filePath, PdfName afRelationshipValue) Create an external file specification.PDF 2.0.protected boolean
Defines if the object behind this wrapper must be an indirect object in the resultant document.setFileIdentifier
(PdfArray fileIdentifier) setThumbnailImage
(PdfImageXObject thumbnailImage) PDF 2.0.setVolatile
(PdfBoolean isVolatile) static PdfFileSpec
wrapFileSpecObject
(PdfObject fileSpecObject) Wrap the passedPdfObject
to the specificPdfFileSpec
object, according to the type of the passed pdf object.Methods inherited from class com.itextpdf.kernel.pdf.PdfObjectWrapper
ensureObjectIsAddedToDocument, ensureUnderlyingObjectHasIndirectReference, flush, getPdfObject, isFlushed, makeIndirect, makeIndirect, markObjectAsIndirect, setForbidRelease, setModified, setPdfObject, unsetForbidRelease
-
Constructor Details
-
PdfFileSpec
-
-
Method Details
-
wrapFileSpecObject
Wrap the passedPdfObject
to the specificPdfFileSpec
object, according to the type of the passed pdf object.- Parameters:
-
fileSpecObject
- object to wrap - Returns:
-
wrapped
PdfFileSpec
instance
-
createExternalFileSpec
public static PdfFileSpec createExternalFileSpec(PdfDocument doc, String filePath, PdfName afRelationshipValue) Create an external file specification.- Parameters:
-
doc
-PdfDocument
instance to make this file specification indirect -
filePath
- file specification string, describing the path to the external file -
afRelationshipValue
- value that represents the relationship between the component of the passed PDF document that refers to this file specification and the associated file. Ifnull
,PdfName.Unspecified
will be added. - Returns:
-
PdfFileSpec
containing the file specification of the file
-
createExternalFileSpec
Create an external file specification.- Parameters:
-
doc
-PdfDocument
instance to make this file specification indirect -
filePath
- file specification string, describing the path to the external file - Returns:
-
PdfFileSpec
containing the file specification of the file
-
createEmbeddedFileSpec
public static PdfFileSpec createEmbeddedFileSpec(PdfDocument doc, byte[] fileStore, String description, String fileDisplay, PdfName mimeType, PdfDictionary fileParameter, PdfName afRelationshipValue) Create an embedded file specification.- Parameters:
-
doc
-PdfDocument
instance to make this file specification indirect -
fileStore
- byte[] containing the file -
description
- file description -
fileDisplay
- actual file name stored in the pdf -
mimeType
- subtype of the embedded file. The value of this entry shall conform to the MIME media type names -
fileParameter
-PdfDictionary
containing fil parameters -
afRelationshipValue
- value that represents the relationship between the component of the passed PDF document that refers to this file specification and the associated file. Ifnull
,PdfName.Unspecified
will be added. - Returns:
-
PdfFileSpec
containing the file specification of the file
-
createEmbeddedFileSpec
public static PdfFileSpec createEmbeddedFileSpec(PdfDocument doc, byte[] fileStore, String description, String fileDisplay, PdfDictionary fileParameter, PdfName afRelationshipValue) Create an embedded file specification.- Parameters:
-
doc
-PdfDocument
instance to make this file specification indirect -
fileStore
- byte[] containing the file -
fileDisplay
- actual file name stored in the pdf -
fileParameter
-PdfDictionary
containing fil parameters -
afRelationshipValue
- value that represents the relationship between the component of the passed PDF document that refers to this file specification and the associated file. Ifnull
,PdfName.Unspecified
will be added. -
description
- the file description - Returns:
-
PdfFileSpec
containing the file specification of the file
-
createEmbeddedFileSpec
public static PdfFileSpec createEmbeddedFileSpec(PdfDocument doc, byte[] fileStore, String fileDisplay, PdfDictionary fileParameter, PdfName afRelationshipValue) Create an embedded file specification.- Parameters:
-
doc
-PdfDocument
instance to make this file specification indirect -
fileStore
- byte[] containing the file -
fileDisplay
- actual file name stored in the pdf -
fileParameter
-PdfDictionary
containing fil parameters -
afRelationshipValue
- value that represents the relationship between the component of the passed PDF document that refers to this file specification and the associated file. Ifnull
,PdfName.Unspecified
will be added. - Returns:
-
PdfFileSpec
containing the file specification of the file
-
createEmbeddedFileSpec
public static PdfFileSpec createEmbeddedFileSpec(PdfDocument doc, byte[] fileStore, String fileDisplay, PdfName afRelationshipValue) Create an embedded file specification.- Parameters:
-
doc
-PdfDocument
instance to make this file specification indirect -
fileStore
- byte[] containing the file -
fileDisplay
- actual file name stored in the pdf -
afRelationshipValue
- value that represents the relationship between the component of the passed PDF document that refers to this file specification and the associated file. Ifnull
,PdfName.Unspecified
will be added. - Returns:
-
PdfFileSpec
containing the file specification of the file
-
createEmbeddedFileSpec
public static PdfFileSpec createEmbeddedFileSpec(PdfDocument doc, byte[] fileStore, String description, String fileDisplay, PdfName afRelationshipValue) Create an embedded file specification.- Parameters:
-
doc
-PdfDocument
instance to make this file specification indirect -
fileStore
- byte[] containing the file -
description
- file description -
fileDisplay
- actual file name stored in the pdf -
afRelationshipValue
- value that represents the relationship between the component of the passed PDF document that refers to this file specification and the associated file. Ifnull
,PdfName.Unspecified
will be added. - Returns:
-
PdfFileSpec
containing the file specification of the file
-
createEmbeddedFileSpec
public static PdfFileSpec createEmbeddedFileSpec(PdfDocument doc, String filePath, String description, String fileDisplay, PdfName mimeType, PdfDictionary fileParameter, PdfName afRelationshipValue) throws IOException Create an embedded file specification.- Parameters:
-
doc
-PdfDocument
instance to make this file specification indirect -
filePath
- file specification string, describing the path to the file to embed -
description
- file description -
fileDisplay
- actual file name stored in the pdf -
mimeType
- subtype of the embedded file. The value of this entry shall conform to the MIME media type names -
fileParameter
- dictionary with file parameters -
afRelationshipValue
- value that represents the relationship between the component of the passed PDF document that refers to this file specification and the associated file. Ifnull
,PdfName.Unspecified
will be added. - Returns:
-
PdfFileSpec
containing the file specification of the file - Throws:
-
IOException
- if there are errors while creating an URL from the passed file path.
-
createEmbeddedFileSpec
public static PdfFileSpec createEmbeddedFileSpec(PdfDocument doc, String filePath, String description, String fileDisplay, PdfName mimeType, PdfName afRelationshipValue) throws IOException Create an embedded file specification.- Parameters:
-
doc
-PdfDocument
instance to make this file specification indirect -
filePath
- file specification string, describing the path to the file to embed -
description
- file description -
fileDisplay
- actual file name stored in the pdf -
mimeType
- subtype of the embedded file. The value of this entry shall conform to the MIME media type names -
afRelationshipValue
- value that represents the relationship between the component of the passed PDF document that refers to this file specification and the associated file. Ifnull
,PdfName.Unspecified
will be added. - Returns:
-
PdfFileSpec
containing the file specification of the file - Throws:
-
IOException
- if there are errors while creating an URL from the passed file path.
-
createEmbeddedFileSpec
public static PdfFileSpec createEmbeddedFileSpec(PdfDocument doc, String filePath, String description, String fileDisplay, PdfName afRelationshipValue) throws IOException Create an embedded file specification.- Parameters:
-
doc
-PdfDocument
instance to make this file specification indirect -
filePath
- file specification string, describing the path to the file to embed -
description
- file description -
fileDisplay
- actual file name stored in the pdf -
afRelationshipValue
- value that represents the relationship between the component of the passed PDF document that refers to this file specification and the associated file. Ifnull
,PdfName.Unspecified
will be added. - Returns:
-
PdfFileSpec
containing the file specification of the file - Throws:
-
IOException
- if there are errors while creating an URL from the passed file path.
-
createEmbeddedFileSpec
public static PdfFileSpec createEmbeddedFileSpec(PdfDocument doc, String filePath, String fileDisplay, PdfName afRelationshipValue) throws IOException Create an embedded file specification.- Parameters:
-
doc
-PdfDocument
instance to make this file specification indirect -
filePath
- path to the file to embed -
fileDisplay
- actual file name stored in the pdf -
afRelationshipValue
- value that represents the relationship between the component of the passed PDF document that refers to this file specification and the associated file. Ifnull
,PdfName.Unspecified
will be added. - Returns:
-
PdfFileSpec
containing the file specification of the file - Throws:
-
IOException
- if there are errors while creating an URL from the passed file path.
-
createEmbeddedFileSpec
public static PdfFileSpec createEmbeddedFileSpec(PdfDocument doc, InputStream is, String description, String fileDisplay, PdfName mimeType, PdfDictionary fileParameter, PdfName afRelationshipValue) Create an embedded file specification.- Parameters:
-
doc
-PdfDocument
instance to make this file specification indirect -
is
- stream containing the file to embed -
description
- file description -
fileDisplay
- actual file name stored in the pdf -
mimeType
- subtype of the embedded file. The value of this entry shall conform to the MIME media type names -
fileParameter
- dictionary with file parameters -
afRelationshipValue
- value that represents the relationship between the component of the passed PDF document that refers to this file specification and the associated file. Ifnull
,PdfName.Unspecified
will be added. - Returns:
-
PdfFileSpec
containing the file specification of the file
-
createEmbeddedFileSpec
public static PdfFileSpec createEmbeddedFileSpec(PdfDocument doc, InputStream is, String description, String fileDisplay, PdfName mimeType, PdfName afRelationshipValue) Create an embedded file specification.- Parameters:
-
doc
-PdfDocument
instance to make this file specification indirect -
is
- stream containing the file to embed -
description
- file description -
fileDisplay
- actual file name stored in the pdf -
mimeType
- subtype of the embedded file. The value of this entry shall conform to the MIME media type names -
afRelationshipValue
- value that represents the relationship between the component of the passed PDF document that refers to this file specification and the associated file. Ifnull
,PdfName.Unspecified
will be added. - Returns:
-
PdfFileSpec
containing the file specification of the file
-
setFileIdentifier
-
getFileIdentifier
-
setVolatile
-
isVolatile
-
setCollectionItem
-
setThumbnailImage
PDF 2.0. Sets a stream object defining the thumbnail image for the file specification.- Parameters:
-
thumbnailImage
- image used as a thumbnail - Returns:
-
this
PdfFileSpec
instance
-
getThumbnailImage
PDF 2.0. Gets a stream object defining the thumbnail image for the file specification.- Returns:
-
image used as a thumbnail, or
null
if it is not set
-
put
-
isWrappedObjectMustBeIndirect
protected boolean isWrappedObjectMustBeIndirect()Description copied from class:PdfObjectWrapper
Defines if the object behind this wrapper must be an indirect object in the resultant document.
If this method returns true it doesn't necessarily mean that object must be in the indirect state at any moment, but rather defines that when the object will be written to the document it will be transformed into indirect object if it's not indirect yet.
Return value of this method shouldn't depend on any logic, it should return always true or false.- Specified by:
-
isWrappedObjectMustBeIndirect
in classPdfObjectWrapper<PdfObject>
- Returns:
- true if in the resultant document the object behind the wrapper must be indirect, otherwise false.
-