Gulag Cleaner CLI (Python) vs the web version: what they share and which to use
Gulag Cleaner exists as a Python command-line tool and as a web app. Installation, options, a side-by-side table and when each one makes sense.
Gulag Cleaner isn't just a website. The original project started as a Python command-line tool with its core written in Rust, and that same core, compiled to WebAssembly, is what gulagcleaner.pro runs inside the browser. Both versions do the same thing to the PDF; what changes is the installation, the way you use them and a couple of extras. This comparison tells you which one fits each case.
What they share
The method. Gulag Cleaner doesn't crop the ads out: it extracts the original file by manipulating the internal structure of the PDF, because Wuolah and StuDocu embed each real page inside a new page with banners, a cover and marks. The result keeps the quality of the source document, and in neither version does the file leave your machine.
The CLI: installation and usage
You need Python installed. Then, in a terminal:
pip install gulagcleaner gulagcleaner notes.pdf
It accepts one or more files, and whole folders too, which makes it the natural choice for cleaning an entire term in one go. Besides the clean PDF it prints the metadata it finds in the file, such as author, subject or university. Its options:
| Option | What it does |
|---|---|
-r | Replaces the original file with the cleaned version. |
-s | Doesn't print the metadata of the cleaned files. |
-n | Forces the “naive”, more conservative method. |
-h | Shows the help. |
-v | Shows the installed version. |
It can also be called from your own code:
from gulagcleaner.clean import clean_pdf_path
clean_pdf_path("input.pdf", "output.pdf")The web version: gulagcleaner.pro
Nothing to install: it opens in any browser from the last three years, on mobile too. The engine is the same one, compiled to WebAssembly, and it runs on your device. It adds two things the CLI doesn't have: a preview of the first six pages with the removed-pages count before you download, and a safety net that runs the engine in two modes, discards any result with no pages or with more than 80% of the document removed, and hands back the original if neither passes. In exchange, it cleans one file at a time.
Side by side
| CLI | Web | |
|---|---|---|
| Installation | Python and pip | None |
| Where the PDF is processed | On your computer | In your browser, no uploads |
| Several files and folders | Yes, in one go | One at a time |
| Preview before saving | No | Yes, first six pages |
| Page-count check | Manual (-n option) | Automatic, in two modes |
| PDF metadata | Yes | No |
| Mobile | No | Yes |
| Updates | pip install -U gulagcleaner | On page reload |
| Licence | GPL-3 | GPL-3, same engine |
Which one to pick
- A single file, from anywhere or from your phone: the web version.
- Dozens of PDFs or a folder per subject: the CLI.
- You want to see the result before saving it: the web version.
- You want to plug it into a script or your own program: the CLI and its
clean_pdf_pathfunction.
Open source, two sites
The engine, the CLI and the Rust and WebAssembly distributions live on GitHub under the GPL-3 licence, and the Python package on PyPI. gulagcleaner.pro is an independent web version built on that engine, not affiliated with gulagcleaner.com, the original project's site. The full story is in the open-source story behind Gulag Cleaner.