Skip to content

mdtc/PDF_Label_Maker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Label Maker

Overview

The Label Maker is a Python-based application designed to generate styled PDF labels from an Excel file. It uses the ReportLab library for PDF generation and provides a graphical user interface (GUI) for ease of use. The application supports adding logos, cursive titles, and other customizations to the labels.

Features

  • Generates 4x8 styled labels per page.
  • Reads data from an Excel file, treating the second row as the header.
  • Supports adding logos from a specified folder (logos/).
  • Automatically opens the generated PDF after creation.
  • Customizable fonts, sizes, and layout.

Requirements

  • Python 3.7 or higher
  • Required Python libraries:
    • pandas
    • tkinter
    • reportlab
    • Pillow

Installation

  1. Clone or download this repository.
  2. Install the required Python libraries using pip:
    pip install pandas pillow reportlab

Usage

  1. Place your Excel file in the same directory as the script or browse to it using the GUI.
  2. Ensure the Excel file has the following structure:
    • The first row contains a special value (e.g., a title for the labels).
    • The second row contains the column headers.
    • Columns should include:
      • # (Product Code)
      • Nombre (Product Name)
      • Lugar (Size or Location)
  3. Place logo images in the logos/ folder. The filenames should match the product names in the Excel file (case-insensitive, spaces ignored).
  4. Run the script:
    python label_maker.py
  5. Use the GUI to select the Excel file and generate the labels.
  6. The generated PDF will open automatically and be saved in the same directory as the script.

Hardcoded Values

  • Excel File Structure:
    • The first row is treated as a special value (e.g., title).
    • The second row is used as the header.
  • Label Layout:
    • 4 columns and 8 rows per page.
    • Margins: 0.05 inches.
    • Internal label margin: 0.12 inches.
  • Fonts:
    • Product Code: Times-Bold, size 12.
    • Product Name: Helvetica, size 14.
    • Cursive Title: Times-Italic, size 16.8 (calculated as 1.2x the name font size).
    • Size/Location: Helvetica-Bold, size 12.
  • Image Dimensions:
    • Logo width: 1.2 inches.
    • Logo height: calculated based on aspect ratio.
    • Border image height: 0.15 inches.

Folder Structure

  • label_maker.py: Main script.
  • logos/: Folder containing logo images.
  • Border.PNG: Image used for top and bottom borders of labels.
  • build/: Folder generated by PyInstaller (if used to create an executable).

Notes

  • If the logos/ folder is missing, it will be created automatically.
  • If a matching logo is not found, the title will be displayed in a cursive font instead.
  • The application is designed for Windows but can be adapted for other operating systems.

Troubleshooting

  • Error: Missing Dependencies: Ensure all required libraries are installed.
  • Error: Missing Files: Verify that the Excel file and Border.PNG are in the correct locations.
  • Error: Invalid Excel File: Ensure the file follows the required structure.

License

This project is licensed under the MIT License.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages