Operation reference
Every operation Pagecraft can perform, with its options, their defaults, and a worked example that the test suite runs.
48 operations. Every one of them is reached the same way — runOperation(id, documents, options) — and every one of them has a command: pagecraft <id>.
Organise
mergeCombine several PDFs into one file, in the order you choose.
extract-pagesPull a chosen set of pages out into a new PDF.
delete-pagesRemove chosen pages from a PDF and keep the rest.
reorderRearrange every page of a PDF into an order you choose.
rotateTurn chosen pages a quarter, half or three-quarter turn.
splitDivide one PDF into several, at boundaries you choose.
resizeChange the page size of a PDF, scaling the content to match.
cropTrim the margins of a PDF, or set an exact visible area.
n-upPlace several pages on each sheet, for handouts and proof prints.
bookletImpose a PDF for saddle-stitch printing, so it folds into a booklet.
bookmarksGive a document an outline a reader can navigate it by.
Convert
pdf-to-imageTurn pages into PNG, JPEG or WebP images at a density you choose.
image-to-pdfTurn photos and scans into a PDF, one page each.
ocrRead the words on a scanned page and put them in the file, without changing how it looks.
pdf-to-markdownTurn a PDF back into Markdown, with its headings, lists and tables.
pdf-to-htmlTurn a PDF into HTML that is marked up as a document, not painted as a page.
pdf-to-docxTurn a PDF into a Word document with real paragraphs, headings and tables.
pdf-to-csvPull the tables out of a PDF as comma-separated values, one file per table.
pdf-to-xlsxPull the tables out of a PDF into a workbook, one sheet per table.
pdf-to-pptxTurn a PDF into a deck, one slide per page, at the size the pages were.
txt-to-pdfSet a plain text file on paper, at a size and margin you choose.
markdown-to-pdfSet a Markdown file on paper, with its headings, lists, tables and code.
html-to-pdfSet a page of HTML on paper, with the page size, margins and breaks it asks for.
docx-to-pdfSet a Word document on paper, with its headings, lists, tables and pictures.
xlsx-to-pdfSet a workbook on paper, a table to a sheet, with its headings on every page.
csv-to-pdfSet a comma-separated file on paper as a table, with its headings on every page.
Extract
extract-imagesPull every picture out of a PDF at the resolution it was stored at.
extract-textTake the words out of a PDF, in the order they are read.
inspect-formSay what fields a document asks for, and what they currently hold.
searchFind every place a word, a phrase or a pattern appears, and where on the page it is.
compareShow what changed between two versions of a document, word by word.
Edit
fill-formPut answers into a document’s form fields and save it filled in.
flattenBake form answers and annotations into the page so they cannot be changed.
signDraw, type or upload a signature and place it on the page.
initial-pagesPut your initials and the date in the same corner of every page.
watermarkStamp text or a logo across the pages, at a chosen angle and opacity.
page-numbersNumber the pages, in any of nine positions and any of five notations.
bates-numberStamp one unbroken sequence of numbers across a whole set of files.
header-footerAdd a running head or foot in any of six slots, with the filename, date and page.
metadataChange or remove what a document says about its author and its software.
alt-textWrite a description of each picture into the document, where a screen reader reads it.