stamp_fields

Stamp PDF content into form fields

Usage

pdftl <input> stamp_fields <source.pdf> <field_name>... [<option>=<value>]... output <file>

Details

The stamp_fields operation places pages from an external PDF into interactive form fields’ Appearance Streams (/AP). This permanently applies a visual overlay (like a signature, seal, or stamp) directly onto the field areas.

It applies page 1 of the source PDF to the first specified field, page 2 to the second field, and so on. If there are more fields than pages in the source PDF, the last page of the source is repeated for the remaining fields.

Because form field names are unique across the entire document, you do not need to specify a page number. Nested fields can be targeted using dotted notation (e.g., Parent.Child).

Syntax

<input> stamp_fields <source.pdf> <field_name>... [<option>=<value>]... output <out.pdf>

Options

Options are provided as flat key=value pairs following the target field names and apply globally to all fields stamped in the command.

  • scale=<stretch|fit|width|height|<float>>: Controls how the stamp page is scaled within the field’s bounding box.

    • fit (default): Uniformly scales the stamp to fit inside the widget while maintaining its original aspect ratio.

    • stretch: Scales the stamp independently on the X and Y axes to exactly fill the widget.

    • width: Uniformly scales the stamp to match the exact width of the widget.

    • height: Uniformly scales the stamp to match the exact height of the widget.

    • <float>: Uniformly fits the stamp inside the widget (defaulting to the fit mode) and applies this positive scale multiplier (e.g. scale=0.8 for 80% size).

  • align=<keyword>: Visual alignment of the stamp within the field box. Format can be v-h or center, where v is top, mid, or bottom and h is left, center, or right. Defaults to mid-center (can also be specified as center).

  • opacity=<float>: Transparency setting between 0.0 (transparent) and 1.0 (opaque). Defaults to 1.0.

Examples

Stamp sig.pdf into the field named ‘signature’ using default fit-centering.

pdftl in.pdf stamp_fields sig.pdf signature output out.pdf

Stamp into a nested field, scaled uniformly to 80%, aligned to the bottom right and 80% opaque.

pdftl in.pdf stamp_fields sig.pdf EmploymentForm.Sig scale=0.8 align=bottom-right opacity=0.8 output out.pdf

Stamp page 1 of stamps.pdf onto Sig1, and page 2 onto Sig2.

pdftl in.pdf stamp_fields stamps.pdf Sig1 Sig2 scale=fit output out.pdf

Tags: in_place, forms, stamp, overlay

Source: pdftl.operations.stamp_fields

Read online: https://pdftl.readthedocs.io/en/latest/operations/stamp_fields.html

Type: Operation