Class FileSpec
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.
For more details on file specifications, please refer to Section 3.10, 'File Specifications' in the PDF Reference Manual.
Implements
Inherited Members
Namespace: pdftron.PDF
Assembly: PDFTronDotNet.dll
Syntax
public class FileSpec : IDisposable
Constructors
FileSpec(Obj)
Create a FileSpec and initialize it using given Cos/SDF object.
Declaration
public FileSpec(Obj a)
Parameters
Type | Name | Description |
---|---|---|
Obj | a | given Cos/SDF object. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
Methods
Create(SDFDoc, string)
Creates a file specification for the given file. By default, the specified file is embedded in PDF.
Declaration
public static FileSpec Create(SDFDoc doc, string path)
Parameters
Type | Name | Description |
---|---|---|
SDFDoc | doc |
|
string | path |
|
Returns
Type | Description |
---|---|
FileSpec | newly created FileSpec object. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
Create(SDFDoc, string, bool)
Creates the.
Declaration
public static FileSpec Create(SDFDoc doc, string path, bool embed)
Parameters
Type | Name | Description |
---|---|---|
SDFDoc | doc | the doc |
string | path | the path |
bool | embed | the embed |
Returns
Type | Description |
---|---|
FileSpec | the file spec |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
CreateURL(SDFDoc, string)
Creates a URL file specification.
Declaration
public static FileSpec CreateURL(SDFDoc doc, string url)
Parameters
Type | Name | Description |
---|---|---|
SDFDoc | doc |
|
string | url |
|
Returns
Type | Description |
---|---|
FileSpec | newly created FileSpec object. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
Dispose(bool)
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
bool | disposing |
Equals(object)
Declaration
public override bool Equals(object o)
Parameters
Type | Name | Description |
---|---|---|
object | o | a given |
Returns
Type | Description |
---|---|
bool | true, if equals to the given object |
Overrides
Export()
The function saves the data referenced by this FileSpec to an external file.
Declaration
public bool Export()
Returns
Type | Description |
---|---|
bool | true is the file was saved successfully, false otherwise. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
Export(string)
Export.
Declaration
public bool Export(string save_as)
Parameters
Type | Name | Description |
---|---|---|
string | save_as | the save_as |
Returns
Type | Description |
---|---|
bool | true, if successful |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
~FileSpec()
Releases all resources used by the FileSpec
Declaration
protected ~FileSpec()
GetFileData()
The function returns data referenced by this FileSpec.
Declaration
public Filter GetFileData()
Returns
Type | Description |
---|---|
Filter | 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. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
GetFilePath()
Gets the file path.
Declaration
public string GetFilePath()
Returns
Type | Description |
---|---|
string | 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. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
GetSDFObj()
Gets the SDFObj.
Declaration
public Obj GetSDFObj()
Returns
Type | Description |
---|---|
Obj | The underlying SDF/Cos object. |
IsValid()
Checks if is valid.
Declaration
public bool IsValid()
Returns
Type | Description |
---|---|
bool | 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. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
Set(FileSpec)
Sets value to the give FileSpec
object
Declaration
public void Set(FileSpec p)
Parameters
Type | Name | Description |
---|---|---|
FileSpec | p | a |
SetDesc(string)
The functions sets the descriptive text associated with the file specification. This text is typically used in the EmbeddedFiles name tree.
Declaration
public void SetDesc(string desc)
Parameters
Type | Name | Description |
---|---|---|
string | desc | descriptive text |
op_Assign(FileSpec)
Assignment operator
Declaration
public FileSpec op_Assign(FileSpec r)
Parameters
Type | Name | Description |
---|---|---|
FileSpec | r | a given |
Returns
Type | Description |
---|---|
FileSpec | a |
Operators
operator ==(FileSpec, FileSpec)
Equality operator checks whether two FileSpec objects are the same
Declaration
public static bool operator ==(FileSpec l, FileSpec r)
Parameters
Type | Name | Description |
---|---|---|
FileSpec | l | the |
FileSpec | r | the |
Returns
Type | Description |
---|---|
bool | true, if both objects are equal |
operator !=(FileSpec, FileSpec)
Inequality operator checks whether two FileSpec objects are different
Declaration
public static bool operator !=(FileSpec l, FileSpec r)
Parameters
Type | Name | Description |
---|---|---|
FileSpec | l | the |
FileSpec | r | the |
Returns
Type | Description |
---|---|
bool | true, if both objects are not equal |