A simple Python tool that adds equally spaced horizontal lines to PDF files, making them perfect for printing and handwriting and taking notes on them.
Install pdf-liner directly from PyPI:
pip install pdf-linerOr using pipx for isolated installation:
pipx install pdf-liner- Clone the repository:
git clone https://github.com/raideno/pdf-liner.git
cd pdf-liner- Install using Poetry:
poetry installOr install in development mode using pip:
pip install -e .Once installed, you can use the pdf-liner command from anywhere:
pdf-liner input.pdfThis will create input_lined.pdf with default settings (20-point spacing, 0.25 opacity).
pdf-liner input.pdf -o output.pdf
# or
pdf-liner input.pdf --output output.pdfpdf-liner input.pdf -o output.pdf -s 25 -a 0.2
# or
pdf-liner input.pdf --output output.pdf --line-spacing 25 --opacity 0.2-sor--line-spacing: Space between lines in points (default: 20)-aor--opacity: Line opacity from 0.0 to 1.0 (default: 0.25)
Some printers tend to fade lines at the bottom of pages. Use the -e option to make the bottom lines thicker and darker:
pdf-liner input.pdf -e 5
# or
pdf-liner input.pdf --enhance-bottom-lines 5-eor--enhance-bottom-lines: Number of bottom lines to enhance (default: 3, set to 0 to disable)
Add a blank lined page after each page:
pdf-liner input.pdf -p
# or
pdf-liner input.pdf --paddingpdf-liner -h
# or
pdf-liner --help- input_pdf (required) - Path to the input PDF file
- -o, --output (optional) - Path for the output file (default:
input_lined.pdf) - -s, --line-spacing (optional) - Space between lines in points (default: 20)
- -a, --opacity (optional) - Line opacity from 0.0 to 1.0 (default: 0.25)
- -e, --enhance-bottom-lines (optional) - Number of bottom lines to enhance for better printing (default: 3)
- -p, --padding (optional) - Adds a white page with lines after each page
- Python 3.9+
- Poetry
# Install Poetry if you haven't already
pip install poetry
# Install dependencies
poetry install
# Run the tool
poetry run pdf-liner input.pdfpoetry buildThis will create distribution files in the dist/ directory.
The package is automatically published to PyPI when a new release is created on GitHub. The workflow uses the PYPI_API_TOKEN secret configured in the repository.
To publish manually:
poetry config pypi-token.pypi YOUR_PYPI_TOKEN
poetry publish --buildMIT