NAME

PDF::Make::Builder::SignatureAppearance - Builder helper for custom visible-signature appearance streams

SYNOPSIS

$pdf->sign(
    pkcs12 => 'mycert.p12', password => '…',
    visible => 1, page => 1, rect => [360, 72, 540, 150],
    appearance => sub {
        my ($sa) = @_;
        $sa->box(fill_colour => '#fff');
        $sa->box(fill_colour => 'transparent');
        $sa->text(text => 'Signed by Alice',
                  size => 12, bold => 1, y => $sa->top - 18);
        $sa->text(text => 'Date: 2026-04-23',
                  size => 10, y => $sa->top - 36);
        $sa->line(y1 => 4, y2 => 4, colour => '#888');
    },
);

DESCRIPTION

When passed a coderef as appearance = sub { ... }>, $pdf-sign> invokes it with an instance of this class. The callback draws into a local canvas whose origin is at the bottom-left of the widget's rectangle and whose extent is $sa-w × $sa->h>. The finished content stream and any standard-14 fonts used are returned to the signing code as a stream + fonts pair, wrapped into a PDF Form XObject and installed as the widget's /AP /N appearance.

METHODS

text(text => ..., align => ..., size => ..., bold => ..., italic => ..., family => ..., colour => ..., x => ..., y => ...)

Draw a single line of text. Without explicit coordinates the line is inset 4pt from the left edge and baseline is near the top.

line(x1, y1, x2, y2, colour, width)

box(x, y, w, h, fill_colour)

Rectangle — either filled or, with fill_colour => 'transparent', stroked outline.

image(file => ..., x => ..., y => ..., w => ..., h => ...)

Embed a raster image (PNG/JPEG) into the widget — typical use-case is a scanned scribbled-signature PNG. The image is added to the document as an indirect image XObject, registered in the widget's appearance-Form /Resources /XObject dict, and drawn via q/cm/Do/Q. Omitted dimensions are derived from the image's native aspect ratio, and omitted coordinates centre the image inside the widget.

w / h / left / right / top / bottom / center_x / center_y

Region accessors. top is the height; coordinates use PDF conventions (origin bottom-left).