Click or drag to resize

FileSpec Class

Associates a file attachment with the document. The file attachment will be displayed in the user interface of a viewer application (in Acrobat this is File Attachment tab). The function differs from Annot.CreateFileAttachment() because it associates the attachment with the whole document instead of an annotation on a specific page.
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 Hierarchy

Namespace:  pdftron.PDF
Assembly:  pdftron (in pdftron.dll) Version:
public sealed class FileSpec : IClosable

The FileSpec type exposes the following members.

Public methodFileSpec
Create a FileSpec and initialize it using given Cos/SDF object.
Public methodClose
Public methodStatic memberCreate(SDFDoc, String)
Creates a file specification for the given file. By default, the specified file is embedded in PDF.
Public methodStatic memberCreate(SDFDoc, String, Boolean)
Creates the.
Public methodStatic memberCreateURL
Creates a URL file specification.
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Public methodExport
The function saves the data referenced by this FileSpec to an external file.
Public methodExport(String)
Public methodGetFileData
The function returns data referenced by this FileSpec.
Public methodGetFilePath
Gets the file path.
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetSDFObj
Gets the SDFObj.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodIsValid
Checks if is valid.
Public methodSet
Sets value to the give FileSpec object
Public methodSetDesc
The functions sets the descriptive text associated with the file specification. This text is typically used in the EmbeddedFiles name tree.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Another way to associate a file attachment with the document is using SDF::NameTree:
SDF.NameTree names = SDF.NameTree.Create(doc.GetSDFDoc(), "EmbeddedFiles");
names.put(file_key, file_keysz, embedded_file.GetSDFObj());
See Also