Document is an implementation of the xmp document. It is a wrapper over go-xmp/xmp.Document that provides some Pdf predefined functionality.
type Document struct {
// contains filtered or unexported fields
}
func LoadDocument(stream []byte) (*Document, error)
LoadDocument loads up the xmp document from provided input stream.
func NewDocument() *Document
NewDocument creates a new document without any previous xmp information.
func (d *Document) GetGoXmpDocument() *xmp.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 (d *Document) GetMediaManagement() (*MediaManagement, bool)
GetMediaManagement gets the media management metadata from provided xmp document.
func (d *Document) GetPdfAID() (*PdfAID, bool)
GetPdfAID gets the pdfaid xmp metadata model.
func (d *Document) GetPdfInfo() (*PdfInfo, bool)
GetPdfInfo gets the document pdf info.
func (d *Document) GetPdfaExtensionSchemas() ([]pdfaextension.Schema, error)
GetPdfaExtensionSchemas gets a pdfa extension schemas.
func (d *Document) Marshal() ([]byte, error)
Marshal the document into xml byte stream.
func (d *Document) MarshalIndent(prefix, indent string) ([]byte, error)
MarshalIndent the document into xml byte stream with predefined prefix and indent.
func (d *Document) SetMediaManagement(options *MediaManagementOptions) error
SetMediaManagement sets up XMP media management metadata: namespace xmpMM.
func (d *Document) SetPdfAExtension() error
SetPdfAExtension sets the pdfaExtension XMP metadata.
func (d *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 (d *Document) SetPdfInfo(options *PdfInfoOptions) error
SetPdfInfo sets the pdf info into selected document.
GUID is a string representing a globally unique identifier.
type GUID string
MediaManagement are the values from the document media management metadata.
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 }
MediaManagementDerivedFrom is a structure that contains references of identifiers and versions from which given document was derived.
type MediaManagementDerivedFrom struct { OriginalDocumentID GUID DocumentID GUID InstanceID GUID VersionID string }
MediaManagementOptions are the options for the Media management xmp metadata.
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 time.Time // Modifier is a person who did the modification. Modifier string }
MediaManagementVersion is the version of the media management xmp metadata.
type MediaManagementVersion struct { VersionID string ModifyDate time.Time Comments string Modifier string }
PdfAID is the result of the XMP pdfaid metadata.
type PdfAID struct { Part int Conformance string }
PdfInfo is the xmp document pdf info.
type PdfInfo struct { InfoDict core.PdfObject PdfVersion string Copyright string Marked bool }
PdfInfoOptions are the options used for setting pdf info.
type PdfInfoOptions struct { InfoDict core.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 }
Name | Synopsis |
---|---|
.. | |
pdfaextension | |
pdfaid |