Watermark Usage Guide¶
This guide explains how to add watermarks to your PDFs during the build process.
Quick Start¶
Text Watermark¶
# Single chapter with text watermark
bubble-convert 1 --watermark "DRAFT"
# Full book with text watermark
bubble-build --watermark "CONFIDENTIAL"
Image Watermark¶
# Single chapter with image watermark
bubble-convert 1 --watermark-image path/to/logo.png
# Full book with image watermark
bubble-build --watermark-image path/to/watermark.png
Options¶
Text Watermark Options¶
--watermark TEXT: Watermark text (e.g., "DRAFT", "CONFIDENTIAL")--watermark-opacity FLOAT: Opacity (0.0-1.0, default: 0.3)--watermark-angle FLOAT: Rotation angle in degrees (default: 45)
Image Watermark Options¶
--watermark-image PATH: Path to watermark image (PNG, JPG, etc.)--watermark-opacity FLOAT: Opacity (0.0-1.0, default: 0.3)--watermark-angle FLOAT: Rotation angle in degrees (default: 45)
Examples¶
Example 1: Draft Watermark¶
bubble-convert 1 --watermark "DRAFT" --watermark-opacity 0.2 --watermark-angle 45
Example 2: Confidential Watermark¶
bubble-build --watermark "CONFIDENTIAL" --watermark-opacity 0.15
Example 3: Logo Watermark¶
bubble-build --watermark-image cover/logo.png --watermark-opacity 0.3
Example 4: Custom Watermark¶
bubble-convert chapter11-matrix-calculus \
--watermark "FOR REVIEW" \
--watermark-opacity 0.25 \
--watermark-angle 30
Requirements¶
The watermark feature requires:
- pypdf (for PDF manipulation)
- reportlab (for watermark generation)
Install with:
pip install pypdf reportlab
How It Works¶
- PDF is generated normally (via LaTeX/Pandoc)
- If watermark options are provided, the
bubble-add-watermarkscript is called - Watermark is applied as a post-processing step
- Original PDF is replaced with watermarked version
Performance¶
- Speed: Adds ~1-5 seconds per PDF (depending on size)
- Quality: No loss in PDF quality, watermark is added as a layer
- Compatibility: Works with any PDF generated by the build system
Notes¶
- Watermarks are applied after PDF generation
- The original PDF is replaced (backup if needed)
- Works with both single chapters and full book builds
- Image watermarks are automatically scaled to fit the page