# 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: 1. **PDF is generated correctly** at 1200 DPI with vector fonts 2. **Printing process rasterizes** (converts to bitmap) the PDF 3. **Rasterization happens at LOW resolution** (150-300 DPI typically) 4. **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: ```python # 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:** 1. **GhostScript** (if installed) - BEST quality 2. SumatraPDF (fallback) - Good quality 3. ShellExecute (fallback) - Uses default PDF viewer 4. Open file (last resort) - Manual printing --- ## ๐Ÿš€ How to Get Best Quality ### **Option A: Install GhostScript (Recommended)** 1. **Download GhostScript:** - Go to: https://ghostscript.com/releases/gsdnld.html - Download: "GPL Ghostscript 10.04.0 for Windows (64 bit)" 2. **Install:** - Run installer - Use default installation path - No special configuration needed 3. **Test:** ```powershell python print_pdf_ghostscript.py ``` Should show: โœ… GhostScript found 4. **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: 1. **Open Printer Preferences:** ```powershell .\configure_label_size.ps1 ``` 2. **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" 3. **Disable Dithering:** - Look for "Dithering" or "Halftone" - Set to: **None** or **Off** 4. **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 ```powershell # 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 ```powershell 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 ```powershell 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 ```powershell # 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 ```powershell # 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: 1. **PrintQuality = 600**: Tells Windows to render at 600 DPI minimum 2. **TTOption = 2 (DMTT_BITMAP)**: Renders TrueType fonts as graphics (sharper) 3. **GhostScript -r1200**: Renders PDF at full 1200 DPI resolution 4. **TextAlphaBits=4**: Anti-aliasing for smooth text edges --- ## ๐ŸŽ“ Recommendations ### For Production Use: 1. **Install GhostScript** on all computers - One-time setup - Always best quality - No manual configuration needed 2. **Keep PDF backup enabled** - Review PDFs to confirm they look correct - PDFs are always high quality 3. **Test periodically** - Print quality can change after: - Windows updates - Driver updates - Printer hardware changes --- ## ๐Ÿ“ž Quick Reference ### If text is dotted: ```powershell # 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: ```powershell # 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