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.
- Colorant
Writer - A writer for colorant structs.
- Colorants
Writer - Writer for an array of colorants.
- Custom
Namespace - A custom XML namespace.
- Date
Time - A date and time.
- Dimensions
Writer - Writer for a dimensions struct.
- Element
- A XMP property.
- Font
Writer - Writer for a font struct.
- Fonts
Writer - Writer for an array of fonts.
- JobWriter
- Writer for a job struct.
- Jobs
Writer - 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. - Pantry
Item Writer - Writer for an item in a Pantry array.
- Pantry
Writer - Writer for a Pantry array.
- Resource
Event Writer - Writer for an event that occurred to a resource.
- Resource
Events Writer - Writer for a resource event array.
- Resource
RefWriter - Writer for a reference to a resource.
- Resource
Refs Writer - Writer for a resource reference array.
- Struct
- An XMP struct value.
- Thumbnail
Writer - A self-contained thumbnail image.
- Thumbnails
Writer - Write a set of thumbnails.
- Version
Writer - Writer for a version struct.
- Versions
Writer - Writer for a versions array.
- XmpWriter
- The main writer struct.
Enums§
- Colorant
Mode - The color space in which a colorant is defined.
- Colorant
Type - The type of a colorant.
- Dimension
Unit - The unit of a physical dimension.
- Font
Type - The font file type.
- Mask
Markers - Whether to ignore the markers of an ingredient.
- Namespace
- XML Namespaces for the XMP properties.
- Rating
- A user-assigned rating.
- RdfCollection
Type - Types of RDF collections.
- Rendition
Class - The intended use of the resource.
- Resource
Event Action - The type of a resource event.
- Timezone
- A timezone.
Traits§
- XmpType
- Primitive XMP types.