public class FileSpec
extends java.lang.Object
A PDF file can refer to the contents of another file by using a file specification, which can take either of the following forms:
Although the file designated by a file specification is normally external to the PDF file referring to it, it is also possible to embed the file allowing its contents to be stored or transmitted along with the PDF file. However, embedding a file does not change the presumption that it is external to (or separate from) the PDF file.
For more details on file specifications, please refer to Section 3.10, 'File Specifications' in the PDF Reference Manual.
Constructor and Description |
---|
FileSpec(Obj f)
Create a FileSpec and initialize it using given Cos/SDF object.
|
Modifier and Type | Method and Description |
---|---|
static FileSpec |
__Create(long impl,
java.lang.Object ref) |
long |
__GetHandle() |
java.lang.Object |
__GetRefHandle() |
static FileSpec |
create(Doc doc,
java.lang.String path)
Creates a file specification for the given file.
|
static FileSpec |
create(Doc doc,
java.lang.String path,
boolean embed)
Creates a file specification for the given file.
|
static FileSpec |
createURL(Doc doc,
java.lang.String url)
Creates a URL file specification.
|
boolean |
equals(java.lang.Object d)
Compares two FileSpec-s for equality.
|
boolean |
export()
The function saves the data referenced by this FileSpec to an external file.
|
boolean |
export(java.lang.String save_as)
The function saves the data referenced by this FileSpec to an external file.
|
Filter |
getFileData()
The function returns data referenced by this FileSpec.
|
java.lang.String |
getFilePath()
Get the file path.
|
Obj |
getSDFObj()
Get the SDFObj.
|
int |
hashCode() |
boolean |
isValid()
Checks if current FileSpec is valid.
|
void |
setDesc(java.lang.String desc)
The functions sets the descriptive text associated with the file specification.
|
public FileSpec(Obj f)
Note: The constructor does not copy any data, but is instead the logical equivalent of a type cast.
f
- the given Cos/SDF objectpublic static FileSpec create(Doc doc, java.lang.String path) throws PDFNetException
doc
- A document to which the FileSpec should be added. To obtain
SDFDoc from PDFDoc use PDFDoc::GetSDFDoc() or Obj::GetDoc().path
- The path to convert into a file specification.PDFNetException
public static FileSpec create(Doc doc, java.lang.String path, boolean embed) throws PDFNetException
doc
- A document to which the FileSpec should be added. To obtain
SDFDoc from PDFDoc use PDFDoc.GetSDFDoc or Obj.GetDoc.path
- The path to convert into a file specification.embed
- A flag indicating whether to embed specified in the PDF.
By default, all files are embedded.PDFNetException
public static FileSpec createURL(Doc doc, java.lang.String url) throws PDFNetException
doc
- - A document to which the FileSpec should be added. To obtain
SDF::Doc from PDFDoc use PDFDoc::GetSDFDoc() or Obj::GetDoc().url
- - A uniform resource locator (URL) of the form defined in
Internet RFC 1738, Uniform Resource Locators Specification.PDFNetException
public boolean equals(java.lang.Object d)
equals
in class java.lang.Object
d
- the dpublic int hashCode()
hashCode
in class java.lang.Object
public boolean isValid() throws PDFNetException
PDFNetException
public boolean export() throws PDFNetException
PDFNetException
public boolean export(java.lang.String save_as) throws PDFNetException
save_as
- An optional parameter indicating the filepath and filename
where the data should be saved. If this parameter is not specified, the function
will attempt to save the file using FileSpec.GetFilePath().PDFNetException
public Filter getFileData() throws PDFNetException
PDFNetException
public java.lang.String getFilePath() throws PDFNetException
PDFNetException
public void setDesc(java.lang.String desc) throws PDFNetException
desc
- the new descriptionPDFNetException
public Obj getSDFObj()
public static FileSpec __Create(long impl, java.lang.Object ref)
public long __GetHandle()
public java.lang.Object __GetRefHandle()