- π Table of Contents
- π Overview
- π« Features
- π Project Structure
- 𧩠Modules
- π Getting Started
- πΊ Roadmap
- π€ Contributing
- π License
- π Acknowledgments
The "PdfWatermark" project is a Python-based toolkit that offers multiple solutions for adding watermarks to PDF files. It provides a command line interface (CLI) application, a graphical user interface (GUI) application, and a core module that can be integrated into other applications. The project's key functionalities include the ability to apply configurable watermarks to multiple PDF files, define watermark text, position, and color, and save/load watermark configurations and templates. Its purpose is to provide a flexible and user-friendly solution for adding watermarks to PDF files, offering convenience and customization options to users.
Feature | Description |
---|---|
π Structure and Organization | The codebase follows a modular structure with separate files for different functionality such as CLI, GUI, watermarking logic, setup, and miscellaneous tasks. The src directory contains all the source code files, and the organization of files indicates clear separation of concerns. |
π Code Documentation | The codebase includes inline comments and docstrings that provide explanations and usage instructions, making it easier for developers to understand and maintain the code. |
𧩠Dependency Management | The codebase manages dependencies using external libraries such as PyPDF2, reportlab, and PyQt6, which are imported in the necessary files for PDF manipulation, watermark generation, and GUI development, respectively. The codebase uses the requirements.txt file to specify the required dependencies, and the setup.py file manages the installation of these dependencies using pip . This ensures consistent dependency management and ease of installation. |
β»οΈ Modularity and Reusability | The codebase demonstrates modularity and reusability by separating different components into independent files, allowing for easy reuse of functions and classes across different parts of the application. |
π Security Measures | There is no specific information available about security measures, so it's unclear if there are any specific measures implemented to protect user data or prevent vulnerabilities. |
π External Integrations | The codebase integrates external libraries such as PyPDF2, reportlab, and PyQt6 for PDF manipulation, watermark generation, and GUI development, respectively. |
π Scalability and Extensibility | The codebase can be extended and scaled by adding new functionality or modifying existing code due to its modular design and separation of different components. |
repo
βββ LICENSE
βββ README.md
βββ docs
βΒ Β βββ cli.png
βΒ Β βββ gui.png
βΒ Β βββ install.png
βββ src
βΒ Β βββ appdata
βΒ Β βΒ Β βββ VERSION.txt
βΒ Β βΒ Β βββ config.json
βΒ Β βΒ Β βββ pdfwatermark.ico
βΒ Β βΒ Β βββ template.txt
βΒ Β βββ misc.py
βΒ Β βββ pdfwatermark_cli.py
βΒ Β βββ pdfwatermark_core.py
βΒ Β βββ pdfwatermark_gui.py
βΒ Β βββ requirements.txt
βΒ Β βββ setup.py
βΒ Β βββ setup.sh
βββ test
βββ input
βΒ Β βββ pdf-test.pdf
βββ output
βββ NAME_MARKED_POSITION_SIZE.pdf
βββ pdf-test_marked_bottom-left_8.pdf
βββ pdf-test_marked_bottom-right_8.pdf
βββ pdf-test_marked_bottom_8.pdf
βββ pdf-test_marked_center_8.pdf
βββ pdf-test_marked_left_8.pdf
βββ pdf-test_marked_right_8.pdf
βββ pdf-test_marked_top-left_8.pdf
βββ pdf-test_marked_top-right_8.pdf
βββ pdf-test_marked_top_8.pdf
6 directories, 27 files
Src
File | Summary | Module |
---|---|---|
setup.sh | This code snippet is a shell script that performs several tasks. It sets up a Python virtual environment, installs dependencies from a requirements.txt file, builds an application using a setup.py file, and then installs the built application onto the user's computer. The script provides a success message indicating the location of the installed application. | src/setup.sh |
misc.py | This code snippet defines various constants and variables related to a PDF watermarking application. It determines the current directory, sets default input and output directories, and specifies file paths for version information, configuration, and template files. It also sets GUI-related variables such as icon path, font style, and font size. Additionally, it initializes default values for watermark configuration and template text. Finally, it reads the version file and generates information strings for the application. | src/misc.py |
pdfwatermark_core.py | The provided code snippet is a Python script that adds a watermark to PDF files. It uses the PyPDF2 library to read and merge PDF pages, the reportlab library to generate a PDF canvas for the watermark, and the json library to load and update configuration settings. The WatermarkConfig class handles the loading and updating of the watermark configuration, while the WatermarkApp class contains methods to calculate the position of the watermark, add the watermark to PDF files, and apply the watermark to all PDF files in a given directory. The script can be executed to apply a configurable watermark to multiple PDF files. | src/pdfwatermark_core.py |
pdfwatermark_cli.py | The provided code snippet is a standalone CLI (Command Line Interface) application that offers the functionality of adding a watermark to PDF files. It takes input parameters such as input directory, output directory, and watermark text from the command line. The application uses a custom configuration file and the pyfiglet library to display the application's name, version, and information. It validates the input parameters, checks for the presence of PDF files in the input directory, and applies the watermark to all PDF files found. If any errors occur, it displays an appropriate error message. | src/pdfwatermark_cli.py |
setup.py | The provided code snippet is a setup script for packaging and distributing a Python application called "PdfWatermark". It uses setuptools to define the application's name, version, and other metadata. It also specifies the app's main file, data files, and build options such as an icon and plist properties. Finally, it uses py2app to build the macOS application. | src/setup.py |
pdfwatermark_gui.py | The provided code snippet is a GUI application that allows users to apply watermarks to PDF files. The application provides options to choose input and output directories, enter the watermark text, set the watermark position and color, and save/load watermark configurations and templates. It utilizes the PyQt6 library for creating the graphical interface and the pdfwatermark_cli module for performing the watermarking operations. | src/pdfwatermark_gui.py |
Before you begin, ensure that you have the following prerequisites installed:
- Tested on MacOS Monterey V12.5
- Requires Python 3.11.4 and +
- Clone the pdf-watermark repository:
git clone https://github.com/aanorlondo/pdf-watermark.git
- Change to the project directory:
cd pdf-watermark
- Install the dependencies:
pip install -r requirements.txt
The tools configuration (color, font, position, etc.) is held within the src/config.json
file
- You can edit and redefine the default configuration as you please.
You can save your custom text as template for your your watermarks
- You can save your template wihin the src/template.txt
file
-
Show help :
cd pdf-watermark/src python watermark_cli.py --help
-
Show version :
cd pdf-watermark/src python watermark_cli.py --version
-
Enjoy !
- Run the following commands :
cd pdf-watermark/src python watermark_gui.py
- Enjoy !
-
Run the following commands :
cd pdf-watermark/src sh setup.sh
-
The App distribution will be built under
pdf-watermark/src/dist/
folder. -
The App will be installed to your User Applications folder (
HOME/Applications/PdfWatermark
), meaning that it will appear in your Dock -
Run the application
-
Enjoy !
- [] Improve the rotation algorithm
Contributions are always welcome! Please follow these steps:
- Fork the project repository. This creates a copy of the project on your account that you can modify without affecting the original project.
- Clone the forked repository to your local machine using a Git client like Git or GitHub Desktop.
- Create a new branch with a descriptive name (e.g.,
new-feature-branch
orbugfix-issue-123
).
git checkout -b new-feature-branch
- Make changes to the project's codebase.
- Commit your changes to your local branch with a clear commit message that explains the changes you've made.
git commit -m 'Implemented new feature.'
- Push your changes to your forked repository on GitHub using the following command
git push origin new-feature-branch
- Create a pull request to the original repository. Open a new pull request to the original project repository. In the pull request, describe the changes you've made and why they're necessary. The project maintainers will review your changes and provide feedback or merge them into the main branch.
This project is licensed under the MIT
License. See the LICENSE file for additional info.
Personal project
This awesome documentation was automatically generated using the README-AI Project