- 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
130 lines
6.0 KiB
PowerShell
130 lines
6.0 KiB
PowerShell
# Quick Printer Configuration for 35mm x 25mm Labels
|
|
# This script opens printer preferences for manual configuration
|
|
|
|
param(
|
|
[string]$PrinterName = "Labels"
|
|
)
|
|
|
|
Write-Host "========================================" -ForegroundColor Cyan
|
|
Write-Host " Label Printer Size Configuration" -ForegroundColor Cyan
|
|
Write-Host "========================================" -ForegroundColor Cyan
|
|
Write-Host ""
|
|
|
|
# Check if printer exists
|
|
$printer = Get-Printer -Name $PrinterName -ErrorAction SilentlyContinue
|
|
|
|
if ($null -eq $printer) {
|
|
Write-Host "❌ ERROR: Printer '$PrinterName' not found!" -ForegroundColor Red
|
|
Write-Host ""
|
|
Write-Host "Available printers:" -ForegroundColor Yellow
|
|
Get-Printer | ForEach-Object { Write-Host " - $($_.Name)" }
|
|
Write-Host ""
|
|
|
|
$newName = Read-Host "Enter the correct printer name"
|
|
if ($newName) {
|
|
$PrinterName = $newName
|
|
$printer = Get-Printer -Name $PrinterName -ErrorAction SilentlyContinue
|
|
if ($null -eq $printer) {
|
|
Write-Host "❌ Printer still not found. Exiting." -ForegroundColor Red
|
|
exit 1
|
|
}
|
|
} else {
|
|
exit 1
|
|
}
|
|
}
|
|
|
|
Write-Host "✅ Found printer: $PrinterName" -ForegroundColor Green
|
|
Write-Host " Driver: $($printer.DriverName)" -ForegroundColor Gray
|
|
Write-Host ""
|
|
|
|
Write-Host "========================================" -ForegroundColor Cyan
|
|
Write-Host " Configuration Required" -ForegroundColor Cyan
|
|
Write-Host "========================================" -ForegroundColor Cyan
|
|
Write-Host ""
|
|
Write-Host "You need to configure the printer for:" -ForegroundColor Yellow
|
|
Write-Host ""
|
|
Write-Host " Paper Size: 35mm x 25mm (3.5cm x 2.5cm)" -ForegroundColor White
|
|
Write-Host " Orientation: Landscape" -ForegroundColor White
|
|
Write-Host " Quality: Highest/Best" -ForegroundColor White
|
|
Write-Host ""
|
|
|
|
Write-Host "Opening printer preferences dialog..." -ForegroundColor Cyan
|
|
Write-Host ""
|
|
Write-Host "In the dialog that opens:" -ForegroundColor Yellow
|
|
Write-Host " 1. Find 'Paper Size', 'Media', or 'Page Setup' tab" -ForegroundColor White
|
|
Write-Host " 2. Look for label size options:" -ForegroundColor White
|
|
Write-Host " - If you see '35mm x 25mm' → Select it" -ForegroundColor Green
|
|
Write-Host " - If not, look for 'Custom' option" -ForegroundColor Green
|
|
Write-Host " 3. For custom size:" -ForegroundColor White
|
|
Write-Host " - Width: 35mm (or 3.5cm / 1.38 inches)" -ForegroundColor Green
|
|
Write-Host " - Height: 25mm (or 2.5cm / 0.98 inches)" -ForegroundColor Green
|
|
Write-Host " 4. Set Orientation: Landscape" -ForegroundColor White
|
|
Write-Host " 5. Set Quality: Best/Highest/600 DPI" -ForegroundColor White
|
|
Write-Host " 6. Click 'Apply' then 'OK'" -ForegroundColor White
|
|
Write-Host ""
|
|
|
|
Write-Host "Press any key to open printer preferences..." -ForegroundColor Yellow
|
|
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
|
|
|
|
try {
|
|
# Method 1: Try printui.dll (more reliable for preferences)
|
|
Start-Process "rundll32.exe" -ArgumentList "printui.dll,PrintUIEntry /e /n `"$PrinterName`"" -Wait:$false
|
|
|
|
Write-Host ""
|
|
Write-Host "✅ Printer preferences dialog opened" -ForegroundColor Green
|
|
Write-Host ""
|
|
Write-Host "After configuring:" -ForegroundColor Cyan
|
|
Write-Host " 1. Close the preferences dialog" -ForegroundColor White
|
|
Write-Host " 2. Test by running: python test_quality.py" -ForegroundColor White
|
|
Write-Host " 3. Verify label prints on single 35mm x 25mm label" -ForegroundColor White
|
|
Write-Host ""
|
|
|
|
Write-Host "========================================" -ForegroundColor Cyan
|
|
Write-Host " Troubleshooting" -ForegroundColor Cyan
|
|
Write-Host "========================================" -ForegroundColor Cyan
|
|
Write-Host ""
|
|
Write-Host "If you can't find label size option:" -ForegroundColor Yellow
|
|
Write-Host ""
|
|
Write-Host "Option A - Check Printer Documentation:" -ForegroundColor White
|
|
Write-Host " Your printer: $($printer.DriverName)" -ForegroundColor Gray
|
|
Write-Host " Look for supported label sizes in manual" -ForegroundColor Gray
|
|
Write-Host ""
|
|
Write-Host "Option B - Use Printer's Software:" -ForegroundColor White
|
|
Write-Host " Many label printers come with design software" -ForegroundColor Gray
|
|
Write-Host " (e.g., Zebra Designer, Brother P-touch Editor)" -ForegroundColor Gray
|
|
Write-Host " Configure size there, then note the settings" -ForegroundColor Gray
|
|
Write-Host ""
|
|
Write-Host "Option C - Driver Update:" -ForegroundColor White
|
|
Write-Host " Download latest driver from manufacturer" -ForegroundColor Gray
|
|
Write-Host " Newer drivers often have better size options" -ForegroundColor Gray
|
|
Write-Host ""
|
|
Write-Host "Option D - Use Alternative Method:" -ForegroundColor White
|
|
Write-Host " Run: python print_with_size.py" -ForegroundColor Gray
|
|
Write-Host " This will attempt to set size programmatically" -ForegroundColor Gray
|
|
Write-Host ""
|
|
|
|
Write-Host "========================================" -ForegroundColor Cyan
|
|
Write-Host " Common Label Sizes (Reference)" -ForegroundColor Cyan
|
|
Write-Host "========================================" -ForegroundColor Cyan
|
|
Write-Host ""
|
|
Write-Host "If 35mm x 25mm is not available, try:" -ForegroundColor Yellow
|
|
Write-Host " • 40mm x 30mm (close match)" -ForegroundColor Gray
|
|
Write-Host " • 50mm x 30mm (slightly larger)" -ForegroundColor Gray
|
|
Write-Host " • 38mm x 25mm (common label size)" -ForegroundColor Gray
|
|
Write-Host ""
|
|
Write-Host "Note: Using different size will affect layout" -ForegroundColor Yellow
|
|
Write-Host ""
|
|
|
|
} catch {
|
|
Write-Host "❌ Error opening preferences: $_" -ForegroundColor Red
|
|
Write-Host ""
|
|
Write-Host "Alternative: Open manually" -ForegroundColor Yellow
|
|
Write-Host " 1. Open: Settings > Printers > $PrinterName" -ForegroundColor White
|
|
Write-Host " 2. Click: Manage > Printing preferences" -ForegroundColor White
|
|
Write-Host ""
|
|
}
|
|
|
|
Write-Host "Configuration script completed." -ForegroundColor Green
|
|
Write-Host "Press any key to exit..." -ForegroundColor DarkGray
|
|
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
|