Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Generador de PDF - Text to PDF Converter

A modern desktop application for converting plain text to beautifully formatted PDF documents using customizable templates powered by ReportLab.

Python PySide6 ReportLab License

Features

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 (á, é, í, ó, ú, ñ)

Screenshots

Main Application Window

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

Available Templates

  1. Moderno - Vibrant gradient header with clean typography
  2. Clásico - Traditional serif fonts with elegant styling
  3. Elegante - Sophisticated design with subtle gradients
  4. Minimalista - Ultra-clean layout with maximum whitespace

Quick Start

Installation

  1. Clone or download this repository

  2. Install Python dependencies:

    pip install -r requirements.txt
  3. Run the application:

    python src/main.py

Usage

Method 1: Load TXT File (Easiest!)

  1. Launch the application
  2. Click the green "📂 Cargar TXT" button
  3. Select your .txt file
  4. The text will load automatically and the title will be suggested
  5. Choose a template
  6. Click "Generar PDF"
  7. Save your PDF!

Method 2: Type or Paste Text

  1. Launch the application
  2. Type or paste your text into the editor
  3. Enter a document title (optional)
  4. Select a template from the dropdown
  5. Click "Generar PDF"
  6. Choose save location
  7. Your PDF is ready!

Project Structure

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

Requirements

  • Python 3.8+
  • PySide6 >= 6.6.0 - Qt-based GUI framework
  • ReportLab >= 4.0.0 - PDF generation library
  • Pillow >= 10.0.0 - Image processing

Creating Custom Templates

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
    }
}

Troubleshooting

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.

Documentation

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! Feel free to:

  • Add new templates
  • Improve the GUI
  • Fix bugs
  • Enhance documentation

Acknowledgments

  • PySide6 - Qt for Python
  • ReportLab - PDF generation library
  • Pillow - Python Imaging Library

About

Text to PDF convert with a modern GUI

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages