Pagecraft

initial-pages

Initial every page

Put your initials and the date in the same corner of every page.

Reads
a PDF — application/pdf
Writes
one file — PDFs
Tool page
/initial-pdf-pages

Example

Initial every page of a contract, as a witness is asked to.

Given

  • contract.pdf — an ordinary PDF of 4 pages

From code

            import { loadDocument, runOperation } from '@pagecraft/core';

const contract = await loadDocument({ bytes, name: 'contract.pdf' });

const [output] = await runOperation('initial-pages', [contract], {
  kind: 'type',
  text: 'PN',
  date: false,
});
          

From a shell

            pagecraft initial-pages contract.pdf --kind type --text PN --no-date
          

What comes back

One PDF of 4 pages.

This example is run by the test suite. If it stopped being true, the build would fail.

Options

kind--kind

string, one of

Initials

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

Initials

What the initials say.

Only when kind is 'type'.

Default: ''

image--image

Uint8Array

Picture

A picture of your initials.

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 initials are drawn. Their own proportions decide the height.

Default: 20

position--position

string, one of

Position

Default: 'bottom-right'

  • top-left — Top left
  • top-center — Top centre
  • top-right — Top right
  • middle-left — Middle left
  • middle-center — Centre
  • middle-right — Middle right
  • bottom-left — Bottom left
  • bottom-center — Bottom centre
  • bottom-right — Bottom right

rotation--rotation

number (°)

Angle

Default: 0

margin--margin

number

Margin

Default: 10

unit--unit

string, one of

Measured in

Default: 'mm'

  • mm — Millimetres
  • cm — Centimetres
  • in — Inches
  • pt — Points

date--date

boolean

Write the date

Puts the date on a line underneath.

Default: true

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 carry them. Every page, by default.

Default: 'all'

What it cannot do

  • Initials placed here are a drawing of initials. They become part of the page and nobody can take them off again — but by themselves they are not evidence of anything: everyone who has the file can see them, and anyone can draw another set like them.
  • They are drawn on top of the page, so a page whose own content already reaches into the margin is written over rather than reflowed.
  • They are not a qualified electronic signature under eIDAS and are on nobody’s trusted list. Where the law or a counterparty requires one, this is not one.
  • Typed initials are set in a handwriting face only where you supply a font or the host offers one. Otherwise they are set in an italic serif, and the result says so.
  • A pictured set of initials 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.