Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/josee9988/compress-pdfs
A python CLI script to π°πΌπΊπ½πΏπ²ππ π¦ all the π£ππ files πΏπ²π°ππΏππΆππ²πΉπ in a directory using the iLovePDF technology π₯°
https://github.com/josee9988/compress-pdfs
compress compress-files compress-pdf compressed compression compressor compressors pdf pdf-compression pdf-converter pdf-document-processor pdf-files python python-3 python-compressing python-pdf python3 python3-script python3-scripts size-reduction
Last synced: 26 days ago
JSON representation
A python CLI script to π°πΌπΊπ½πΏπ²ππ π¦ all the π£ππ files πΏπ²π°ππΏππΆππ²πΉπ in a directory using the iLovePDF technology π₯°
- Host: GitHub
- URL: https://github.com/josee9988/compress-pdfs
- Owner: Josee9988
- License: gpl-3.0
- Created: 2021-06-23T19:41:38.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-11-26T08:33:50.000Z (almost 3 years ago)
- Last Synced: 2024-05-01T15:39:38.015Z (6 months ago)
- Topics: compress, compress-files, compress-pdf, compressed, compression, compressor, compressors, pdf, pdf-compression, pdf-converter, pdf-document-processor, pdf-files, python, python-3, python-compressing, python-pdf, python3, python3-script, python3-scripts, size-reduction
- Language: Python
- Homepage:
- Size: 45.9 KB
- Stars: 12
- Watchers: 2
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
- Security: .github/SECURITY.md
Awesome Lists containing this project
README
# π¦ **Josee9988/Compress-PDFs**
β οΈThis project is not fully finished or tester, it might cause some errors with in certain situations. Please, do a backup of the folders you want to compress before using this script.β οΈ
---
## π€ **About the project**
* A CLI tool to compress π¦ all PDFs recursively in a directory.
---
## β‘ **Installation**
1. Clone the repository and `cd` into it
```bash
git clone [email protected]:Josee9988/Compress-PDFs.git && cd Compress-PDFs
```2. *Install pip3*
```bash
sudo apt install python3-pip
# verify it with pip3 --version
```3. Instal the ilovepdf dependency
```bash
pip3 install pylovepdf
```4. Make the script executable from anywhere
```bash
bash MAKE_SCRIPT_GLOBAL.sh
```5. Rename `.env.example` to `.env`.
```bash
mv -v .env.example .env # rename to .env
```6. Add your [IlovePDF](https://developer.ilovepdf.com/) public key
* Modify the `.env` file add update the **`PUBLIC_KEY`** variable with your public key from [the IlovePDF developer's site](https://developer.ilovepdf.com/)
7. Run it ;)
```bash
compress.py /RELATIVE/OR/ABSOLUTE/PATH/TO/YOUR/DIR/
```---
## π **Usage**
* After running the script `MAKE_SCRIPT_GLOBAL.sh` you can call the script from anywhere in your system with: `compress.py `
* The script receives only one argument and it is the path of the directory that will be recursively compressed. All the subfolders will be looked up to compress all the pdfs inside the passed directory as an argument.
* Script profile
```bash
compress.py
```* Some examples of usage
1. Using an absolute path
```bash
compress.py /home/username/Documents/MyFolder
```2. Using a relative path
```bash
compress.py .
``````bash
compress.py /dirFromWhereIAm/whatever/
```---
## π² **Project tree**
```bash
.
βββ compress.py
βββ .env
βββ .github
β βββ CODE_OF_CONDUCT.md
β βββ CODEOWNERS
β βββ config.yml
β βββ CONTRIBUTING.md
β βββ FUNDING.yml
β βββ issue_label_bot.yaml
β βββ ISSUE_TEMPLATE
β β βββ 1-bug-report.md
β β βββ 2-failing-test.md
β β βββ 3-docs-bug.md
β β βββ 4-feature-request.md
β β βββ 5-enhancement-request.md
β β βββ 6-security-report.md
β β βββ 7-question-support.md
β β βββ config.yml
β βββ ISSUE_TEMPLATE.md
β βββ pull_request_template.md
β βββ SECURITY.md
β βββ settings.yml
β βββ SUPPORT.md
βββ .gitignore
βββ LICENSE
βββ MAKE_SCRIPT_GLOBAL.sh
βββ README.md2 directories, 25 files
```---
## π **Additional notes**
* The compressed PDF's will automatically replace your old and uncompressed ones.
* In case an error happens because there are multiple pdfs with the same name or simply the program doesn't know how to replace them, an error will be prompt and you will have to manually move the compressed pdf (which will be in the directory passed as an argument) to the desired directory.
* The cloned repository should not be removed as it contains the symbolic link which is globally executable. You can manually move the file and the .env file to your /bin/ folder if you wish.---
Compress-PDFs was generated from *[Josee9988/project-template](https://github.com/Josee9988/project-template)* π
---
## π΅οΈ Extra recommendations
* Always check the console output to check if any error happened and if so, you will have to manually move the non-moved compressed file to its location.
* Also, always perform a copy of the folder before using the script as it will remove the old PDFs, and it might cause some data loss if an error occurs.
---
## π Was the pdf compressor helpful? Help us raise these numbers up
[![Github followers](https://img.shields.io/github/followers/Josee9988.svg?style=social)](https://github.com/Josee9988)
[![Github stars](https://img.shields.io/github/stars/Josee9988/Compress-PDFs.svg?style=social)](https://github.com/Josee9988/Compress-PDFs/stargazers)
[![Github watchers](https://img.shields.io/github/watchers/Josee9988/Compress-PDFs.svg?style=social)](https://github.com/Josee9988/Compress-PDFs/watchers)
[![Github forks](https://img.shields.io/github/forks/Josee9988/Compress-PDFs.svg?style=social)](https://github.com/Josee9988/Compress-PDFs/network/members)
[![Sponsor](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=github-sponsors&color=red&style=social)](https://github.com/sponsors/Josee9988)Enjoy! π
---
## βοΈπ **License**
See the license in the '**[LICENSE](LICENSE)**' file.
---
_Made with a lot of β€οΈβ€οΈ by **[@Josee9988](https://github.com/Josee9988)**_