sign
Sign PDF
Draw, type or upload a signature and place it on the page.
- Reads
- a PDF — application/pdf
- Writes
- one file — PDFs
- Tool page
- /sign-pdf
Example
Put a signature in the corner of the last page of an agreement.
Given
- agreement.pdf — an ordinary PDF of 3 pages
From code
import { loadDocument, runOperation } from '@pagecraft/core';
const agreement = await loadDocument({ bytes, name: 'agreement.pdf' });
const [output] = await runOperation('sign', [agreement], {
kind: 'type',
text: 'Priya Nair',
pages: 'last',
position: 'bottom-right',
});
From a shell
pagecraft sign agreement.pdf --kind type --text 'Priya Nair' --position bottom-right --pages last
What comes back
One PDF of 3 pages, containing “Priya Nair”.
This example is run by the test suite. If it stopped being true, the build would fail.
Options
kind--kind
string, one of
Signature
Default: 'type'
draw— Strokes from a pointer, a stylus or a finger.type— Your name, set in a typeface.image— A photograph or a scan of a pen mark.
strokes--strokes
JSON
Strokes
What was drawn: a list of strokes, each a list of [x, y] pairs, in the coordinates the drawing surface used.
Only when kind is 'draw'.
text--text
string
Name
What the signature says.
Only when kind is 'type'.
Default: ''
image--image
Uint8Array
Picture
A photograph or a scan of your signature. A transparent background lets the page show through.
Only when kind is 'image'.
ink--ink
string, '#rrggbb'
Ink
The colour it is written in. Ignored by a picture, which brings its own.
Default: '#1a2c60'
penWidth--pen-width
number (pt)
Pen
How thick the pen line is.
Only when kind is 'draw'.
Default: 1.5
font--font
string, one of
Typeface
Only when kind is 'type'.
Default: 'serif'
sans— Helvetica.serif— Times.mono— Courier.
bold--bold
boolean
Bold
Only when kind is 'type'.
Default: false
italic--italic
boolean
Italic
Only when kind is 'type'.
Default: true
fontFile--font-file
Uint8Array
Font file
A TrueType or OpenType font to set the name in — a handwriting face, if you have one.
Only when kind is 'type'.
width--width
number
Width
How wide the signature is drawn. Its own proportions decide the height.
Default: 60
position--position
string, one of
Position
Only when place is 'position'.
Default: 'bottom-right'
top-left— Top lefttop-center— Top centretop-right— Top rightmiddle-left— Middle leftmiddle-center— Centremiddle-right— Middle rightbottom-left— Bottom leftbottom-center— Bottom centrebottom-right— Bottom right
rotation--rotation
number (°)
Angle
Default: 0
margin--margin
number
Margin
How far in from the edge it sits. Ignored when it is placed at a point.
Only when place is 'position'.
Default: 10
unit--unit
string, one of
Measured in
Default: 'mm'
mm— Millimetrescm— Centimetresin— Inchespt— Points
place--place
string, one of
Placed
Default: 'position'
position— At a corner of the pagecoordinates— Measured from the bottom-left of the page as a reader sees it.
x--x
number
From the left
To the left-hand edge of the signature.
Only when place is 'coordinates'.
Default: 0
y--y
number
From the bottom
To the foot of the signature, or of the date written under it.
Only when place is 'coordinates'.
Default: 0
date--date
boolean
Write the date
Puts the date on a line underneath.
Default: false
dateText--date-text
string
Date
What it says. Left empty, it is today, written as 2026-08-26.
Only when date is on.
Default: ''
dateSize--date-size
number (pt)
Date size
Only when date is on.
Default: 9
pages--pages
string, a page selection: '1-3, 7, 9-', 'even', 'last'
Pages
Which pages it is signed on. The last one, by default.
Default: 'last'
flatten--flatten
boolean
Lock the rest of the document
Bakes the form answers and the annotations into the pages, so the person you send it to cannot alter what you signed.
Default: false
certify--certify
boolean
Sign with a certificate
Adds a cryptographic signature as well, so a reader can tell whether the file has been changed since you signed it.
Default: false
certificate--certificate
Uint8Array
Certificate
Your X.509 certificate, as a .cer, .crt or .pem file.
Only when certify is on.
privateKey--private-key
Uint8Array
Private key
The key that goes with it: an unencrypted PKCS#8 file. Like every other file here, it never leaves this device.
Only when certify is on.
A secret: never shown as it is typed, never remembered, and never written into a URL, a log or a shell history.
signerName--signer-name
string
Signed by
The name a reader shows beside the signature.
Only when certify is on.
Default: ''
reason--reason
string
Reason
Why it was signed: ‘I approve this document’.
Only when certify is on.
Default: ''
location--location
string
Location
Where it was signed.
Only when certify is on.
Default: ''
What it cannot do
- A signature placed here is a drawing of a signature. It becomes part of the page, so nobody can move it, hide it or take it off again — but by itself it is not evidence of anything: everyone who has the file can see it, and anyone can draw another like it.
- A certificate signature says two things and no more: that the file has not changed since it was signed, and that whoever signed it held the private key. Whether the certificate really belongs to the person it names is for whoever checks it to decide. Pagecraft is not a certificate authority and vouches for nobody.
- Neither kind is a qualified electronic signature under eIDAS, and neither is on Adobe’s trusted list. Where the law or a counterparty requires one of those, this is not one.
- A certificate signature covers the whole file, so it is written in place of any signature the document already carried. Signing a document somebody else has already signed breaks their signature.
- Signing with a certificate needs an RSA certificate and an unencrypted PKCS#8 private key. An encrypted key has to be decrypted first, because there is nowhere here to ask for its password.
- A typed signature is set in a handwriting face only where you supply a font or the host offers one. Otherwise it is set in an italic serif, and the result says so.
- A pictured signature is drawn exactly as it arrives. A transparent background lets the page show through; a white one is drawn as white, and will cover what it sits on.
- Shaping and joining come from the font itself, and nothing reorders a line: text is drawn in the order it is given, so a line mixing right-to-left and left-to-right writing comes out in that order rather than in reading order.