This Python script opens all PDF files in a directory, keeps the first page, removes the others, and saves the result in a new directory.
git clone git@github.com:lichti/pdf-keep-first-page.git
cd pdf-keep-first-page
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
mkdir input
python3 pdf_keep_first_page.py
The processed files will be saved in the output
directory.
Ensure that the requirements.txt
file is present in the repository and contains the necessary dependencies, such as PyPDF2
. Here is an example of what the requirements.txt
could look like:
PyPDF2