Clean repository and update .gitignore
- Remove build artifacts from git tracking (build/, dist/, __pycache__/, *.spec) - Updated .gitignore to properly exclude generated files - Added old_code/ documentation folder - Updated sample_data.txt to show new 5-field format - Exclude user-specific conf/app.conf from tracking
This commit is contained in:
153
old_code/README.md
Normal file
153
old_code/README.md
Normal file
@@ -0,0 +1,153 @@
|
||||
# Adaptronic Label Printer
|
||||
|
||||
Thermal label printing application with customizable SVG templates for 35mm x 25mm labels.
|
||||
|
||||
## Features
|
||||
|
||||
- 🎨 **Customizable Layouts** - SVG template system for flexible label design
|
||||
- 📄 **High-Quality PDFs** - 1200 DPI output with automatic backup
|
||||
- 🖨️ **Silent Printing** - SumatraPDF integration for automatic printing
|
||||
- 📊 **Variable Support** - Dynamic text replacement ({Article}, {NrArt}, {Serial})
|
||||
- 💾 **Automatic Backup** - All labels saved to pdf_backup/ with timestamps
|
||||
- 🔍 **File Monitoring** - Watches check.txt for automatic label generation
|
||||
|
||||
## Quick Start
|
||||
|
||||
### Install Dependencies
|
||||
|
||||
```powershell
|
||||
# Activate virtual environment
|
||||
venv\Scripts\activate
|
||||
|
||||
# Install requirements
|
||||
pip install -r requirements_gui.txt
|
||||
```
|
||||
|
||||
### Run the Application
|
||||
|
||||
```powershell
|
||||
python label_printer_gui.py
|
||||
```
|
||||
|
||||
## Label Specifications
|
||||
|
||||
- **Size**: 35mm × 25mm (landscape)
|
||||
- **Format**: Thermal labels (Citizen CTS-310, Zebra ZD420/ZD421)
|
||||
- **Template**: `conf/label_template.svg`
|
||||
- **Data Format**: Semicolon-separated (COMANDA;NR_ART;SERIAL)
|
||||
|
||||
## File Structure
|
||||
|
||||
```
|
||||
adaptronic_label-printer/
|
||||
├── label_printer_gui.py # Main GUI application
|
||||
├── print_label.py # Printing logic
|
||||
├── print_label_pdf.py # PDF generation with SVG support
|
||||
├── requirements_gui.txt # Dependencies
|
||||
├── conf/
|
||||
│ ├── label_template.svg # Customizable label layout
|
||||
│ └── app.conf # Application settings
|
||||
├── pdf_backup/ # Auto-saved label PDFs
|
||||
├── logs/ # Print logs
|
||||
└── old_code/ # Legacy scripts (archived)
|
||||
```
|
||||
|
||||
## Customizing Labels
|
||||
|
||||
Edit `conf/label_template.svg` to change the layout. Use these variables:
|
||||
- `{Article}` - Article/Command number
|
||||
- `{NrArt}` - Article number
|
||||
- `{Serial}` - Serial number
|
||||
|
||||
After editing the SVG, labels will automatically use the new layout.
|
||||
|
||||
## Printing
|
||||
|
||||
### Silent Printing (Recommended)
|
||||
|
||||
Labels print automatically using SumatraPDF. No dialogs or manual steps required.
|
||||
|
||||
**SumatraPDF Locations Checked:**
|
||||
1. Bundled with exe (for deployments)
|
||||
2. `SumatraPDF/` folder in project directory
|
||||
3. System installations (`C:\Program Files\SumatraPDF\`)
|
||||
|
||||
### PDF Printer Testing
|
||||
|
||||
Select "Microsoft Print to PDF" or similar PDF printer to test label generation without physical printing.
|
||||
|
||||
### Printer Configuration
|
||||
|
||||
For thermal printers, configure in Windows Printer Preferences:
|
||||
- **Media Type**: LABELS (enables gap sensor)
|
||||
- **Paper Size**: 35mm x 25mm or Custom
|
||||
- **Orientation**: Landscape
|
||||
- **Darkness**: 10-15 (medium)
|
||||
- **Speed**: Medium (4-6 in/sec)
|
||||
|
||||
## Dependencies
|
||||
|
||||
Core:
|
||||
- `reportlab` - PDF generation
|
||||
- `svglib` - SVG to PDF conversion
|
||||
- `cairosvg` - Alternative SVG renderer
|
||||
- `watchdog` - File monitoring
|
||||
|
||||
GUI:
|
||||
- `kivy` - Cross-platform interface
|
||||
|
||||
Optional:
|
||||
- `pywin32` - Windows printer enumeration
|
||||
- `pycups` - Linux printing support
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Labels Print on Continuous Roll
|
||||
|
||||
**Cause**: Printer Media Type set to "Continuous" instead of "LABELS"
|
||||
**Fix**: Change to "LABELS" in printer preferences
|
||||
|
||||
### Dotted or Pixelated Text
|
||||
|
||||
**Cause**: Low darkness setting or draft mode
|
||||
**Fix**: Increase darkness to 12-15, ensure quality mode enabled
|
||||
|
||||
### PDF Not Printing Automatically
|
||||
|
||||
**Cause**: SumatraPDF not found
|
||||
**Fix**: Install SumatraPDF or place in project folder
|
||||
|
||||
## Technical Details
|
||||
|
||||
### PDF Generation
|
||||
- **Resolution**: 1200 DPI
|
||||
- **Compression**: None (maximum quality)
|
||||
- **Font Size**: 8pt (optimized for 35mm labels)
|
||||
- **Format**: ReportLab with SVG embedding
|
||||
|
||||
### Print Workflow
|
||||
1. Monitor `C:\Users\Public\Documents\check.txt` for changes
|
||||
2. Parse semicolon-separated data
|
||||
3. Replace variables in SVG template
|
||||
4. Convert to high-quality PDF (35mm × 25mm)
|
||||
5. Auto-save to `pdf_backup/`
|
||||
6. Silent print via SumatraPDF
|
||||
|
||||
## Building Executable
|
||||
|
||||
```powershell
|
||||
python build_exe.py
|
||||
```
|
||||
|
||||
Output: `dist/LabelPrinter.exe`
|
||||
|
||||
## Support
|
||||
|
||||
- Tested on Windows 10/11
|
||||
- Compatible with Citizen CTS-310, Zebra ZD420/ZD421
|
||||
- Based on proven label printer architecture
|
||||
|
||||
---
|
||||
|
||||
**Status**: Production Ready ✅
|
||||
**Last Updated**: February 2026
|
||||
Reference in New Issue
Block a user