Metadata
Metadata, DocInfo, MetaField, and default_tag() — signature properties, signing time, and document /Info + XMP
Metadata (on SignConfig::metadata) bundles everything a viewer surfaces about a signature: the
Signature Properties fields and the document-level DocInfo (/Info). See the
Metadata guide for the walkthrough.
Metadata
Debug + Clone.
Prop
Type
tz_offset()
pub fn tz_offset(&self) -> i32 — the effective UTC offset (seconds) used for signing-time
generation: the explicit tz_offset_secs if set, else IST (+05:30).
use mudrit_pdfsign::prelude::*;
let cfg = SignConfig::builder()
.place("F", [350, 60, 560, 160])?
.reason("Approved for disbursement")
.location("New Delhi")
.contact("accounts@example.com")
.name("Finance Department") // optional — omit to use the certificate CN
.tz_offset(0) // UTC instead of the default IST (+05:30)
.cms_signing_time(true) // also emit the PKCS#9 signingTime CMS attribute
.build();
# Ok::<(), mudrit_pdfsign::Error>(())DocInfo
Document-level metadata written to the PDF /Info dictionary (a viewer's "Document Properties").
Debug + Clone. creator/producer default to MetaField::Append(default_tag()) — Mudrit signs
(does not author) the PDF, so it appends its tag rather than replacing the original.
Prop
Type
is_empty()
pub fn is_empty(&self) -> bool — true when nothing needs writing: all four text fields are None
and both creator and producer are MetaField::Keep.
let cfg = SignConfig::builder()
.place("F", [350, 60, 560, 160])?
.metadata(Metadata {
document: DocInfo {
title: Some("Q3 Report".into()),
author: Some("Acme Corp".into()),
creator: MetaField::Set("Acme Sign 2.0".into()), // replace the Application
..DocInfo::default() // producer keeps its Append tag
},
..Metadata::default()
})
.build();Mudrit writes both /Info and XMP
Mudrit writes both the /Info dictionary and the catalog's XMP /Metadata packet — what
Acrobat's Document Properties actually reads. Tools that update only /Info leave stale XMP behind.
MetaField
How to write a textual /Info field that may already hold a value. Debug + Clone, Default =
Keep.
Prop
Type
default_tag()
pub fn default_tag() -> StringThe default Producer / Application tag, derived entirely from this crate's Cargo.toml (no
hard-coded strings): the product name is the first word of package.description (falling back to
package.name), followed by package.version and package.authors — e.g. Mudrit 0.1.0 (Trexolab). Bumping the version or renaming in Cargo.toml updates it automatically.
SignConfigBuilder::app_tag(tag) is the shorthand for setting MetaField::Append(tag) on both
creator and producer in one call, instead of using default_tag()'s built-in tag.