- 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
7.2 KiB
Print Quality Issue - Dotted/Pixelated Text Solution
🔍 Problem Identified
Issue: Text appears dotted/pixelated on printed labels (like dot-matrix printer output)
- PDF looks perfect on screen ✅
- But printed output has dotted text ❌
- Not smooth/sharp like expected
🎯 Root Cause
The problem is in the print pipeline, not the PDF:
- PDF is generated correctly at 1200 DPI with vector fonts
- Printing process rasterizes (converts to bitmap) the PDF
- Rasterization happens at LOW resolution (150-300 DPI typically)
- Result: Dotted text instead of smooth vectors
Why This Happens:
PDF (Vector) → SumatraPDF → Low DPI Raster → Printer Driver → Dotted Output
↑ Problem here! Converts to low-res bitmap
The printer receives a bitmap image at low resolution, not the original vector graphics.
✅ Solutions Implemented
Solution 1: Printer Quality Configuration (CRITICAL)
Updated print_label.py to configure printer for HIGH QUALITY before printing:
# New function: configure_printer_quality()
- Sets PrintQuality = 600 DPI (not draft mode)
- Sets TTOption = DMTT_BITMAP (sharper text)
- Configures paper size to 35mm x 25mm
This is now automatic - runs before every print job.
Solution 2: GhostScript Printing (BEST QUALITY)
Added GhostScript as primary printing method:
Why GhostScript is Better:
- ✅ Maintains vector graphics (not rasterized)
- ✅ Renders directly to printer at 1200 DPI
- ✅ Perfect text anti-aliasing
- ✅ No intermediate bitmap conversion
Printing Priority:
- GhostScript (if installed) - BEST quality
- SumatraPDF (fallback) - Good quality
- ShellExecute (fallback) - Uses default PDF viewer
- Open file (last resort) - Manual printing
🚀 How to Get Best Quality
Option A: Install GhostScript (Recommended)
-
Download GhostScript:
- Go to: https://ghostscript.com/releases/gsdnld.html
- Download: "GPL Ghostscript 10.04.0 for Windows (64 bit)"
-
Install:
- Run installer
- Use default installation path
- No special configuration needed
-
Test:
python print_pdf_ghostscript.pyShould show: ✅ GhostScript found
-
Print:
- Just run your GUI normally
- It will automatically use GhostScript
- You'll see: "Using GhostScript for high-quality vector printing..."
Result: Perfect, sharp text with no dotting!
Option B: Configure Printer (Without GhostScript)
If you can't install GhostScript, the code now automatically configures printer quality.
But you should also manually check:
-
Open Printer Preferences:
.\configure_label_size.ps1 -
Set Quality to HIGHEST:
- Look for "Print Quality" or "Resolution"
- Set to: 600 DPI or Best or High Quality
- NOT "Draft" or "Normal" or "Economy"
-
Disable Dithering:
- Look for "Dithering" or "Halftone"
- Set to: None or Off
-
Set Graphics Mode:
- Look for "Graphics" or "Text Quality"
- Set to: Vector or High Quality
📊 Quality Comparison
| Method | Text Quality | Speed | Installation |
|---|---|---|---|
| GhostScript | ⭐⭐⭐⭐⭐ Perfect | Fast | Requires install |
| SumatraPDF + Quality Config | ⭐⭐⭐⭐ Very Good | Fast | No install needed |
| SumatraPDF (default) | ⭐⭐ Dotted | Fastest | No install needed |
🧪 Testing
Test 1: Check Current Method
# Start GUI
.\venv\Scripts\python.exe label_printer_gui.py
# Watch console output:
# Should say one of:
# "Using GhostScript for high-quality vector printing..." ← BEST
# "Label sent to printer via SumatraPDF..." ← OK
Test 2: Verify GhostScript
python print_pdf_ghostscript.py
Expected output:
✅ GhostScript found at: C:\Program Files\gs\gs10.04.0\bin\gswin64c.exe
GhostScript is available for high-quality PDF printing
Test 3: Print Test Label
python test_quality.py
Check printed output:
- ✅ Text should be smooth and sharp
- ✅ No dotted appearance
- ✅ Crisp edges on checkmark image
- ✅ Professional quality
🔧 Troubleshooting
Still seeing dotted text?
Check 1: Printer Driver Quality
# Run configuration script
.\configure_printer_quality.ps1
# Manually verify:
# Settings > Printers > Labels > Printing preferences
# Quality = HIGHEST (600 DPI or more)
Check 2: Print Method Used
Look at console output when printing:
- GOOD: "Using GhostScript..."
- OK: "Printer configured: 35x25mm @ HIGH QUALITY"
- BAD: "Could not configure printer quality"
If you see "Could not configure printer quality":
- Printer driver doesn't support programmatic quality changes
- MUST configure manually in printer preferences
Check 3: Label Material
- Wrong: Plain paper (not designed for thermal printing)
- Right: Thermal labels (heat-sensitive or transfer)
Wrong label material can cause poor quality even with correct settings.
Check 4: Printer Hardware
# Print self-test from printer
# (Usually hold button while powering on)
If self-test also shows dotted text:
- Printer may be in draft mode
- Check printer's physical control panel
- Look for "Quality" or "Darkness" dial/setting
- May need firmware update
📝 Technical Details
Why Dotted Text Happens:
Normal printing workflow:
PDF → Printer Driver → Sharp output
What was happening:
PDF (vector, 1200 DPI)
↓
SumatraPDF rasterizes at LOW DPI (150-300)
↓
Bitmap sent to printer
↓
Printer prints bitmap → DOTTED TEXT
What we fixed:
Method 1 (GhostScript):
PDF (vector) → GhostScript → Printer @ 1200 DPI → SHARP TEXT
Method 2 (Quality Config):
PDF → Configure printer to 600 DPI → SumatraPDF → Better quality
Key Settings:
- PrintQuality = 600: Tells Windows to render at 600 DPI minimum
- TTOption = 2 (DMTT_BITMAP): Renders TrueType fonts as graphics (sharper)
- GhostScript -r1200: Renders PDF at full 1200 DPI resolution
- TextAlphaBits=4: Anti-aliasing for smooth text edges
🎓 Recommendations
For Production Use:
-
Install GhostScript on all computers
- One-time setup
- Always best quality
- No manual configuration needed
-
Keep PDF backup enabled
- Review PDFs to confirm they look correct
- PDFs are always high quality
- Test periodically
- Print quality can change after:
- Windows updates
- Driver updates
- Printer hardware changes
- Print quality can change after:
📞 Quick Reference
If text is dotted:
# 1. Install GhostScript (best solution)
# Download from: https://ghostscript.com/releases/gsdnld.html
# 2. Or configure printer manually
.\configure_label_size.ps1
# Set quality to HIGHEST
# 3. Test
python test_quality.py
Check print method:
# Look for this in console output:
"Using GhostScript..." # ← You have best quality!
"Printer configured: 35x25mm @ HIGH QUALITY" # ← Good
Last Updated: February 13, 2026
Status: Multiple solutions implemented - GhostScript recommended for best quality