Crate xmp_writer

Source
Expand description

Write XMP metadata, step by step.

XMP is a metadata format developed by Adobe. It is either embedded into files (e.g. PDF, JPEG, TIFF) or stored in a separate “side-car” file.

This crate provides a simple API to write XMP metadata. Start by creating a new XmpWriter, then add entries to it. Finally, call XmpWriter::finish to get the XMP metadata as a byte vector. Some properties contain a complex data type like a struct or an array. In this case, the writer returns a new struct that can be used to write the data. The reference to the struct must be dropped before the writer can be used again.

§Example

use xmp_writer::{LangId, DateTime, XmpWriter};

let mut writer = XmpWriter::new();
writer.creator(["Martin Haug"]);
writer.title([(Some(LangId("de")), "Titel"), (None, "Title")]);
writer.num_pages(3);
writer.pdf_keywords("Keyword1, Keyword2");
writer.description([(None, "Description")]);
writer.date([DateTime::date(2021, 11, 06)]);

let mut colors = writer.colorants();
colors.add_colorant().swatch_name("Red");
colors.add_colorant().swatch_name("Green");
drop(colors);

writer.creator_tool("xmp-writer 0.3.0");

println!("{}", writer.finish(None));

§See also

Modules§

pdfa
PDF/A extension schema description.

Structs§

Array
An XMP array value.
ColorantWriter
A writer for colorant structs.
ColorantsWriter
Writer for an array of colorants.
CustomNamespace
A custom XML namespace.
DateTime
A date and time.
DimensionsWriter
Writer for a dimensions struct.
Element
A XMP property.
FontWriter
Writer for a font struct.
FontsWriter
Writer for an array of fonts.
JobWriter
Writer for a job struct.
JobsWriter
Writer for a job array.
LangId
A language specifier as defined in RFC 3066. Can also be x-default if the language is not known.
PantryItemWriter
Writer for an item in a Pantry array.
PantryWriter
Writer for a Pantry array.
ResourceEventWriter
Writer for an event that occurred to a resource.
ResourceEventsWriter
Writer for a resource event array.
ResourceRefWriter
Writer for a reference to a resource.
ResourceRefsWriter
Writer for a resource reference array.
Struct
An XMP struct value.
ThumbnailWriter
A self-contained thumbnail image.
ThumbnailsWriter
Write a set of thumbnails.
VersionWriter
Writer for a version struct.
VersionsWriter
Writer for a versions array.
XmpWriter
The main writer struct.

Enums§

ColorantMode
The color space in which a colorant is defined.
ColorantType
The type of a colorant.
DimensionUnit
The unit of a physical dimension.
FontType
The font file type.
MaskMarkers
Whether to ignore the markers of an ingredient.
Namespace
XML Namespaces for the XMP properties.
Rating
A user-assigned rating.
RdfCollectionType
Types of RDF collections.
RenditionClass
The intended use of the resource.
ResourceEventAction
The type of a resource event.
Timezone
A timezone.

Traits§

XmpType
Primitive XMP types.