Mudrit
Guides

Existing Fields & Seed Values

Sign into a pre-existing named signature field, discover fields with list_signature_fields, and write /SV seed-value constraints

Part of mudrit-pdfsign

Templates often ship with empty signature fields already placed — by Acrobat, iText, or an authoring tool — at a fixed page and rectangle. Rather than creating a new field, Mudrit can sign into a named empty field, and can also write seed-value (/SV) constraints onto a field it creates.

Sign into an existing field

.sign_existing_field(name) targets a pre-existing empty field by its fully-qualified name. The field's own page and rectangle are reused, so any .place(…) / .placement(…) entries are ignored.

use mudrit_pdfsign::prelude::*;

let cfg = SignConfig::builder()
    .sign_existing_field("Signature1")   // reuse the template field's page + rect
    .reason("Approved")
    .build();

let signed = sign_pdf(PdfReader::open("template.pdf")?, &signer, &cfg)?;

Because the field already defines where the signature goes, placements are not needed — and are ignored when sign_existing_field is set. To create a fresh field instead, use placement and leave this unset.

Discovering fields

Use list_signature_fields to enumerate the signature fields in a PDF — both empty slots and already-signed ones — to drive a UI or to pick which empty field to sign into.

use mudrit_pdfsign::list_signature_fields;

for f in list_signature_fields(PdfReader::open("template.pdf")?)? {
    println!("{} — page {} — {}", f.name, f.page, if f.signed { "signed" } else { "empty" });
}

Each result is a SignatureField:

Prop

Type

For an encrypted input, pass the open password on the PdfReader so the field names can be read: list_signature_fields(PdfReader::open("locked.pdf")?.password("asd")).

Seed values (/SV)

A seed value is a set of constraints an author writes onto a signature field so a conforming signer or viewer enforces them — mandated digest(s), acceptable SubFilter(s), reason(s), a required timestamp URL, and whether revocation info (LTV) must be embedded. Attach one with .seed_value(SeedValue { .. }); Mudrit writes the /SV dictionary onto the field it creates.

// hints only — safe to co-embed a signature in the same pass
let cfg = SignConfig::builder()
    .place("F", [350, 60, 560, 160])?
    .seed_value(SeedValue {
        subfilters: vec![SvSubFilter::EtsiCadesDetached],   // advisory: prefer PAdES
        reasons: vec!["Approved".into(), "Reviewed".into()],
        timestamp_url: Some("http://timestamp.comodoca.com".into()),
        // require_* left false, no digest_methods → Adobe-safe
        ..SeedValue::default()
    })
    .build();

Prop

Type

SvDigest is Sha256 / Sha384 / Sha512; SvSubFilter is AdbePkcs7Detached (adbe.pkcs7.detached) or EtsiCadesDetached (ETSI.CAdES.detached). Mudrit writes the dictionary but does not itself refuse to sign against an incompatible configuration — the constraints are for the consuming viewer or re-signer to honour.

Adobe hides a co-embedded signature under mandatory constraints

Two things make Adobe Acrobat / Reader treat the field as awaiting a compliant signature and therefore not list a signature you embed in the same pass in its Signatures panel (the signature stays valid — spec-compliant verifiers read it):

  1. any require_* flag (each sets an /Ff "required" bit), and
  2. digest_methods (emits /DigestMethod, an SV version-2 entry).

Adobe-safe advisory entriessubfilters, reasons, and a timestamp_url with require_timestamp = false — render and validate everywhere, Adobe included. So for the common "sign now and hint constraints" case use those and leave require_* / digest_methods unset; reserve the mandatory constraints for producing a constrained empty template that a future signer fills.

Next

On this page