public class FileReference extends NativeObject
| Modifier and Type | Method and Description |
|---|---|
static FileReference |
copy(Document targetDocument,
FileReference fileReference)
Copy a file reference object
|
static FileReference |
create(Document targetDocument,
Stream data,
java.lang.String name,
java.lang.String mediaType,
java.lang.String description,
java.time.OffsetDateTime modificationDate)
Create a new file reference object
|
static FileReference |
createDynamicObject(long handle) |
java.lang.String |
getAssociationRelationship()
The file's association relationship (Getter)
|
Stream |
getData()
The file's stream (Getter)
|
java.lang.String |
getDescription()
The file's description (Getter)
|
java.lang.String |
getMediaType()
The file's MIME type (Getter)
|
java.time.OffsetDateTime |
getModificationDate()
The file's date of last modification (Getter)
|
java.lang.String |
getName()
The file name (Getter)
|
void |
setAssociationRelationship(java.lang.String value)
The file's association relationship (Setter)
|
equals, hashCodepublic static FileReference createDynamicObject(long handle)
public static FileReference create(Document targetDocument, Stream data, java.lang.String name, java.lang.String mediaType, java.lang.String description, java.time.OffsetDateTime modificationDate) throws java.io.IOException, ConformanceException
targetDocument - the output document with which the returned object is associateddata - A stream of the file to be added.
Read access is required.name - The name to be used for the embedded file.
This name is presented to the user when viewing the list of embedded files.mediaType - The mime type of the embedded file.
Default: "application/octet-stream".
Common values other than the default are "application/pdf", "application/xml", or "application/msword".description - The description of the embedded file.
This is presented to the user when viewing the list of embedded files.modificationDate - The modify date of the file.
Default: current time.java.lang.IllegalArgumentException - if the targetDocument argument is nulljava.lang.IllegalArgumentException - if the targetDocument argument has already been closedjava.lang.IllegalArgumentException - if the targetDocument argument is read-onlyjava.lang.IllegalArgumentException - if the data argument is nulljava.lang.IllegalArgumentException - if the name argument is null or an empty stringConformanceException - if the document's conformance is PDF/A-1ConformanceException - if the document's conformance is PDF/A-2 and the given data
contains a file other than PDF/A-1 or PDF/A-2java.io.IOException - Error reading from the stream.public static FileReference copy(Document targetDocument, FileReference fileReference) throws java.io.IOException, ConformanceException
targetDocument.
The returned object is associated with the given target document but not yet part of it.targetDocument - the output document with which the returned object is associatedfileReference - a file reference object of a different documentjava.lang.IllegalArgumentException - if the targetDocument argument is nulljava.lang.IllegalArgumentException - if the targetDocument argument has already been closedjava.lang.IllegalArgumentException - if the targetDocument argument is read-onlyjava.lang.IllegalArgumentException - if the fileReference argument is not associated with an input documentjava.lang.IllegalArgumentException - if the fileReference argument is nulljava.lang.IllegalArgumentException - if the fileReference object has already been closedConformanceException - if the document's conformance is PDF/A-1ConformanceException - if the document's conformance is PDF/A-2 and the fileReference object
contains an embedded file other than PDF/A-1 or PDF/A-2java.io.IOException - Error reading from the input stream or writing to the output streampublic java.lang.String getAssociationRelationship()
null if the file is not associated with
any object.
When associating a file reference with an object such as the document
or a page, then this property defines the relationship between the
file and the object.
Typical values are:
java.lang.IllegalStateException - if the object or the owning document has already been closedpublic void setAssociationRelationship(java.lang.String value)
null if the file is not associated with
any object.
When associating a file reference with an object such as the document
or a page, then this property defines the relationship between the
file and the object.
Typical values are:
java.lang.IllegalStateException - if the object or the owning document has already been closedjava.lang.UnsupportedOperationException - the document is read-onlypublic java.lang.String getDescription()
java.lang.IllegalStateException - if the object or the owning document has already been closedpublic java.lang.String getMediaType()
java.lang.IllegalStateException - if the object or the owning document has already been closedpublic java.time.OffsetDateTime getModificationDate()
java.lang.IllegalStateException - if the object or the owning document has already been closedpublic java.lang.String getName()
java.lang.IllegalStateException - if the object or the owning document has already been closedpublic Stream getData()
java.lang.IllegalStateException - if the object or the owning document has already been closed