Represents a file specification dictionary.
File specifications are used to refer to other files or URLs from within a PDF file. Simple file specifications are just strings. However, the are automatically converted on access to a full file specification to provide a unified interface.
A file specification may refer to a file or an URL. This can easily be checked with
url?. Independent of whether the file specification referes to an URL or a file, the
path method returns the “best” useable path for it.
See: PDF1.7 s7.11
|Name||Type/Allowed Values||Required||Default Value|
|F||HexaPDF::DictionaryFields::PDFByteString or String||false||nil|
|DOS||HexaPDF::DictionaryFields::PDFByteString or String||false||nil|
|Mac||HexaPDF::DictionaryFields::PDFByteString or String||false||nil|
|Unix||HexaPDF::DictionaryFields::PDFByteString or String||false||nil|
|ID||HexaPDF::PDFArray or Array||false||nil|
|V||TrueClass or FalseClass||false||nil|
|EF||HexaPDF::Type::FileSpecification::EFDictionary or Hash||false||nil|
|RF||HexaPDF::Dictionary or Hash||false||nil|
|CI||HexaPDF::Dictionary or Hash||false||nil|
Public Instance Methods
Embeds the given file or IO stream into the PDF file, sets the path accordingly and returns the created stream object.
If a file is given, the
name option defaults to the basename of the file. However, if an IO object is given, the
name argument is mandatory.
If there already was a file embedded for this file specification, it is unembedded first.
The embedded file stream automatically uses the FlateEncode filter for compressing the embedded file.
The name that should be used as path value and when registering.
Specifies whether the embedded file will be added to the EmbeddedFiles name tree under the
name. If the name is already taken, it's value is overwritten.
The file has to be available until the PDF document gets written because reading and writing is done lazily.
true if this file specification contains an embedded file.
Returns the embedded file associated with this file specification, or
nil if this file specification references no embedded file.
If there are multiple possible embedded files, the /EF fields are searched in the following order and the first one with a value is used: /UF, /F, /Unix, /Mac, /DOS.
Returns the path for the referenced file or URL. An empty string is returned if no file specification string is set.
If multiple file specification strings are available, the fields are search in the following order and the first one with a value is used: /UF, /F, /Unix, /Mac, /DOS.
The encoding of the returned path string is either UTF-8 (for /UF) or BINARY (for /F /Unix, /Mac and /DOS).
Sets the file specification string to the given filename.
Since the /Unix, /Mac and /DOS fields are obsolescent, only the /F and /UF fields are set.
Deletes any embedded file streams associated with this file specification. A possible entry in the EmbeddedFiles name tree is also deleted.
Sets the file specification string to the given URL and updates the file system entry appropriately.
The provided URL needs to be in an RFC1738 compliant string representation. If not, an error is raised.
true if this file specification references an URL and not a file.