jalexw / pdf-ripper

Use this code to get a PDF from a textbook viewer by automatically looping through your textbook and taking a screenshot of each page.
https://jalexw.github.io/pdf-ripper/
GNU General Public License v3.0
25 stars 1 forks source link
pdf pyautogui python

PDF Ripper

Screenshot of PDF Ripper GUI

Use this code to rip a PDF from a desktop textbook app by automatically looping through your textbook, taking a screenshot of each page, and combining the screenshots into a PDF. This project was created to allow annotating a textbook within an iPad note-taking app.

Installation (for non-techy people)

Standalone ready-to-run executable files. Just download and run. No knowledge of Python required.

Extra Steps on Mac

You need to grant the program permission to record your screen and control your mouse/keyboard. Find these settings at:

Installation (from source code -- for techy people)

1. Install Python3

Check if you already have it installed or if you installed it successfully with the python3 --version command in your Terminal / Command Prompt. Install at least version 3.10.

2. Download this repository

Download this repository (i.e. git clone https://github.com/jalexw/pdf-ripper.git). Or hit the big green button and download as a ZIP archive.

3. Install dependencies

Follow either approach 3a or 3b. I prefer the pipenv approach, but the pip approach is likely easier as it should come bundled with your Python and not require

3a. Install pipenv and run the virtual environment defined in the Pipfile

I installed pipenv using Homebrew on Mac with the command brew install pipenv

Set the repository to be your active directory (i.e. cd pdf-ripper), and run pipenv install to download all required packages defined in the Pipfile. If installing dev dependencies (such as pyinstaller for bundling the app as a standalone executable) use the --dev flag.

3b. Install dependencies with pip

Run pip install -r Requirements.txt

If the command pip isn't found, try replacing with something like: pip3, python3 -m pip

4. Running the program

After installation, use pipenv run start to start the application. Use pipenv run dev for additional logging if you're trying to add a feature or troubleshoot.

If you're using pip instead of pipenv, run:

python3 PDF-Ripper.py

Alternatively, with additional logging:

python3 PDF-Ripper.py --dev

Known Errors

Using the GUI

1. Open your textbook desktop/web application

2. Resize your browser window to get the screenshots as big as you can

3. Start PDF Ripper Application

4. Input settings for PDF ripping

5. The script takes control of your device

To-do

Contributing

Tested on Mac and Windows. Contributors welcome! Feel free to make a PR :)