Skip to content

BaseMax/pdf-flight-ticket-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

✈️ pdf-flight-ticket-generator

A simple Python utility to generate flight-style ticket PDFs using ReportLab. This project demonstrates how to structure and export travel-related documents programmatically.

⚠️ Disclaimer This project is intended for educational, testing, and demonstration purposes only. It should not be used to create or modify real-world travel documents.


🚀 Features

  • Generate structured flight ticket PDFs
  • Fully customizable input data (name, route, dates, etc.)
  • Clean table-based layout
  • Lightweight and dependency-minimal
  • Built with reportlab

📁 Project Structure

pdf-flight-ticket-generator/
│
├── generate.py                  # Main script to generate PDF
├── sample_flight_ticket.pdf     # Example output
├── README.md
└── LICENSE

⚙️ Requirements

  • Python 3.x
  • reportlab

Install dependency:

pip install reportlab

🧾 Usage

Run the script:

python generate.py

This will generate:

sample_flight_ticket.pdf

🛠 Configuration

You can modify the ticket data directly inside generate.py:

data = {
    "traveler": "MOHAMMAD ALI RAHIMI",
    "ticket_number": "87273428349",
    "issue_date": "25 May 2026",
    "from": "Istanbul Airport (IST, Turkey)",
    "to": "Imam Khomeini Intl (IKA, Iran)",
    "flight_date": "27 May 2026",
    "departure_time": "7:45",
    "arrival_time": "11:15",
    "pnr": "ABC123",
    "airline": "Caspian Airline",
    "flight_no": "CPN7903",
    "cabin": "Economy",
    "baggage": "25 KG",
    "duration": "03:00"
}

🧠 How It Works

  • Uses SimpleDocTemplate from ReportLab
  • Builds document elements (Paragraphs, Tables, Spacing)
  • Applies styling and layout via TableStyle
  • Outputs a structured PDF file

📌 Notes

  • This script generates a new PDF from structured data, not by editing existing PDFs.
  • Editing existing PDFs is significantly more complex due to embedded fonts and layout constraints.
  • Recommended approach in production systems: always generate documents from data, not modify existing ones.

📄 License

MIT License

Copyright (c) 2026 Seyyed Ali Mohammadiyeh (Max Base)

About

A simple Python utility to generate flight-style ticket PDFs using ReportLab. This project demonstrates how to structure and export travel-related documents programmatically.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages