Apply text and image watermarks to PDF files
Project description
PDFMarker
CLI para aplicar marcas de agua a PDFs (texto o imagen).
Install
pip install pdfmarker-watermark
El nombre de distribución en PyPI es pdfmarker-watermark; el paquete que se
importa en Python continúa siendo pdfmarker.
CLI
pdfmarker-watermark
Ejemplo interactivo:
Enter base PDF path: sample.pdf
Watermark type (text/image): text
Enter watermark text: CONFIDENTIAL
✓ Watermark applied: sample_watermarked.pdf
Para marcas de agua de imagen:
Watermark type (text/image): image
Enter image path: logo.png
Image Scale Options:
1. Small (20%)
2. Medium (40%)
3. Large (60%)
4. Original [default]
5. Custom
Select scale (1-5) [4]: 2
Library
from pdfmarker.domain.models import Watermark, WatermarkStyle, WatermarkType
from pdfmarker.infrastructure.adapters import PDFRepository, ReportLabRenderer
from pdfmarker.application.services import WatermarkingServiceImpl
# Setup
service = WatermarkingServiceImpl(PDFRepository(), ReportLabRenderer())
# Text watermark
style = WatermarkStyle(opacity=0.5, rotation=30, size=36, font="Helvetica")
watermark = Watermark(type=WatermarkType.TEXT, content="DRAFT", style=style)
service.apply_watermark_to_pdf("input.pdf", watermark)
Options
| Parameter | Type | Default |
|---|---|---|
| opacity | float | 0.3 |
| rotation | int | 45 |
| font | str | Helvetica |
| size | int | 28 |
Image scale presets: Small (20%), Medium (40%), Large (60%), Original, Custom (5-100%)
Requirements
Python 3.10+ • Pillow 10+ • pypdf 5+ • ReportLab 4.0+
Para desarrollo local:
python -m pip install -e ".[dev]"
pytest tests/ -v
Architecture
graph TD
subgraph "Domain Layer"
WM[Watermark]
PDF[PDFDocument]
STYLE[WatermarkStyle]
end
subgraph "Application Layer"
WS[WatermarkingService]
end
subgraph "Infrastructure"
CLI[CLI Adapter]
PDFR[PDFRepository - pypdf]
RLR[ReportLabRenderer]
end
CLI --> WS
WS --> PDFR
WS --> RLR
PDFR --> WM
RLR --> WM
Hexagonal Architecture: domain → application → infrastructure
- Domain: pure business logic (0 deps)
- Application: ports + services
- Infrastructure: adapters (pypdf, ReportLab)
License
PDFMarker is distributed under the MIT License. It may be used, modified, and distributed in open-source or proprietary products, provided that the copyright and license notices are preserved.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pdfmarker_watermark-2.0.0.tar.gz.
File metadata
- Download URL: pdfmarker_watermark-2.0.0.tar.gz
- Upload date:
- Size: 15.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bddbff7f97ab8fcc8aa2b5c9a97c3cc05481306761a5c4091a506d8e9500bbf7
|
|
| MD5 |
c02010f6a50732b8841b6d9f31526558
|
|
| BLAKE2b-256 |
861c77c7f3c578b6c6b457023e6874892d99bb032a9cee0ad683a71b7ae4cc65
|
Provenance
The following attestation bundles were made for pdfmarker_watermark-2.0.0.tar.gz:
Publisher:
release.yml on JorgeSDiaz/PDFMarker
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pdfmarker_watermark-2.0.0.tar.gz -
Subject digest:
bddbff7f97ab8fcc8aa2b5c9a97c3cc05481306761a5c4091a506d8e9500bbf7 - Sigstore transparency entry: 2166709946
- Sigstore integration time:
-
Permalink:
JorgeSDiaz/PDFMarker@0ead22ed9fb24e238b0fdbc547057981808ecba8 -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/JorgeSDiaz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0ead22ed9fb24e238b0fdbc547057981808ecba8 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pdfmarker_watermark-2.0.0-py3-none-any.whl.
File metadata
- Download URL: pdfmarker_watermark-2.0.0-py3-none-any.whl
- Upload date:
- Size: 13.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c597355c9523472ab2ff5e9519dbb938e52881fb3b2b41a39266c2b7302344d
|
|
| MD5 |
fe82a817576048bf11422652751b7d05
|
|
| BLAKE2b-256 |
6cbcdd87a0728cb4622f001b079fa7ad2a928a60cf8d5be24e00ec93d562cfb7
|
Provenance
The following attestation bundles were made for pdfmarker_watermark-2.0.0-py3-none-any.whl:
Publisher:
release.yml on JorgeSDiaz/PDFMarker
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pdfmarker_watermark-2.0.0-py3-none-any.whl -
Subject digest:
9c597355c9523472ab2ff5e9519dbb938e52881fb3b2b41a39266c2b7302344d - Sigstore transparency entry: 2166709951
- Sigstore integration time:
-
Permalink:
JorgeSDiaz/PDFMarker@0ead22ed9fb24e238b0fdbc547057981808ecba8 -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/JorgeSDiaz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0ead22ed9fb24e238b0fdbc547057981808ecba8 -
Trigger Event:
release
-
Statement type: