unlock
Unlock PDF
Remove the password from a document you can already open.
- Reads
- a PDF — application/pdf
- Writes
- one file — PDFs
- Tool page
- /unlock-pdf
Example
Take the password off a document you have the password for.
Given
- locked.pdf — a PDF encrypted with a password of 2 pages
From code
import { loadDocument, runOperation } from '@pagecraft/core';
const locked = await loadDocument({ bytes, name: 'locked.pdf' });
const [output] = await runOperation('unlock', [locked], {
password: 'correct horse battery staple',
});
From a shell
pagecraft unlock locked.pdf --password 'correct horse battery staple'
What comes back
One PDF of 2 pages.
This example is run by the test suite. If it stopped being true, the build would fail.
Options
password--password
string
Password
The password you use to open the document. Leave it empty for a document that opens by itself and only forbids printing or copying, or for one this application has already opened with it.
A secret: never shown as it is typed, never remembered, and never written into a URL, a log or a shell history.
What it cannot do
- Unlocking needs the password. Pagecraft cannot break, guess or recover one, and does not try.
- The password is used here, on this device, and is never sent anywhere or kept.