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§
- PDF/A extension schema description.
Structs§
- An XMP array value.
- A writer for colorant structs.
- Writer for an array of colorants.
- A custom XML namespace.
- A date and time.
- Writer for a dimensions struct.
- A XMP property.
- Writer for a font struct.
- Writer for an array of fonts.
- Writer for a job struct.
- Writer for a job array.
- A language specifier as defined in RFC 3066. Can also be
x-default
if the language is not known. - Writer for an item in a Pantry array.
- Writer for a Pantry array.
- Writer for an event that occurred to a resource.
- Writer for a resource event array.
- Writer for a reference to a resource.
- Writer for a resource reference array.
- An XMP struct value.
- A self-contained thumbnail image.
- Write a set of thumbnails.
- Writer for a version struct.
- Writer for a versions array.
- The main writer struct.
Enums§
- The color space in which a colorant is defined.
- The type of a colorant.
- The unit of a physical dimension.
- The font file type.
- Whether to ignore the markers of an ingredient.
- XML Namespaces for the XMP properties.
- A user-assigned rating.
- Types of RDF collections.
- The intended use of the resource.
- The type of a resource event.
- A timezone.
Traits§
- Primitive XMP types.