# Saudi Thermal Printer Invoice - Setup Guide

## ✅ Kya Banaya Gaya Hai

Maine aapke liye **3 Saudi invoice designs** banaye hain:

### 1. Saudi Invoice (Normal Printer - A4)
- **File:** `saudi-invoice.blade.php`
- **Use:** Normal printers, A4 paper
- **Features:** Full design with colors, large QR code, bilingual

### 2. Saudi Thermal 80mm ⭐ NEW!
- **File:** `saudi-thermal-80mm.blade.php`
- **Use:** 80mm thermal printers
- **Features:** Compact, optimized for thermal, QR code

### 3. Saudi Thermal 58mm ⭐ NEW!
- **File:** `saudi-thermal-58mm.blade.php`
- **Use:** 58mm thermal printers (small)
- **Features:** Ultra-compact, minimal design, QR code

## 🚀 Kaise Use Karein

### Step 1: Cache Clear Karein

```bash
php artisan cache:clear
php artisan config:clear
php artisan view:clear
```

### Step 2: Invoice Layout Settings

1. **Browser mein jaaein:** Settings → Invoice Layouts
2. **Edit** ya **Add** karein
3. **Design dropdown** mein ab 3 Saudi options hain:
   - **Saudi Invoice - فاتورة سعودية** (for normal printer)
   - **Saudi Thermal 80mm - فاتورة حرارية** (recommended for 80mm) ⭐
   - **Saudi Thermal 58mm - فاتورة حرارية** (recommended for 58mm) ⭐

### Step 3: Apna Printer Type Select Karein

**Agar 80mm thermal printer hai:**
- Design: "Saudi Thermal 80mm"
- Width: 80mm
- Compact layout
- QR code: 35mm x 35mm

**Agar 58mm thermal printer hai:**
- Design: "Saudi Thermal 58mm"
- Width: 58mm
- Ultra-compact layout
- QR code: 25mm x 25mm

**Agar normal printer hai (A4):**
- Design: "Saudi Invoice"
- Full page layout
- QR code: 200mm x 200mm

### Step 4: Settings Configure Karein

**Common Settings (All Designs):**
- ☑ Show Logo
- ☑ Show QR Code
- ☑ Show Business Name
- ☑ Show Location Name
- QR Code Fields: business_name, tax_1, invoice_no, total_amount

**Thermal Specific:**
- Font size: Automatically optimized
- Paper width: Auto-detected
- Print margins: Minimal

### Step 5: Test Print

1. **POS Pro** se sale karein
2. **Invoice** print hoga
3. **Check karein:**
   - Text readable hai?
   - QR code scan ho raha hai?
   - Layout proper fit ho raha hai?

## 📏 Design Specifications

### Saudi Thermal 80mm:
```
Width: 80mm
Font Size: 9-11px
QR Code: 35mm x 35mm
Margins: 3-5mm
Line Height: 1.3-1.4
```

**Features:**
- ✅ Company logo (max 50mm wide)
- ✅ Bilingual headers (Arabic/English)
- ✅ Tax banner with VAT number
- ✅ Compact items table
- ✅ Clear totals section
- ✅ QR code for verification
- ✅ Thank you message

### Saudi Thermal 58mm:
```
Width: 58mm
Font Size: 8-9px
QR Code: 25mm x 25mm
Margins: 3mm
Line Height: 1.3
```

**Features:**
- ✅ Company logo (max 35mm wide)
- ✅ Minimal bilingual text
- ✅ Tax info banner
- ✅ Simplified items list
- ✅ Essential totals only
- ✅ Compact QR code
- ✅ Short thank you

## 🎨 Design Comparison

| Feature | Normal (A4) | Thermal 80mm | Thermal 58mm |
|---------|-------------|--------------|--------------|
| Width | 210mm | 80mm | 58mm |
| Colors | ✅ Green theme | ⚫ Black only | ⚫ Black only |
| Logo Size | Large (200mm) | Medium (50mm) | Small (35mm) |
| QR Code | 200x200mm | 35x35mm | 25x25mm |
| Font Size | 13-16px | 9-11px | 8-9px |
| Details | Full | Compact | Minimal |
| Best For | A4 printer | 80mm thermal | 58mm thermal |

## 🔧 Printer Settings

### 80mm Thermal Printer:
```
Paper Width: 80mm
Paper Type: Thermal
Print Speed: Normal
Density: Medium-High
Auto-cut: Enabled
```

### 58mm Thermal Printer:
```
Paper Width: 58mm
Paper Type: Thermal
Print Speed: Normal
Density: High
Auto-cut: Enabled
```

## ✅ Testing Checklist

**80mm Thermal:**
- [ ] Logo clearly visible?
- [ ] Text readable (not too small)?
- [ ] QR code scannable?
- [ ] All items fit in width?
- [ ] Totals properly aligned?
- [ ] No text cutoff?
- [ ] Paper cuts properly?

**58mm Thermal:**
- [ ] Logo visible (may be small)?
- [ ] Text readable?
- [ ] QR code scannable?
- [ ] Items fit (may wrap)?
- [ ] Totals visible?
- [ ] No horizontal overflow?
- [ ] Clean paper cut?

## 🎯 Optimization Tips

### For Better Print Quality:

**80mm:**
- Logo: 50mm x 20mm max
- Font: 10-11px for body
- QR: 35mm works best
- Margins: 5mm sides

**58mm:**
- Logo: 35mm x 15mm max
- Font: 8-9px for body
- QR: 25mm recommended
- Margins: 3mm sides

### For Faster Printing:

- Reduce QR code size if not needed
- Minimize logo size
- Use simple fonts
- Reduce line spacing

## 🔄 Switching Between Designs

**From Normal to Thermal:**
```sql
UPDATE invoice_layouts 
SET design = 'saudi-thermal-80mm' 
WHERE id = YOUR_LAYOUT_ID;
```

**From 80mm to 58mm:**
```sql
UPDATE invoice_layouts 
SET design = 'saudi-thermal-58mm' 
WHERE id = YOUR_LAYOUT_ID;
```

**Back to Normal:**
```sql
UPDATE invoice_layouts 
SET design = 'saudi-invoice' 
WHERE id = YOUR_LAYOUT_ID;
```

## 📱 Mobile/Portable Printers

Agar aap mobile thermal printer use kar rahe hain:

**Recommended:** Saudi Thermal 58mm
- Portable printers usually 58mm hote hain
- Battery efficient
- Fast printing
- Compact receipts

## 🆘 Troubleshooting

### Text Cut Off Ho Raha Hai?

**80mm:**
- Check printer width setting
- Reduce font size to 9px
- Reduce margins

**58mm:**
- Use 58mm design (not 80mm)
- Font already minimal (8px)
- Check printer paper width

### QR Code Scan Nahi Ho Raha?

**Solution:**
- Increase QR code size
- Check printer density setting
- Clean printer head
- Use better quality paper

### Logo Blur Hai?

**Solution:**
- Use smaller logo file
- Increase printer density
- Use PNG format
- Reduce logo size in design

### Print Slow Hai?

**Solution:**
- Reduce QR code size
- Remove logo if not needed
- Use faster print speed setting
- Check printer connection

## 📋 Quick Reference

**Available Designs:**
1. `saudi-invoice` - Normal printer (A4)
2. `saudi-thermal-80mm` - 80mm thermal ⭐
3. `saudi-thermal-58mm` - 58mm thermal ⭐

**Select in UI:**
Settings → Invoice Layouts → Design dropdown

**Or via SQL:**
```sql
UPDATE invoice_layouts SET design = 'saudi-thermal-80mm' WHERE id = 1;
```

**Clear Cache:**
```bash
php artisan cache:clear && php artisan view:clear
```

## 🎉 Summary

**3 Saudi Designs Available:**
- ✅ Normal (A4) - Full featured
- ✅ Thermal 80mm - Compact
- ✅ Thermal 58mm - Ultra-compact

**All Include:**
- Saudi theme
- Bilingual (Arabic/English)
- QR code
- Tax information
- Professional layout

**Choose Based On:**
- Printer type
- Paper width
- Print speed needs
- Detail requirements

**Bas cache clear karein aur apna design select karein!** 🎊
