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.
- Generate structured flight ticket PDFs
- Fully customizable input data (name, route, dates, etc.)
- Clean table-based layout
- Lightweight and dependency-minimal
- Built with
reportlab
pdf-flight-ticket-generator/
│
├── generate.py # Main script to generate PDF
├── sample_flight_ticket.pdf # Example output
├── README.md
└── LICENSE
- Python 3.x
- reportlab
Install dependency:
pip install reportlabRun the script:
python generate.pyThis will generate:
sample_flight_ticket.pdf
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"
}- Uses
SimpleDocTemplatefrom ReportLab - Builds document elements (Paragraphs, Tables, Spacing)
- Applies styling and layout via
TableStyle - Outputs a structured PDF file
- 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.
MIT License
Copyright (c) 2026 Seyyed Ali Mohammadiyeh (Max Base)