unlock-pdf
v0.0.1
Published
Remove passwords from PDF files
Maintainers
Readme
unlock-pdf
A powerful command-line tool for removing password protection from PDF files.

Features
- Remove passwords from password-protected PDF files
- Interactive CLI with file browser
- Automatic dependency detection and installation
- Cross-platform support (Linux, macOS, Windows)
- Comprehensive error handling
- Preserves PDF quality and text selectability
Prerequisites
This tool requires qpdf to be installed on your system. The CLI will automatically detect if qpdf is missing and offer to install it for you using your system's package manager.
Manual Installation of qpdf
If you prefer to install qpdf manually:
Linux (Debian/Ubuntu):
sudo apt-get install qpdfmacOS (Homebrew):
brew install qpdfWindows (Chocolatey):
choco install qpdfWindows (winget):
winget install qpdf.qpdfFor more installation options, visit: https://qpdf.readthedocs.io/en/stable/installation.html
Installation
Install globally to use the command-line tool:
npm install -g unlock-pdfOr with pnpm:
pnpm add -g unlock-pdfUsage
Command Line Interface
Interactive Mode
Simply run the command without arguments for an interactive experience:
unlock-pdfThis will:
- Open an interactive file browser to select your PDF
- Check if the PDF is password-protected
- Prompt for the password
- Ask for the output file path (with a default suggestion)
- Unlock the PDF and save it
Non-Interactive Mode
Provide all arguments directly:
unlock-pdf <input-file> <password> [options]Examples:
# Unlock a PDF with default output name
unlock-pdf document.pdf myPassword123
# Specify custom output path
unlock-pdf document.pdf myPassword123 -o unlocked.pdf
# Using full paths
unlock-pdf /path/to/document.pdf myPassword123 -o /path/to/output.pdfOptions
-o, --output <path>- Specify the output file path (default: adds "_unlocked" suffix to input filename)--skip-dependency-check- Skip the qpdf dependency check (not recommended)-V, --version- Output the version number-h, --help- Display help information
How It Works
This tool uses qpdf, a powerful command-line program for PDF manipulation. When you provide a password-protected PDF:
- The tool validates the input file
- Checks if the PDF is password-protected
- Uses
qpdfwith the provided password to decrypt the PDF - Saves the unlocked PDF to the specified output path
The original PDF quality, formatting, and text selectability are preserved.
