Back to Tools

PDF Branding Injector

Use cases

Branding supplier product datasheets Adding contact info to manufacturer PDFs Creating consistent downloadable documentation

Uses PyPDF2 for PDF reading and ReportLab canvas for header creation.

Dynamically scales font size (10-14pt bounds) based on page width relative to 612pt base.

Merges the header onto the first page only at an offset position, preserving original content and leaving later pages unchanged.

Processes directory trees recursively with progress tracking via tqdm.

Streamlit App

Platform

Browser-based (no installation required)

Input

PDF files

Branding info (phone, website)

Output

Branded PDFs with custom headers

Launch App View Source

Features

  • Header added to the first page only, with the page extended so content is not covered
  • PyPDF2 + ReportLab header merging
  • Responsive text scaling by page width (10-14pt)
  • Recursive directory processing mirroring subfolder structure
  • Custom TTF font (a valid FONT_PATH or built-in font name is required)
  • Hex colour configuration for text and background
  • Optional filename suffix and date appending (off by default)

How to use

  1. 1 Place PDFs in INPUT_DIR
  2. 2 Configure FONT_PATH, PHONE_NUMBER, WEBSITE
  3. 3 Set TEXT_COLOR and BACKGROUND_COLOR (hex)
  4. 4 Run script with progress tracking
  5. 5 Collect branded PDFs from OUTPUT_DIR

Frequently asked questions

Does the header appear on every page?
No, only on the first page of each PDF. The tool creates a new first page that is 30 points taller than the original (SPACE_HEIGHT), draws the coloured header band in the new space, then places the original content below it, so nothing is covered up. All remaining pages are copied through unchanged, which means page one of the output is slightly taller than the rest of the document.
Every PDF fails with an error. What is the usual cause?
An invalid FONT_PATH. The header is drawn with the font name in TEXT_FONT, which must be registered from the TTF file at FONT_PATH. If registration fails, the script prints a warning claiming a default font will be used, but drawing then fails for every file because the font name was never registered. Either fix the path to a real .ttf file or change TEXT_FONT to a ReportLab built-in such as Helvetica.
What exactly goes in the header?
A single centred line in the format 'website - phone number' (WEBSITE and PHONE_NUMBER constants) on a solid background band. Text and band colours are hex constants (TEXT_COLOR, BACKGROUND_COLOR). Font size scales with page width relative to a 612pt letter page, clamped between 10pt and 14pt, with 12pt used for pages close to letter width.
How does it handle folders of PDFs?
It walks INPUT_DIR recursively, processes every .pdf found, and recreates the same subfolder structure under OUTPUT_DIR. Output filenames are identical to the input unless you flip APPEND_SUFFIX or APPEND_DATE to True (both default to False). A file that errors is warned and skipped; the run continues.

Need something built for your business?

This tool started as bespoke client work. I build custom scripts, data pipelines, and full apps for SEO and product data problems that off-the-shelf tools don't solve.

Tell Me What You Need