Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pdfmarker_watermark-2.0.0.tar.gz (15.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pdfmarker_watermark-2.0.0-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

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

Hashes for pdfmarker_watermark-2.0.0.tar.gz
Algorithm Hash digest
SHA256 bddbff7f97ab8fcc8aa2b5c9a97c3cc05481306761a5c4091a506d8e9500bbf7
MD5 c02010f6a50732b8841b6d9f31526558
BLAKE2b-256 861c77c7f3c578b6c6b457023e6874892d99bb032a9cee0ad683a71b7ae4cc65

See more details on using hashes here.

Provenance

The following attestation bundles were made for pdfmarker_watermark-2.0.0.tar.gz:

Publisher: release.yml on JorgeSDiaz/PDFMarker

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pdfmarker_watermark-2.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pdfmarker_watermark-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9c597355c9523472ab2ff5e9519dbb938e52881fb3b2b41a39266c2b7302344d
MD5 fe82a817576048bf11422652751b7d05
BLAKE2b-256 6cbcdd87a0728cb4622f001b079fa7ad2a928a60cf8d5be24e00ec93d562cfb7

See more details on using hashes here.

Provenance

The following attestation bundles were made for pdfmarker_watermark-2.0.0-py3-none-any.whl:

Publisher: release.yml on JorgeSDiaz/PDFMarker

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page