Appearance
Appearance, RenderMode, Layout, Direction, SigField, Labels, Std14, Border, FontSource, and Image — the visible-signature API, field by field
Appearance controls how a visible signature is drawn: which content shows (text, graphics, or
both), their layout, colours, fonts, and the Acro6 validity-icon overlay. It is built fluently;
sensible defaults reproduce the classic text appearance. Appearance is #[non_exhaustive] —
construct it through Appearance::new() / Appearance::default() / Appearance::invisible(), then
chain the builder methods below.
use mudrit_pdfsign::{Appearance, Image, Layout, RenderMode};
// logo on the left, signer text on the right, with the viewer validity icon
let ap = Appearance::new()
.mode(RenderMode::GraphicAndText)
.layout(Layout::GraphicLeft)
.graphic(Image::Png(std::fs::read("logo.png")?));Appearance fields
Prop
Type
Appearance builder methods
Prop
Type
Validation rules
Appearance::validate() (called automatically by sign_pdf) rejects:
- more than 4
graphics graphic_fractionoutside0.1..=0.9watermark_opacityoutside0.0..=1.0- a
font_sizethat is not finite and> 0.0 - a
line_spacingthat is not finite and> 0.0 - a
border.widththat is not finite and> 0.0 - a
templateusing a complex/RTL script (Hebrew, Arabic, the Indic block, Thai/Lao/Tibetan/Myanmar/Khmer, …) with nofontset — Helvetica (WinAnsi) cannot shape those glyphs RenderMode::Invisiblecombined withtrust_icon: trueor anygraphics— useAppearance::invisible()insteadRenderMode::Watermarkcombined withtrust_icon: true, or with zerographics(needs exactly one background graphic)RenderMode::GraphicOnly/RenderMode::GraphicAndTextwith zerographics
RenderMode
Which of the text block and the graphics are drawn, and how.
Prop
Type
Layout
Where the graphic sits relative to the text block in RenderMode::GraphicAndText.
Prop
Type
Direction
Base paragraph direction for the appearance text block (Unicode bidi, UAX #9).
Prop
Type
SigField
A field shown in the signer text block, in the order listed (used with Appearance::fields). Empty
values are skipped (e.g. an absent organisation).
Prop
Type
Labels
Localizable labels for the signer text block. Override any to translate — used when
Appearance::fields is set.
Prop
Type
Each field also has a same-named fluent setter (Labels::default().signed_by("Hastakshar:"), …).
Std14
A PDF standard-14 (built-in, non-embedded) text font — the three Adobe base families in their
four styles. Renders in every PDF viewer without embedding a font program, but covers only WinAnsi
(Latin-1). For Unicode text set an embedded Appearance::font instead, which overrides this choice.
Prop
Type
Default: Std14::Helvetica (the classic signer-block font).
Border
A border stroked around the signature box (drawn inside the signed appearance, so it renders in every viewer).
Prop
Type
Prop
Type
Attach with Appearance::border(Border::solid([0.0, 0.0, 0.0], 0.75)).
FontSource
Where the Unicode appearance font comes from. Constructed via Appearance::font (bytes) or
Appearance::font_path (path); not built directly.
Prop
Type
FontSource::read(&self) -> Result<Vec<u8>> resolves to the font bytes, reading the file for
Path. Its Debug impl never prints the raw bytes — only the kind and length/path.
Image
A raster image to embed in a signature appearance (logo, handwritten signature, …). Image is
#[non_exhaustive].
Prop
Type
Appearance::new()
.mode(RenderMode::GraphicAndText)
.graphic(Image::Path("logo.png".into())); // format auto-detected at sign time