HomeUniDoc
...

Package pdfaextension

Overview ▾

Index ▾

Variables
func FillModel(d *xmp.Document, extModel *Model) error
func NewModel(name string) xmp.Model
func RegisterSchema(ns *xmp.Namespace, schema *Schema)
type FieldValueType
type Model
    func MakeModel(d *xmp.Document) (*Model, error)
    func (m *Model) Can(nsName string) bool
    func (m *Model) CanTag(tag string) bool
    func (m *Model) GetTag(tag string) (string, error)
    func (m *Model) Namespaces() xmp.NamespaceList
    func (m *Model) SetSchema(namespaceURI string, s Schema)
    func (m *Model) SetTag(tag, value string) error
    func (m *Model) SyncFromXMP(d *xmp.Document) error
    func (m *Model) SyncModel(d *xmp.Document) error
    func (m *Model) SyncToXMP(d *xmp.Document) error
type Properties
    func (p Properties) MarshalXMP(e *xmp.Encoder, node *xmp.Node, m xmp.Model) error
    func (p Properties) Typ() xmp.ArrayType
    func (p *Properties) UnmarshalXMP(d *xmp.Decoder, node *xmp.Node, m xmp.Model) error
type Property
type PropertyCategory
    func (p PropertyCategory) MarshalText() ([]byte, error)
    func (p *PropertyCategory) UnmarshalText(in []byte) error
type Schema
    func GetSchema(namespaceURI string) (*Schema, bool)
type Schemas
    func (r Schemas) IsZero() bool
    func (r Schemas) MarshalXMP(e *xmp.Encoder, node *xmp.Node, m xmp.Model) error
    func (r Schemas) Typ() xmp.ArrayType
    func (r *Schemas) UnmarshalXMP(d *xmp.Decoder, node *xmp.Node, m xmp.Model) error
type ValueType
type ValueTypeName
    func AltOfValueTypeName(vt ValueTypeName) ValueTypeName
    func BagOfValueTypeName(vt ValueTypeName) ValueTypeName
    func ClosedChoiceValueTypeName(vt ValueTypeName) ValueTypeName
    func SeqOfValueTypeName(vt ValueTypeName) ValueTypeName
type ValueTypes
    func (f ValueTypes) MarshalXMP(e *xmp.Encoder, node *xmp.Node, m xmp.Model) error
    func (f ValueTypes) Typ() xmp.ArrayType
    func (f *ValueTypes) UnmarshalXMP(d *xmp.Decoder, node *xmp.Node, m xmp.Model) error

Package files

model.go schemas.go types.go

Variables

Namespace is the xmp.Model PDF/A Extension namespace.

var (
    Namespace   = xmp.NewNamespace("pdfaExtension", "http://www.aiim.org/pdfa/ns/extension/", NewModel)
    SchemaNS    = xmp.NewNamespace("pdfaSchema", "http://www.aiim.org/pdfa/ns/schema#", nil)
    PropertyNS  = xmp.NewNamespace("pdfaProperty", "http://www.aiim.org/pdfa/ns/property#", nil)
    ValueTypeNS = xmp.NewNamespace("pdfaType", "http://www.aiim.org/pdfa/ns/type#", nil)
    FieldNS     = xmp.NewNamespace("pdfaField", "http://www.aiim.org/pdfa/ns/field#", nil)
)

FieldResourceEventSchema is the definition of the ResourceEvent field schema.

var FieldResourceEventSchema = Schema{
    NamespaceURI: "http://ns.adobe.com/xap/1.0/sType/ResourceEvent#",
    Prefix:       "stEvt",
    Schema:       "Definition of basic value type ResourceEvent",
    Property: []Property{
        {
            Category:    PropertyCategoryInternal,
            Description: "The action that occurred. Defined values are: converted, copied, created, cropped, edited, fil-tered, formatted, version_updated, printed, published, managed, produced, resized.New values should be verbs in the past tense.",
            Name:        "action",
            ValueType:   "Open Choice",
        },
        {
            Category:    PropertyCategoryInternal,
            Description: "The instance ID of the modified resource",
            Name:        "instanceID",
            ValueType:   ValueTypeNameURI,
        },
        {
            Category:    PropertyCategoryInternal,
            Description: "Additional description of the action",
            Name:        "parameters",
            ValueType:   ValueTypeNameText,
        },
        {
            Category:    PropertyCategoryInternal,
            Description: "The software agent that performed the action",
            Name:        "softwareAgent",
            ValueType:   ValueTypeNameAgentName,
        },
        {
            Category:    PropertyCategoryInternal,
            Description: "Optional timestamp of when the action occurred",
            Name:        "when",
            ValueType:   ValueTypeNameDate,
        },
    },
    ValueType: nil,
}

FieldVersionSchema is the schema for the basic Version field.

var FieldVersionSchema = Schema{
    NamespaceURI: "http://ns.adobe.com/xap/1.0/sType/Version#",
    Prefix:       "stVer",
    Schema:       "Basic value type Version",
    Property: []Property{
        {
            Category:    PropertyCategoryInternal,
            Description: "Comments concerning what was changed",
            Name:        "comments",
            ValueType:   ValueTypeNameText,
        },
        {
            Category:    PropertyCategoryInternal,
            Description: "High level, formal description of what operation the user performed.",
            Name:        "event",
            ValueType:   ValueTypeResourceEvent,
        },
        {
            Category:    PropertyCategoryInternal,
            Description: "The date on which this version was checked in.",
            Name:        "modifyDate",
            ValueType:   ValueTypeNameDate,
        },
        {
            Category:    PropertyCategoryInternal,
            Description: "The person who modified this version.",
            Name:        "modifier",
            ValueType:   ValueTypeNameProperName,
        },
        {
            Category:    PropertyCategoryInternal,
            Description: "The new version number.",
            Name:        "version",
            ValueType:   ValueTypeNameText,
        },
    },
    ValueType: nil,
}
var PdfSchema = Schema{
    NamespaceURI: "http://ns.adobe.com/pdf/1.3/",
    Prefix:       "pdf",
    Schema:       "Adobe PDF Schema",
    Property: Properties{
        {
            Category:    PropertyCategoryInternal,
            Description: "Keywords",
            Name:        "Keywords",
            ValueType:   ValueTypeNameText,
        },
        {
            Category:    PropertyCategoryInternal,
            Description: "The PDF file version (for example: 1.0, 1.3, and so on).",
            Name:        "PDFVersion",
            ValueType:   ValueTypeNameText,
        },
        {
            Category:    PropertyCategoryInternal,
            Description: "The name of the tool that created the PDF document.",
            Name:        "Producer",
            ValueType:   ValueTypeNameAgentName,
        },
        {
            Category:    PropertyCategoryInternal,
            Description: "Indicates that this is a rights-managed resource..",
            Name:        "Marked",
            ValueType:   ValueTypeNameBoolean,
        },
    },
}

XmpIDQualSchema is the definition of the xmpidq schema.

var XmpIDQualSchema = Schema{
    NamespaceURI: "http://ns.adobe.com/xmp/Identifier/qual/1.0/",
    Prefix:       "xmpidq",
    Schema:       "XMP xmpidq qualifier",
    Property: []Property{
        {
            Category:    PropertyCategoryInternal,
            Name:        "Scheme",
            Description: "A qualifier providing the n ame of the formal identification scheme used for an item in the xmp:Identifier array.",
            ValueType:   ValueTypeNameText,
        },
    },
    ValueType: nil,
}

XmpMediaManagementSchema is the definition of xmpMM schema.

var XmpMediaManagementSchema = Schema{
    NamespaceURI: "http://ns.adobe.com/xap/1.0/mm/",
    Prefix:       "xmpMM",
    Schema:       "XMP Media Management",
    Property: []Property{
        {
            Category:    PropertyCategoryInternal,
            Description: "A reference to the original document from which this one is derived.",
            Name:        "DerivedFrom",
            ValueType:   ValueTypeNameResourceRef,
        },
        {
            Category:    PropertyCategoryInternal,
            Description: "The common identifier for all versions and renditions of a resource",
            Name:        "DocumentID",
            ValueType:   ValueTypeNameURI,
        },
        {
            Category:    PropertyCategoryInternal,
            Description: "UUID based identifier for specific incarnation of a document",
            Name:        "InstanceID",
            ValueType:   ValueTypeNameURI,
        },
        {
            Category:    PropertyCategoryInternal,
            Description: "The common identifier for all versions and renditions of a document",
            Name:        "OriginalDocumentID",
            ValueType:   ValueTypeNameURI,
        },
        {
            Category:    PropertyCategoryInternal,
            Description: "The rendition class name for this resource",
            Name:        "RenditionClass",
            ValueType:   ValueTypeNameRenditionClass,
        },
        {
            Category:    PropertyCategoryInternal,
            Description: "Can be used to provide additional rendition parameters that are too complex or verbose to encode in",
            Name:        "RenditionParams",
            ValueType:   ValueTypeNameText,
        },
        {
            Category:    PropertyCategoryInternal,
            Description: "The document version identifier for this resource.",
            Name:        "VersionID",
            ValueType:   ValueTypeNameText,
        },
        {
            Category:    PropertyCategoryExternal,
            Description: "The version history associated with this resource",
            Name:        "Versions",
            ValueType:   SeqOfValueTypeName(ValueTypeNameVersion),
        },
        {
            Category:    PropertyCategoryInternal,
            Description: "The referenced resource's manager",
            Name:        "Manager",
            ValueType:   ValueTypeNameAgentName,
        },
        {
            Category:    PropertyCategoryInternal,
            Description: "The referenced resource's manager variant.",
            Name:        "ManagerVariant",
            ValueType:   ValueTypeNameText,
        },
        {
            Category:    PropertyCategoryInternal,
            Description: "The referenced resource's manager variant.",
            Name:        "ManagerVariant",
            ValueType:   ValueTypeNameText,
        },
    },
}

func FillModel

func FillModel(d *xmp.Document, extModel *Model) error

FillModel fills in the document XMP model.

func NewModel

func NewModel(name string) xmp.Model

NewModel creates a new pdfAExtension model.

func RegisterSchema

func RegisterSchema(ns *xmp.Namespace, schema *Schema)

RegisterSchema registers schema extension definition.

type FieldValueType

FieldValueType is a schema that describes a field in a structured type.

type FieldValueType struct {
    Name        string        `xmp:"pdfaField:description"`
    Description string        `xmp:"pdfaField:name"`
    ValueType   ValueTypeName `xmp:"pdfaField:valueType"`
}

type Model

Model is the pdfa extension metadata model.

type Model struct {
    Schemas Schemas `xmp:"pdfaExtension:schemas"`
}

func MakeModel

func MakeModel(d *xmp.Document) (*Model, error)

MakeModel creates or gets a model from document.

func (*Model) Can

func (m *Model) Can(nsName string) bool

Can implements xmp.Model interface.

func (*Model) CanTag

func (m *Model) CanTag(tag string) bool

CanTag implements xmp.Model interface.

func (*Model) GetTag

func (m *Model) GetTag(tag string) (string, error)

GetTag implements xmp.Model interface.

func (*Model) Namespaces

func (m *Model) Namespaces() xmp.NamespaceList

Namespaces implements xmp.Model interface.

func (*Model) SetSchema

func (m *Model) SetSchema(namespaceURI string, s Schema)

SetSchema sets the schema into given model.

func (*Model) SetTag

func (m *Model) SetTag(tag, value string) error

SetTag implements xmp.Model interface.

func (*Model) SyncFromXMP

func (m *Model) SyncFromXMP(d *xmp.Document) error

SyncFromXMP implements xmp.Model interface.

func (*Model) SyncModel

func (m *Model) SyncModel(d *xmp.Document) error

SyncModel implements xmp.Model interface.

func (*Model) SyncToXMP

func (m *Model) SyncToXMP(d *xmp.Document) error

SyncToXMP implements xmp.Model interface.

type Properties

Properties is a list of properties.

type Properties []Property

func (Properties) MarshalXMP

func (p Properties) MarshalXMP(e *xmp.Encoder, node *xmp.Node, m xmp.Model) error

MarshalXMP implements xmp.Marshaler interface.

func (Properties) Typ

func (p Properties) Typ() xmp.ArrayType

Typ gets the array type of properties.

func (*Properties) UnmarshalXMP

func (p *Properties) UnmarshalXMP(d *xmp.Decoder, node *xmp.Node, m xmp.Model) error

UnmarshalXMP implements xmp.Unmarshaler interface.

type Property

Property is a schema that describes single property.

type Property struct {
    // Category is the property category.
    Category PropertyCategory `xmp:"pdfaProperty:category"`
    // Description of the property.
    Description string `xmp:"pdfaProperty:description"`
    // Name is a property name.
    Name string `xmp:"pdfaProperty:name"`
    // ValueType is the property value type.
    ValueType ValueTypeName `xmp:"pdfaProperty:valueType"`
}

type PropertyCategory

PropertyCategory is the property category enumerator.

type PropertyCategory int
const (
    // PropertyCategoryUndefined is the undefined property category.
    PropertyCategoryUndefined PropertyCategory = iota
    // PropertyCategoryInternal is the default automatically created document content.
    PropertyCategoryInternal
    // PropertyCategoryExternal are properties are based on user input.
    PropertyCategoryExternal
)

func (PropertyCategory) MarshalText

func (p PropertyCategory) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler interface.

func (*PropertyCategory) UnmarshalText

func (p *PropertyCategory) UnmarshalText(in []byte) error

UnmarshalText implements encoding.TextUnmarshaler interface.

type Schema

Schema is the pdfa extension schema.

type Schema struct {
    // NamespaceURI is schema namespace URI.
    NamespaceURI string `xmp:"pdfaSchema:namespaceURI"`
    // Prefix is preferred schema namespace prefix.
    Prefix string `xmp:"pdfaSchema:prefix"`
    // Schema is optional description.
    Schema string `xmp:"pdfaSchema:schema"`
    // Property is description of schema properties.
    Property Properties `xmp:"pdfaSchema:property"`
    // ValueType is description of schema-specific value types.
    ValueType ValueTypes `xmp:"pdfaSchema:valueType"`
}

func GetSchema

func GetSchema(namespaceURI string) (*Schema, bool)

GetSchema for provided namespace.

type Schemas

Schemas is the array of xmp metadata extension resources.

type Schemas []Schema

func (Schemas) IsZero

func (r Schemas) IsZero() bool

IsZero checks if the resources list has no entries.

func (Schemas) MarshalXMP

func (r Schemas) MarshalXMP(e *xmp.Encoder, node *xmp.Node, m xmp.Model) error

MarshalXMP implements xmp.Marshaler interface.

func (Schemas) Typ

func (r Schemas) Typ() xmp.ArrayType

func (*Schemas) UnmarshalXMP

func (r *Schemas) UnmarshalXMP(d *xmp.Decoder, node *xmp.Node, m xmp.Model) error

UnmarshalXMP implements xmp.Unmarshaler interface.

type ValueType

ValueType is the pdfa extension value type schema.

type ValueType struct {
    Description  string           `xmp:"pdfaType:description"`
    Field        []FieldValueType `xmp:"pdfaType:field"`
    NamespaceURI string           `xmp:"pdfaType:namespaceURI"`
    Prefix       string           `xmp:"pdfaType:prefix"`
    Type         string           `xmp:"pdfaType:type"`
}

type ValueTypeName

ValueTypeName is the name of the value type.

type ValueTypeName string
const (
    ValueTypeNameBoolean        ValueTypeName = "Boolean"
    ValueTypeNameDate           ValueTypeName = "Date"
    ValueTypeNameInteger        ValueTypeName = "Integer"
    ValueTypeNameReal           ValueTypeName = "Real"
    ValueTypeNameText           ValueTypeName = "Text"
    ValueTypeNameAgentName      ValueTypeName = "AgentName"
    ValueTypeNameProperName     ValueTypeName = "ProperName"
    ValueTypeNameXPath          ValueTypeName = "XPath"
    ValueTypeNameGUID           ValueTypeName = "GUID"
    ValueTypeNameLocale         ValueTypeName = "Locale"
    ValueTypeNameMIMEType       ValueTypeName = "MIMEType"
    ValueTypeNameRenditionClass ValueTypeName = "RenditionClass"
    ValueTypeNameResourceRef    ValueTypeName = "ResourceRef"
    ValueTypeNameURL            ValueTypeName = "URL"
    ValueTypeNameURI            ValueTypeName = "URI"
    ValueTypeNameVersion        ValueTypeName = "Version"
)
const (
    ValueTypeResourceEvent ValueTypeName = "ResourceEvent"
)

func AltOfValueTypeName

func AltOfValueTypeName(vt ValueTypeName) ValueTypeName

AltOfValueTypeName gets the ValueTypeName of the alt of given value type names.

func BagOfValueTypeName

func BagOfValueTypeName(vt ValueTypeName) ValueTypeName

BagOfValueTypeName gets the ValueTypeName of the bag of provided value type names.

func ClosedChoiceValueTypeName

func ClosedChoiceValueTypeName(vt ValueTypeName) ValueTypeName

ClosedChoiceValueTypeName gets the closed choice of provided value type name.

func SeqOfValueTypeName

func SeqOfValueTypeName(vt ValueTypeName) ValueTypeName

SeqOfValueTypeName gets a value type name of a sequence of input value type names.

type ValueTypes

ValueTypes is the slice of field value types.

type ValueTypes []FieldValueType

func (ValueTypes) MarshalXMP

func (f ValueTypes) MarshalXMP(e *xmp.Encoder, node *xmp.Node, m xmp.Model) error

MarshalXMP implements xmp.Marshaler interface.

func (ValueTypes) Typ

func (f ValueTypes) Typ() xmp.ArrayType

Typ gets array type of the field value types.

func (*ValueTypes) UnmarshalXMP

func (f *ValueTypes) UnmarshalXMP(d *xmp.Decoder, node *xmp.Node, m xmp.Model) error

UnmarshalXMP implements xmp.Unmarshaler interface.