Package com.itextpdf.kernel.pdf.filespec
Class PdfFileSpec
- java.lang.Object
-
- com.itextpdf.kernel.pdf.PdfObjectWrapper<PdfObject>
-
- com.itextpdf.kernel.pdf.filespec.PdfFileSpec
-
- Direct Known Subclasses:
PdfDictionaryFS
,PdfStringFS
public class PdfFileSpec extends PdfObjectWrapper<PdfObject>
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
PdfFileSpec(PdfObject pdfObject)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static PdfFileSpec
createEmbeddedFileSpec(PdfDocument doc, byte[] fileStore, java.lang.String fileDisplay, PdfDictionary fileParameter, PdfName afRelationshipValue)
Create an embedded file specification.static PdfFileSpec
createEmbeddedFileSpec(PdfDocument doc, byte[] fileStore, java.lang.String fileDisplay, PdfName afRelationshipValue)
Create an embedded file specification.static PdfFileSpec
createEmbeddedFileSpec(PdfDocument doc, byte[] fileStore, java.lang.String description, java.lang.String fileDisplay, PdfDictionary fileParameter, PdfName afRelationshipValue)
Create an embedded file specification.static PdfFileSpec
createEmbeddedFileSpec(PdfDocument doc, byte[] fileStore, java.lang.String description, java.lang.String fileDisplay, PdfName afRelationshipValue)
Create an embedded file specification.static PdfFileSpec
createEmbeddedFileSpec(PdfDocument doc, byte[] fileStore, java.lang.String description, java.lang.String fileDisplay, PdfName mimeType, PdfDictionary fileParameter, PdfName afRelationshipValue)
Create an embedded file specification.private static PdfFileSpec
createEmbeddedFileSpec(PdfDocument doc, PdfStream stream, java.lang.String description, java.lang.String fileDisplay, PdfName afRelationshipValue)
Create an embedded file specification.private static PdfFileSpec
createEmbeddedFileSpec(PdfDocument doc, PdfStream stream, java.lang.String description, java.lang.String fileDisplay, PdfName mimeType, PdfName afRelationshipValue)
Create an embedded file specification.static PdfFileSpec
createEmbeddedFileSpec(PdfDocument doc, java.io.InputStream is, java.lang.String description, java.lang.String fileDisplay, PdfName mimeType, PdfDictionary fileParameter, PdfName afRelationshipValue)
Create an embedded file specification.static PdfFileSpec
createEmbeddedFileSpec(PdfDocument doc, java.io.InputStream is, java.lang.String description, java.lang.String fileDisplay, PdfName mimeType, PdfName afRelationshipValue)
Create an embedded file specification.static PdfFileSpec
createEmbeddedFileSpec(PdfDocument doc, java.lang.String filePath, java.lang.String fileDisplay, PdfName afRelationshipValue)
Create an embedded file specification.static PdfFileSpec
createEmbeddedFileSpec(PdfDocument doc, java.lang.String filePath, java.lang.String description, java.lang.String fileDisplay, PdfName afRelationshipValue)
Create an embedded file specification.static PdfFileSpec
createEmbeddedFileSpec(PdfDocument doc, java.lang.String filePath, java.lang.String description, java.lang.String fileDisplay, PdfName mimeType, PdfDictionary fileParameter, PdfName afRelationshipValue)
Create an embedded file specification.static PdfFileSpec
createEmbeddedFileSpec(PdfDocument doc, java.lang.String filePath, java.lang.String description, java.lang.String fileDisplay, PdfName mimeType, PdfName afRelationshipValue)
Create an embedded file specification.static PdfFileSpec
createExternalFileSpec(PdfDocument doc, java.lang.String filePath)
Create an external file specification.static PdfFileSpec
createExternalFileSpec(PdfDocument doc, java.lang.String filePath, PdfName afRelationshipValue)
Create an external file specification.PdfArray
getFileIdentifier()
PdfImageXObject
getThumbnailImage()
PDF 2.0.PdfBoolean
isVolatile()
protected boolean
isWrappedObjectMustBeIndirect()
Defines if the object behind this wrapper must be an indirect object in the resultant document.PdfFileSpec
put(PdfName key, PdfObject value)
PdfFileSpec
setCollectionItem(PdfCollectionItem item)
PdfFileSpec
setFileIdentifier(PdfArray fileIdentifier)
PdfFileSpec
setThumbnailImage(PdfImageXObject thumbnailImage)
PDF 2.0.PdfFileSpec
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 Detail
-
PdfFileSpec
protected PdfFileSpec(PdfObject pdfObject)
-
-
Method Detail
-
wrapFileSpecObject
public static PdfFileSpec wrapFileSpecObject(PdfObject fileSpecObject)
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, java.lang.String filePath, PdfName afRelationshipValue)
Create an external file specification.- Parameters:
doc
-PdfDocument
instance to make this file specification indirectfilePath
- file specification string, describing the path to the external fileafRelationshipValue
- 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
public static PdfFileSpec createExternalFileSpec(PdfDocument doc, java.lang.String filePath)
Create an external file specification.- Parameters:
doc
-PdfDocument
instance to make this file specification indirectfilePath
- 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, java.lang.String description, java.lang.String fileDisplay, PdfName mimeType, PdfDictionary fileParameter, PdfName afRelationshipValue)
Create an embedded file specification.- Parameters:
doc
-PdfDocument
instance to make this file specification indirectfileStore
- byte[] containing the filedescription
- file descriptionfileDisplay
- actual file name stored in the pdfmimeType
- subtype of the embedded file. The value of this entry shall conform to the MIME media type namesfileParameter
-PdfDictionary
containing fil parametersafRelationshipValue
- 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, java.lang.String description, java.lang.String fileDisplay, PdfDictionary fileParameter, PdfName afRelationshipValue)
Create an embedded file specification.- Parameters:
doc
-PdfDocument
instance to make this file specification indirectfileStore
- byte[] containing the filefileDisplay
- actual file name stored in the pdffileParameter
-PdfDictionary
containing fil parametersafRelationshipValue
- 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, java.lang.String fileDisplay, PdfDictionary fileParameter, PdfName afRelationshipValue)
Create an embedded file specification.- Parameters:
doc
-PdfDocument
instance to make this file specification indirectfileStore
- byte[] containing the filefileDisplay
- actual file name stored in the pdffileParameter
-PdfDictionary
containing fil parametersafRelationshipValue
- 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, java.lang.String fileDisplay, PdfName afRelationshipValue)
Create an embedded file specification.- Parameters:
doc
-PdfDocument
instance to make this file specification indirectfileStore
- byte[] containing the filefileDisplay
- actual file name stored in the pdfafRelationshipValue
- 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, java.lang.String description, java.lang.String fileDisplay, PdfName afRelationshipValue)
Create an embedded file specification.- Parameters:
doc
-PdfDocument
instance to make this file specification indirectfileStore
- byte[] containing the filedescription
- file descriptionfileDisplay
- actual file name stored in the pdfafRelationshipValue
- 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, java.lang.String filePath, java.lang.String description, java.lang.String fileDisplay, PdfName mimeType, PdfDictionary fileParameter, PdfName afRelationshipValue) throws java.io.IOException
Create an embedded file specification.- Parameters:
doc
-PdfDocument
instance to make this file specification indirectfilePath
- file specification string, describing the path to the file to embeddescription
- file descriptionfileDisplay
- actual file name stored in the pdfmimeType
- subtype of the embedded file. The value of this entry shall conform to the MIME media type namesfileParameter
- dictionary with file parametersafRelationshipValue
- 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:
java.io.IOException
- if there are errors while creating an URL from the passed file path.
-
createEmbeddedFileSpec
public static PdfFileSpec createEmbeddedFileSpec(PdfDocument doc, java.lang.String filePath, java.lang.String description, java.lang.String fileDisplay, PdfName mimeType, PdfName afRelationshipValue) throws java.io.IOException
Create an embedded file specification.- Parameters:
doc
-PdfDocument
instance to make this file specification indirectfilePath
- file specification string, describing the path to the file to embeddescription
- file descriptionfileDisplay
- actual file name stored in the pdfmimeType
- subtype of the embedded file. The value of this entry shall conform to the MIME media type namesafRelationshipValue
- 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:
java.io.IOException
- if there are errors while creating an URL from the passed file path.
-
createEmbeddedFileSpec
public static PdfFileSpec createEmbeddedFileSpec(PdfDocument doc, java.lang.String filePath, java.lang.String description, java.lang.String fileDisplay, PdfName afRelationshipValue) throws java.io.IOException
Create an embedded file specification.- Parameters:
doc
-PdfDocument
instance to make this file specification indirectfilePath
- file specification string, describing the path to the file to embeddescription
- file descriptionfileDisplay
- actual file name stored in the pdfafRelationshipValue
- 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:
java.io.IOException
- if there are errors while creating an URL from the passed file path.
-
createEmbeddedFileSpec
public static PdfFileSpec createEmbeddedFileSpec(PdfDocument doc, java.lang.String filePath, java.lang.String fileDisplay, PdfName afRelationshipValue) throws java.io.IOException
Create an embedded file specification.- Parameters:
doc
-PdfDocument
instance to make this file specification indirectfilePath
- path to the file to embedfileDisplay
- actual file name stored in the pdfafRelationshipValue
- 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:
java.io.IOException
- if there are errors while creating an URL from the passed file path.
-
createEmbeddedFileSpec
public static PdfFileSpec createEmbeddedFileSpec(PdfDocument doc, java.io.InputStream is, java.lang.String description, java.lang.String fileDisplay, PdfName mimeType, PdfDictionary fileParameter, PdfName afRelationshipValue)
Create an embedded file specification.- Parameters:
doc
-PdfDocument
instance to make this file specification indirectis
- stream containing the file to embeddescription
- file descriptionfileDisplay
- actual file name stored in the pdfmimeType
- subtype of the embedded file. The value of this entry shall conform to the MIME media type namesfileParameter
- dictionary with file parametersafRelationshipValue
- 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, java.io.InputStream is, java.lang.String description, java.lang.String fileDisplay, PdfName mimeType, PdfName afRelationshipValue)
Create an embedded file specification.- Parameters:
doc
-PdfDocument
instance to make this file specification indirectis
- stream containing the file to embeddescription
- file descriptionfileDisplay
- actual file name stored in the pdfmimeType
- subtype of the embedded file. The value of this entry shall conform to the MIME media type namesafRelationshipValue
- 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
private static PdfFileSpec createEmbeddedFileSpec(PdfDocument doc, PdfStream stream, java.lang.String description, java.lang.String fileDisplay, PdfName mimeType, PdfName afRelationshipValue)
Create an embedded file specification.- Parameters:
doc
-PdfDocument
instance to make this file specification indirectstream
- an embedded file stream dictionarydescription
- file descriptionfileDisplay
- actual file name stored in the pdfmimeType
- subtype of the embedded file. The value of this entry shall conform to the MIME media type namesafRelationshipValue
- 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
private static PdfFileSpec createEmbeddedFileSpec(PdfDocument doc, PdfStream stream, java.lang.String description, java.lang.String fileDisplay, PdfName afRelationshipValue)
Create an embedded file specification.- Parameters:
doc
-PdfDocument
instance to make this file specification indirectstream
- an embedded file stream dictionaryfileDisplay
- actual file name stored in the pdfafRelationshipValue
- 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
public PdfFileSpec setFileIdentifier(PdfArray fileIdentifier)
-
getFileIdentifier
public PdfArray getFileIdentifier()
-
setVolatile
public PdfFileSpec setVolatile(PdfBoolean isVolatile)
-
isVolatile
public PdfBoolean isVolatile()
-
setCollectionItem
public PdfFileSpec setCollectionItem(PdfCollectionItem item)
-
setThumbnailImage
public PdfFileSpec setThumbnailImage(PdfImageXObject thumbnailImage)
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
public PdfImageXObject 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
public PdfFileSpec put(PdfName key, PdfObject value)
-
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.
-
-