xmputil

package
v3.0.0-...-55e877b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 29, 2023 License: GPL-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package xmputil provides abstraction used by the pdf document XMP Metadata.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Document

type Document struct {
	// contains filtered or unexported fields
}

Document is an implementation of the xmp document. It is a wrapper over go-xmp/xmp.Document that provides some Pdf predefined functionality.

func LoadDocument

func LoadDocument(stream []byte) (*Document, error)

LoadDocument loads up the xmp document from provided input stream.

func NewDocument

func NewDocument() *Document

NewDocument creates a new document without any previous xmp information.

func (*Document) GetGoXmpDocument

func (_gf *Document) GetGoXmpDocument() *_c.Document

GetGoXmpDocument gets direct access to the go-xmp.Document. All changes done to specified document would result in change of this document 'd'.

func (*Document) GetMediaManagement

func (_egc *Document) GetMediaManagement() (*MediaManagement, bool)

GetMediaManagement gets the media management metadata from provided xmp document.

func (*Document) GetPdfAID

func (_edf *Document) GetPdfAID() (*PdfAID, bool)

GetPdfAID gets the pdfaid xmp metadata model.

func (*Document) GetPdfInfo

func (_gbea *Document) GetPdfInfo() (*PdfInfo, bool)

GetPdfInfo gets the document pdf info.

func (*Document) GetPdfaExtensionSchemas

func (_ad *Document) GetPdfaExtensionSchemas() ([]_ec.Schema, error)

GetPdfaExtensionSchemas gets a pdfa extension schemas.

func (*Document) Marshal

func (_fad *Document) Marshal() ([]byte, error)

Marshal the document into xml byte stream.

func (*Document) MarshalIndent

func (_bg *Document) MarshalIndent(prefix, indent string) ([]byte, error)

MarshalIndent the document into xml byte stream with predefined prefix and indent.

func (*Document) SetMediaManagement

func (_cde *Document) SetMediaManagement(options *MediaManagementOptions) error

SetMediaManagement sets up XMP media management metadata: namespace xmpMM.

func (*Document) SetPdfAExtension

func (_ef *Document) SetPdfAExtension() error

SetPdfAExtension sets the pdfaExtension XMP metadata.

func (*Document) SetPdfAID

func (_gca *Document) SetPdfAID(part int, conformance string) error

SetPdfAID sets up pdfaid xmp metadata. In example: Part: '1' Conformance: 'B' states for PDF/A 1B.

func (*Document) SetPdfInfo

func (_aa *Document) SetPdfInfo(options *PdfInfoOptions) error

SetPdfInfo sets the pdf info into selected document.

type GUID

type GUID string

GUID is a string representing a globally unique identifier.

type MediaManagement

type MediaManagement struct {

	// OriginalDocumentID  as media is imported and projects is started, an original-document ID
	// must be created to identify a new document. This identifies a document as a conceptual entity.
	OriginalDocumentID GUID

	// DocumentID when a document is copied to a new file path or converted to a new format with
	// Save As, another new document ID should usually be assigned. This identifies a general version or
	// branch of a document. You can use it to track different versions or extracted portions of a document
	// with the same original-document ID.
	DocumentID GUID

	// InstanceID to track a document’s editing history, you must assign a new instance ID
	// whenever a document is saved after any changes. This uniquely identifies an exact version of a
	// document. It is used in resource references (to identify both the document or part itself and the
	// referenced or referencing documents), and in document-history resource events (to identify the
	// document instance that resulted from the change).
	InstanceID GUID

	// DerivedFrom references the source document from which this one is derived,
	// typically through a Save As operation that changes the file name or format. It is a minimal reference;
	// missing components can be assumed to be unchanged. For example, a new version might only need
	// to specify the instance ID and version number of the previous version, or a rendition might only need
	// to specify the instance ID and rendition class of the original.
	DerivedFrom *MediaManagementDerivedFrom

	// VersionID are meant to associate the document with a product version that is part of a release process. They can be useful in tracking the
	// document history, but should not be used to identify a document uniquely in any context.
	// Usually it simply works by incrementing integers 1,2,3...
	VersionID string

	// Versions is the history of the document versions along with the comments, timestamps and issuers.
	Versions []MediaManagementVersion
}

MediaManagement are the values from the document media management metadata.

type MediaManagementDerivedFrom

type MediaManagementDerivedFrom struct {
	OriginalDocumentID GUID
	DocumentID         GUID
	InstanceID         GUID
	VersionID          string
}

MediaManagementDerivedFrom is a structure that contains references of identifiers and versions from which given document was derived.

type MediaManagementOptions

type MediaManagementOptions struct {

	// OriginalDocumentID  as media is imported and projects is started, an original-document ID
	// must be created to identify a new document. This identifies a document as a conceptual entity.
	// By default, this value is generated.
	OriginalDocumentID string

	// NewDocumentID is a flag which generates a new Document identifier while setting media management.
	// This value should be set to true only if the document is stored and saved as new document.
	// Otherwise, if the document is modified and overwrites previous file, it should be set to false.
	NewDocumentID bool

	// DocumentID when a document is copied to a new file path or converted to a new format with
	// Save As, another new document ID should usually be assigned. This identifies a general version or
	// branch of a document. You can use it to track different versions or extracted portions of a document
	// with the same original-document ID.
	// By default, this value is generated if NewDocumentID is true or previous doesn't exist.
	DocumentID string

	// InstanceID to track a document’s editing history, you must assign a new instance ID
	// whenever a document is saved after any changes. This uniquely identifies an exact version of a
	// document. It is used in resource references (to identify both the document or part itself and the
	// referenced or referencing documents), and in document-history resource events (to identify the
	// document instance that resulted from the change).
	// By default, this value is generated.
	InstanceID string

	// DerivedFrom references the source document from which this one is derived,
	// typically through a Save As operation that changes the file name or format. It is a minimal reference;
	// missing components can be assumed to be unchanged. For example, a new version might only need
	// to specify the instance ID and version number of the previous version, or a rendition might only need
	// to specify the instance ID and rendition class of the original.
	// By default, the derived from structure is filled from previous XMP metadata (if exists).
	DerivedFrom string

	// VersionID are meant to associate the document with a product version that is part of a release process. They can be useful in tracking the
	// document history, but should not be used to identify a document uniquely in any context.
	// Usually it simply works by incrementing integers 1,2,3...
	// By default, this values is incremented or set to the next version number.
	VersionID string

	// ModifyComment is a comment to given modification
	ModifyComment string

	// ModifyDate is a custom modification date for the versions.
	// By default, this would be set to time.Now().
	ModifyDate _b.Time

	// Modifier is a person who did the modification.
	Modifier string
}

MediaManagementOptions are the options for the Media management xmp metadata.

type MediaManagementVersion

type MediaManagementVersion struct {
	VersionID  string
	ModifyDate _b.Time
	Comments   string
	Modifier   string
}

MediaManagementVersion is the version of the media management xmp metadata.

type PdfAID

type PdfAID struct {
	Part        int
	Conformance string
}

PdfAID is the result of the XMP pdfaid metadata.

type PdfInfo

type PdfInfo struct {
	InfoDict   _dd.PdfObject
	PdfVersion string
	Copyright  string
	Marked     bool
}

PdfInfo is the xmp document pdf info.

type PdfInfoOptions

type PdfInfoOptions struct {
	InfoDict   _dd.PdfObject
	PdfVersion string
	Copyright  string
	Marked     bool

	// Overwrite if set to true, overwrites all values found in the current pdf info xmp model to the ones provided.
	Overwrite bool
}

PdfInfoOptions are the options used for setting pdf info.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL