Skip to content

Signatures and anchors

Put a short, unique piece of text in your document where a signature belongs, such as [[SIG_ENGINEER]], and PageClerk places the signature on it. Write anchors in white or tiny text in your templates, so they are invisible even when not replaced. pageclerk inspect file.pdf lists the anchors it finds.

version: 1
output: out.pdf
inputs: [{file: approval.pdf}]
signatures:
  - image: signature.jpg            # a phone photo or scan
    anchor: "[[SIG_ENGINEER]]"
    width: 2in
    offset: [0, 2pt]
    clean_background: true          # paper removed, trimmed, one ink colour
    remove_anchor_text: true        # cover the anchor with a white box
    caption: "${engineer} - {date}"
    caption_offset: [0, -16pt]      # move the caption below a printed label
  • The image is aligned to the anchor's box: align left/center/right, valign bottom/middle/top, then offset. Without width or height it takes the anchor's width.
  • on_multiple: all | first | error decides what happens when the anchor appears more than once. pages limits the search.
  • A missing anchor stops the build with exit code 6, unless --allow-missing-anchors (or options: {allow_missing_anchors: true}).
  • pageclerk prep-signature signature.jpg -o signature.png does the cleanup once, if you prefer to keep a transparent PNG.

Stamps can use anchors too, and signatures can use position or rect like stamps.