🧩 Build a PDF Merger Tool in Python – Beginner Automation Project
In this blog post, I'll show you how to build a simple yet useful tool in Python that merges multiple PDF files into one. It's a great automation project for beginners.
🔧 Tech Stack
- Python 3
- PyPDF2 library
✨ Features
- Merge unlimited PDFs in one click
- Clean and beginner-friendly code
- No external GUI required
📂 Project Structure
pdf-merger/
├── merger.py
├── requirements.txt
└── README.md
🧠 Code Explanation
merger.py – This is the main script that scans all PDF files in the current folder and merges them into one:
import os
from PyPDF2 import PdfMerger
def merge_pdfs(pdf_list, output_filename):
merger = PdfMerger()
for pdf in pdf_list:
merger.append(pdf)
merger.write(output_filename)
merger.close()
print(f"✅ Merged PDF saved as: {output_filename}")
if __name__ == "__main__":
files = [f for f in os.listdir() if f.endswith('.pdf')]
print("📄 PDFs found:", files)
merge_pdfs(files, "merged_output.pdf")
⚙️ How to Run
- Install dependencies:
pip install PyPDF2
- Place all your PDF files in the same folder as
merger.py
- Run the script:
python merger.py
- Check the output:
merged_output.pdf
🔗 GitHub Link
✅ Conclusion
This project helped me practice file handling, automation, and working with external libraries in Python. In the future, I plan to add a GUI using Tkinter or allow drag-and-drop functionality.
📌 Tags:
Python, Automation, PDF, Beginner Project, PyPDF2, Developer Portfolio