Class PDFNet.FileSpec
PDFNet.FileSpec
Constructor Attributes | Constructor Name and Description |
---|---|
PDFNet.FileSpec(id)
FileSpec corresponds to the PDF file specification object.
|
Method Attributes | Method Name and Description |
---|---|
compare(d)
Compares two FileSpec-s for equality.
|
|
copy()
Copy Constructor
|
|
<static> |
PDFNet.FileSpec.create(doc, path, embed)
Creates a file specification for the given file.
|
<static> |
PDFNet.FileSpec.createFromObj(f)
Create a FileSpec and initialize it using given Cos/SDF object.
|
<static> |
PDFNet.FileSpec.createURL(doc, url)
Creates a URL file specification.
|
export(save_as)
The function saves the data referenced by this FileSpec to an external file.
|
|
The function returns data referenced by this FileSpec.
|
|
isValid()
|
|
setDesc(desc)
the functions sets the descriptive text associated with the file specification.
|
Class Detail
PDFNet.FileSpec(id)
FileSpec corresponds to the PDF file specification 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:
- A simple file specification gives just the name of the target file in
a standard format, independent of the naming conventions of any particular file system.
- A full file specification includes information related to one or more specific file
systems.
- A URL reference.
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.
- Parameters:
- id
Method Detail
{[ERROR]}
compare(d)
Compares two FileSpec-s for equality. The comparison will return true
only if both annotations share the same underlying SDF/Cos object.
- Parameters:
- {FileSpec} d
- (generated documentation)
- Returns:
- {[ERROR]} A promise that resolves to an unknown type (generated documentation)
{FileSpec}
copy()
Copy Constructor
- Returns:
- {FileSpec} A promise that resolves to an object of type: "FileSpec" (generated documentation)
<static>
{FileSpec}
PDFNet.FileSpec.create(doc, path, embed)
Creates a file specification for the given file. By default, the specified
file is embedded in PDF.
- Parameters:
- {SDFDoc} doc
- A document to which the FileSpec should be added. To obtain SDFDoc from PDFDoc use PDFDoc::GetSDFDoc() or Obj::GetDoc().
- {string} path
- The path to convert into a file specification.
- {boolean} embed
- A flag indicating whether to embed specified in the PDF. By default, all files are embedded.
- Returns:
- {FileSpec} A promise that resolves to newly created FileSpec object.
<static>
{FileSpec}
PDFNet.FileSpec.createFromObj(f)
Create a FileSpec and initialize it using given Cos/SDF object.
- Parameters:
- {Obj} f
- (generated documentation)
- Returns:
- {FileSpec} A promise that resolves to an object of type: "FileSpec" (generated documentation)
<static>
{FileSpec}
PDFNet.FileSpec.createURL(doc, url)
Creates a URL file specification.
- Parameters:
- {SDFDoc} doc
- A document to which the FileSpec should be added. To obtain SDFDoc from PDFDoc use PDFDoc::GetSDFDoc() or Obj::GetDoc().
- {string} url
- A uniform resource locator (URL) of the form defined in Internet RFC 1738, Uniform Resource Locators Specification.
- Returns:
- {FileSpec} A promise that resolves to newly created FileSpec object.
{boolean}
export(save_as)
The function saves the data referenced by this FileSpec to an external file.
- Parameters:
- {string} 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(). If the file is embedded, the function saves the embedded file. If the file is not embedded, the function will copy the external file. If the file is not embedded and the external file can't be found, the function returns false.
- Returns:
- {boolean} A promise that resolves to true is the file was saved successfully, false otherwise.
{Filter}
getFileData()
The function returns data referenced by this FileSpec.
- Returns:
- {Filter} A promise that resolves to a stream (filter) containing file data. If the file is embedded, the function returns a stream to the embedded file. If the file is not embedded, the function will return a stream to the external file. If the file is not embedded and the external file can't be found, the function returns NULL.
{string}
getFilePath()
- Returns:
- {string} A promise that resolves to the file path for this file specification. If the FileSpec is a dictionary, a corresponding platform specific path is returned (DOS, Mac, or Unix). Otherwise the function returns the path represented in the form described in Section 3.10.1, 'File Specification Strings,' or , if the file system is URL, as a uniform resource locator (URL). If the FileSpec is not valid, an empty string is returned.
{Obj}
getSDFObj()
- Returns:
- {Obj} A promise that resolves to the underlying SDF/Cos object.
{boolean}
isValid()
- Returns:
- {boolean} A promise that resolves to whether this is a valid (non-null) FileSpec. If the function returns false the underlying SDF/Cos object is null or is not valid and the FileSpec object should be treated as null as well.
setDesc(desc)
the functions sets the descriptive text associated with the file specification.
This test is typically used in the EmbeddedFiles name tree.
- Parameters:
- {string} desc
- (generated documentation)