A modern desktop application for converting plain text to beautifully formatted PDF documents using customizable templates powered by ReportLab.
✨ Modern GUI - Built with PySide6 for a native, responsive interface
🎨 4 Professional Templates - Choose from Modern, Classic, Elegant, or Minimal designs
📂 Load TXT Files - Import .txt files directly with one click
📄 Pure Python - No external dependencies like GTK - works immediately on Windows!
⚡ Background Processing - Non-blocking PDF generation with progress feedback
🖼️ Live Preview - See template descriptions before generating
💾 Easy Export - Save PDFs anywhere with a simple file dialog
🌍 Spanish Support - Full support for Spanish characters (á, é, í, ó, ú, ñ)
The application features a clean, modern interface with:
- Large text editor with syntax highlighting
- Template selector with live descriptions
- Custom document title input
- Progress indicators during PDF generation
- Moderno - Vibrant gradient header with clean typography
- Clásico - Traditional serif fonts with elegant styling
- Elegante - Sophisticated design with subtle gradients
- Minimalista - Ultra-clean layout with maximum whitespace
-
Clone or download this repository
-
Install Python dependencies:
pip install -r requirements.txt
-
Run the application:
python src/main.py
- Launch the application
- Click the green "📂 Cargar TXT" button
- Select your .txt file
- The text will load automatically and the title will be suggested
- Choose a template
- Click "Generar PDF"
- Save your PDF!
- Launch the application
- Type or paste your text into the editor
- Enter a document title (optional)
- Select a template from the dropdown
- Click "Generar PDF"
- Choose save location
- Your PDF is ready!
txtopdf/
├── src/ # Source code
│ ├── main.py # Main application (PySide6 GUI)
│ ├── pdf_generator.py # PDF generation logic (ReportLab)
│ ├── template_manager.py # Template configuration manager
│ └── converter.py # Legacy converter (deprecated)
├── templates/ # HTML/CSS template metadata
│ ├── modern.html
│ ├── classic.html
│ ├── elegant.html
│ └── minimal.html
├── docs/ # Documentation
│ ├── GUIA_USUARIO.md # User guide (Spanish)
│ ├── LEEME.txt # Read me (Spanish)
│ ├── QUICKSTART.md # Quick start guide
│ └── SETUP.md # Detailed setup instructions
├── examples/ # Example text files
│ ├── ejemplo_carga.txt
│ ├── checklist_test.txt
│ ├── prueba_formato.txt
│ └── test_sample.txt
├── tests/ # Test scripts
│ ├── test_checklist.py
│ ├── test_formato_mejorado.py
│ ├── test_pdf_generation.py
│ └── test_txt_loading.py
├── .gitignore # Git ignore rules
├── LICENSE # MIT License
├── README.md # This file
└── requirements.txt # Python dependencies
- Python 3.8+
- PySide6 >= 6.6.0 - Qt-based GUI framework
- ReportLab >= 4.0.0 - PDF generation library
- Pillow >= 10.0.0 - Image processing
Templates use ReportLab configuration dictionaries. To add a new template, edit src/template_manager.py and add a new entry to the _template_metadata dictionary with styling configuration:
"your_template": {
"name": "Your Template Name",
"description": "Template description",
"preview": "preview.png",
"config": {
"header_color": "#667eea",
"title_font": "Helvetica-Bold",
"title_size": 28,
# ... more configuration options
}
}Application won't start?
- Verify Python version:
python --version - Ensure all dependencies are installed:
pip install -r requirements.txt - Check that you're running from the correct directory:
python src/main.py
PDF generation fails?
- Ensure you have write permissions to the output directory
- Check that the text content is not empty
- Verify template configuration is valid
See docs/SETUP.md for detailed troubleshooting steps.
- Quick Start Guide - Get started quickly
- Setup Guide - Detailed installation and setup
- User Guide - Complete user guide (Spanish)
- Read Me - Project overview (Spanish)
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Feel free to:
- Add new templates
- Improve the GUI
- Fix bugs
- Enhance documentation
- PySide6 - Qt for Python
- ReportLab - PDF generation library
- Pillow - Python Imaging Library