class HexaPDF::DictionaryFields::Field

Parent

A field contains information about one field of a structured PDF object and this information comes directly from the PDF specification.

By incorporating this field information into HexaPDF it is possible to do many things automatically, like checking for the correct minimum PDF version to use or converting a date from its string representation to a Time object.

Attributes

allowed_values[R]

Returns an array with the allowed values for this field, or nil if the values are not constrained.

indirect[R]

Returns true if the value for this field needs to be an indirect object, false if it needs to be a direct object or nil if it can be either.

version[R]

Returns the PDF version that is required for this field.

Public Class Methods

converter_for(type)

Returns the converter for the given type specification.

The converter list from converters is checked for a suitable converter from the front to the back. So if two converters could potentially be used for the same type, the one that appears earlier is used.

converters()

Returns the list of available converter objects.

See ::converter_for for information on how this list is used.

new(type, required: false, default: nil, indirect: nil, allowed_values: nil, version: nil)

Create a new Field object. See Dictionary::define_field for information on the arguments.

Depending on the type entry an appropriate field converter object is chosen from the available converters.

Public Instance Methods

convert(data, document)

Converts the data into a useful object if possible. Otherwise returns nil.

default()

Returns a duplicated default value.

default?()

Returns true if a default value is available.

required?()

Returns true if this field is required.

type()

Returns the array with valid types for this field.

valid_object?(obj)

Returns true if the given object is valid for this field.