Show / Hide Table of Contents

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.
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.

Inheritance
System.Object
FileSpec
Implements
System.IDisposable
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ToString()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: pdftron.PDF
Assembly: PDFNetAndroid.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
  • A document to which the FileSpec should be added. To obtain SDFDoc from PDFDoc use PDFDoc.GetSDFDoc() or Obj.GetDoc().
System.String path
  • The path to convert into a file specification.
Returns
Type Description
FileSpec

newly created FileSpec object.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

Create(SDFDoc, String, Boolean)

Creates the.

Declaration
public static FileSpec Create(SDFDoc doc, string path, bool embed)
Parameters
Type Name Description
SDFDoc doc

the doc

System.String path

the path

System.Boolean 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
  • A document to which the FileSpec should be added. To obtain SDF.Doc from PDFDoc use PDFDoc.GetSDFDoc() or Obj.GetDoc().
System.String url
  • A uniform resource locator (URL) of the form defined in Internet RFC 1738, Uniform Resource Locators Specification.
Returns
Type Description
FileSpec

newly created FileSpec object.

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

Dispose()

Declaration
public void Dispose()

Dispose(Boolean)

Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type Name Description
System.Boolean disposing

Equals(Object)

Declaration
public override bool Equals(object o)
Parameters
Type Name Description
System.Object o

a given Object

Returns
Type Description
System.Boolean

true, if equals to the given object

Overrides
System.Object.Equals(System.Object)

Export()

The function saves the data referenced by this FileSpec to an external file.

Declaration
public bool Export()
Returns
Type Description
System.Boolean

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
System.String save_as

the save_as

Returns
Type Description
System.Boolean

true, if successful

Exceptions
Type Condition
PDFNetException

PDFNetException the PDFNet exception

Finalize()

Releases all resources used by the FileSpec

Declaration
protected void Finalize()

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
System.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
System.Boolean

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

op_Assign(FileSpec)

Assignment operator

Declaration
public FileSpec op_Assign(FileSpec r)
Parameters
Type Name Description
FileSpec r

a given FileSpec object

Returns
Type Description
FileSpec

a FileSpec object equals to the given object

Set(FileSpec)

Sets value to the give FileSpec object

Declaration
public void Set(FileSpec p)
Parameters
Type Name Description
FileSpec p

a FileSpec object

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
System.String desc

descriptive text

Operators

Equality(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

theFileSpec object on the left of the operator

FileSpec r

theFileSpec object on the right of the operator

Returns
Type Description
System.Boolean

true, if both objects are equal

Inequality(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

theFileSpec object on the left of the operator

FileSpec r

theFileSpec object on the right of the operator

Returns
Type Description
System.Boolean

true, if both objects are not equal

Implements

System.IDisposable
In This Article
Back to top Generated by DocFX