A Python script to generate Amazon KDP (Kindle Direct Publishing) paperback covers by combining a front and back PDF page and adding a customizable spine text.
- Automated Composition: Combines front and back covers into a single print-ready PDF.
- Dynamic Spine Generation: Automatically calculates spine width based on page count and KDP cream paper standards.
- Text Adjustment: Dynamically adjusts spine text size to fit.
- UV Support: Designed to be run easily with
uv.
- uv installed.
No manual virtual environment setup is needed if you use uv.
- Run the script:
uv run PortadaKDP.py -i input.pdf -o cover.pdf -p 150 -t "MY BOOK TITLE"
| Argument | Flag | Default | Description |
|---|---|---|---|
--input |
-i |
entrada.pdf |
Input PDF containing at least 2 pages (Page 1 = Front, Page 2 = Back). |
--output |
-o |
CUBIERTA_FINAL_KDP.pdf |
Output filename. |
--paginas |
-p |
177 |
Number of pages in the book (used for spine calculation). |
--texto |
-t |
(Preset Title) | Text to display on the spine. |
--direction |
-d |
bottom-up |
Spine text direction: bottom-up (Europe) or top-down (USA). |
--no-confirm |
False |
Skip the interactive text confirmation prompt. |
- The script assumes KDP Cream Paper specifications for spine calculation.
- Images are extracted at 300 DPI for high-quality printing.