PHPackages                             6amtech/laravel-electron-printing - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. 6amtech/laravel-electron-printing

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

6amtech/laravel-electron-printing
=================================

Silent background printing service for Laravel using Electron. Print HTML, Blade views, URLs, and PDFs to any printer without user interaction. Perfect for POS, restaurants, and e-commerce.

v1.0.0(8mo ago)232MITHTMLPHP ^7.4|^8.0|^8.1|^8.2|^8.3CI passing

Since Oct 19Pushed 8mo agoCompare

[ Source](https://github.com/mainulBUBT/laravel-electron-printing)[ Packagist](https://packagist.org/packages/6amtech/laravel-electron-printing)[ Docs](https://github.com/mainulBUBT/laravel-electron-printing)[ RSS](/packages/6amtech-laravel-electron-printing/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (4)Versions (2)Used By (0)

Laravel Electron Printing
=========================

[](#laravel-electron-printing)

[![Latest Version on Packagist](https://camo.githubusercontent.com/b808161751eadacfd6e78f5db42e2585ae7244fa73c8b557b23145a8b6681422/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f36616d746563682f6c61726176656c2d656c656374726f6e2d7072696e74696e672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/6amtech/laravel-electron-printing)[![Total Downloads](https://camo.githubusercontent.com/ff48c4d92e57f68e2e289ef3c61bba46aaaef76099f8bb57459806c0e032af18/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f36616d746563682f6c61726176656c2d656c656374726f6e2d7072696e74696e672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/6amtech/laravel-electron-printing)[![GitHub Tests Action Status](https://camo.githubusercontent.com/73eef6d16213a7de81eae7dff5b3c384acf496eb7c1a391e3c91121d15961d52/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6d61696e756c425542542f6c61726176656c2d656c656374726f6e2d7072696e74696e672f74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/mainulBUBT/laravel-electron-printing/actions)[![License](https://camo.githubusercontent.com/1954f973df0e1f1f9f1dc2665dd586fbb9e6cbb7a5fb42b62863ddd27bf08a17/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6d61696e756c425542542f6c61726176656c2d656c656374726f6e2d7072696e74696e672e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)

🖨️ **Silent background printing for Laravel** - Print HTML, Blade views, URLs, and PDFs directly to any printer without user interaction.

Perfect for **POS systems**, **restaurants**, **warehouses**, **e-commerce**, and any application requiring automated printing.

---

⚡ Quick Start
-------------

[](#-quick-start)

```
# 1. Install package
composer require 6amtech/laravel-electron-printing

# 2. Run install command
php artisan electron-printing:install

# 3. Configure .env
PRINT_SERVICE_ENABLED=true
PRINT_SERVICE_URL=http://localhost:3000
PRINT_USE_WEBSOCKET=false
PRINT_BROADCAST_CHANNEL=printing

# 4. Start Electron service
cd electron-print-service
npm install
npm start
```

**Print in your Laravel app:**

```
use LaravelElectronPrinting\Facades\ElectronPrint;

ElectronPrint::printView('receipt', ['order' => $order], null, 'thermal_80mm');
```

---

📦 Installation
--------------

[](#-installation)

### Step 1: Install Package

[](#step-1-install-package)

```
composer require 6amtech/laravel-electron-printing
```

### Step 2: Run Install Command

[](#step-2-run-install-command)

```
php artisan electron-printing:install
```

This command will:

- Publish the config file to `config/electron-printing.php`
- Publish the Electron app to `electron-print-service/`
- Show you the required `.env` configuration

### Step 3: Configure Environment

[](#step-3-configure-environment)

Add these to your `.env` file:

```
PRINT_SERVICE_ENABLED=true
PRINT_SERVICE_URL=http://localhost:3000
PRINT_USE_WEBSOCKET=false
PRINT_BROADCAST_CHANNEL=printing
PRINT_MAX_PAYLOAD_SIZE=50
```

### Step 4: Install Printer Drivers

[](#step-4-install-printer-drivers)

**⚠️ Important:** You must install the genuine printer drivers on the machine running the Electron service.

- **Thermal Printers:** Install manufacturer drivers (EPSON, Star, etc.)
- **Standard Printers:** Install from manufacturer website
- **Network Printers:** Configure network connection first

### Step 5: Start the Electron Service

[](#step-5-start-the-electron-service)

#### Option A: Run from Source (Development)

[](#option-a-run-from-source-development)

```
cd electron-print-service
npm install
npm start
```

The service will:

- Start on `http://localhost:3000`
- Run in the background with a system tray icon
- Auto-start on system boot (optional)

#### Option B: Build Standalone App (Production)

[](#option-b-build-standalone-app-production)

If you want to distribute a ready-to-use application without requiring Node.js:

**Build for your platform:**

```
cd electron-print-service

# For macOS
npm run build:mac

# For Windows
npm run build:win

# For Linux
npm run build:linux

# For all platforms (requires macOS)
npm run build:all
```

**Built apps will be in:** `electron-print-service/dist/`

**Installation:**

- **macOS:**

    - Open `6amTech Printing Service-1.0.0-mac.dmg`
    - Drag app to Applications folder
    - Open from Applications (right-click → Open first time)
- **Windows:**

    - Run `6amTech Printing Service Setup 1.0.0.exe`
    - Follow installer wizard
    - App will auto-start on system boot
- **Linux:**

    - Install `.deb`: `sudo dpkg -i 6amTech-Printing-Service-1.0.0.deb`
    - Or run `.AppImage` directly (no installation needed)

**Note:** Built apps don't require Node.js or npm to be installed on the target machine.

#### Remote/Network Setup (Different Machine)

[](#remotenetwork-setup-different-machine)

**On the machine with printers connected:**

1. **Edit config** (`electron-print-service/config.json`):

```
{
  "listenIP": "0.0.0.0",
  "port": 3000
}
```

2. **Start the service:**

```
cd electron-print-service
npm install
npm start
```

3. **Note the machine's IP address:**

```
# Windows
ipconfig

# macOS/Linux
ifconfig
# or
ip addr show
```

**On your Laravel server:**

Update `.env` with the remote machine's IP:

```
PRINT_SERVICE_URL=http://192.168.1.100:3000
```

**Firewall Configuration:**

- Allow incoming connections on port 3000
- Windows: `Windows Defender Firewall → Allow an app`
- macOS: `System Preferences → Security & Privacy → Firewall`
- Linux: `sudo ufw allow 3000`

---

🚀 Usage
-------

[](#-usage)

### Basic Printing

[](#basic-printing)

```
use LaravelElectronPrinting\Facades\ElectronPrint;

// Print HTML
ElectronPrint::printHtml('Hello World');

// Print Blade view
ElectronPrint::printView('receipt', ['order' => $order]);

// Print to specific printer
ElectronPrint::printView('receipt', $data, 'EPSON TM-T88V');
```

### Using Print Profiles

[](#using-print-profiles)

Pre-configured profiles in `config/electron-printing.php`:

```
// Thermal 80mm receipt
ElectronPrint::printView('receipt', $data, null, 'thermal_80mm');

// Thermal 58mm receipt
ElectronPrint::printView('receipt', $data, null, 'thermal_58mm');

// A4 document
ElectronPrint::printView('invoice', $data, null, 'a4');

// A4 landscape
ElectronPrint::printView('report', $data, null, 'a4_landscape');

// Label printer
ElectronPrint::printView('label', $data, null, 'label');
```

### Custom Print Options

[](#custom-print-options)

```
ElectronPrint::printView('receipt', $data, null, [
    'pageSize' => ['width' => 80000, 'height' => 297000],
    'marginsType' => 1,
    'printBackground' => true,
    'scaleFactor' => 100
]);
```

### PDF Printing

[](#pdf-printing)

```
// From file
ElectronPrint::printPdfFile(storage_path('app/invoice.pdf'));

// From URL
ElectronPrint::printPdfUrl('https://example.com/invoice.pdf');

// From Base64
ElectronPrint::printPdfBase64($base64String);

// With profile
ElectronPrint::printPdfFile(storage_path('app/invoice.pdf'), null, 'a4');
```

### Print from URL

[](#print-from-url)

```
ElectronPrint::printUrl('https://example.com/receipt');
```

### Get Available Printers

[](#get-available-printers)

```
$printers = ElectronPrint::getPrinters();
// Returns: ['EPSON TM-T88V', 'HP LaserJet', ...]
```

### Check Service Health

[](#check-service-health)

```
if (ElectronPrint::isHealthy()) {
    // Service is running
}
```

---

⚙️ Configuration
----------------

[](#️-configuration)

### Environment Variables

[](#environment-variables)

```
# Enable/disable printing
PRINT_SERVICE_ENABLED=true

# Electron service URL (local or remote)
PRINT_SERVICE_URL=http://localhost:3000

# Request timeout (seconds)
PRINT_SERVICE_TIMEOUT=30

# Max payload size for large PDFs (MB)
PRINT_MAX_PAYLOAD_SIZE=50

# Default printer (leave empty for system default)
PRINT_DEFAULT_PRINTER=

# WebSocket mode (optional)
PRINT_USE_WEBSOCKET=false
PRINT_BROADCAST_CHANNEL=printing

# Logging
PRINT_LOGGING_ENABLED=true
PRINT_LOG_CHANNEL=daily
```

### Custom Print Profiles

[](#custom-print-profiles)

Edit `config/electron-printing.php`:

```
'profiles' => [
    'my_custom_printer' => [
        'pageSize' => ['width' => 80000, 'height' => 297000],
        'marginsType' => 1,
        'printBackground' => true,
        'scaleFactor' => 100,
    ],
],
```

Use it:

```
ElectronPrint::printView('receipt', $data, null, 'my_custom_printer');
```

### Electron Service Configuration

[](#electron-service-configuration)

Edit `electron-print-service/config.json`:

```
{
  "port": 3000,
  "listenIP": "0.0.0.0",
  "maxPayloadSize": 50,
  "websocket": {
    "enabled": false,
    "host": "https://your-domain.com",
    "auth": {}
  }
}
```

---

🌐 Network Printing Setup
------------------------

[](#-network-printing-setup)

### Scenario 1: Laravel + Electron on Same Machine

[](#scenario-1-laravel--electron-on-same-machine)

```
PRINT_SERVICE_URL=http://localhost:3000
```

### Scenario 2: Laravel on Server, Electron on Workstation

[](#scenario-2-laravel-on-server-electron-on-workstation)

**Workstation (with printers):**

- IP: `192.168.1.100`
- Edit `electron-print-service/config.json`: ```
    { "listenIP": "0.0.0.0", "port": 3000 }
    ```
- Start service: `npm start`

**Laravel Server:**

```
PRINT_SERVICE_URL=http://192.168.1.100:3000
```

### Scenario 3: Multiple Workstations

[](#scenario-3-multiple-workstations)

Each workstation runs its own Electron service:

**Workstation 1 (Kitchen):**

```
{ "listenIP": "0.0.0.0", "port": 3000 }
```

**Workstation 2 (Counter):**

```
{ "listenIP": "0.0.0.0", "port": 3001 }
```

**Laravel:**

```
// Kitchen printer
ElectronPrint::printView('kitchen-order', $data, 'Kitchen Printer', 'thermal_80mm');

// Counter printer (different service)
$counterService = new ElectronPrintService('http://192.168.1.101:3001');
$counterService->printView('receipt', $data, 'Receipt Printer', 'thermal_80mm');
```

---

📚 API Reference
---------------

[](#-api-reference)

```
use LaravelElectronPrinting\Facades\ElectronPrint;

// Print methods
ElectronPrint::printHtml($html, $printer, $options)
ElectronPrint::printView($view, $data, $printer, $options)
ElectronPrint::printUrl($url, $printer, $options)
ElectronPrint::printPdfFile($path, $printer, $options)
ElectronPrint::printPdfUrl($url, $printer, $options)
ElectronPrint::printPdfBase64($base64, $printer, $options)

// Utility
ElectronPrint::getPrinters()  // Returns array of printer names
ElectronPrint::isHealthy()    // Returns true if service running

// All methods return: ['success' => bool, 'message' => string]
```

---

🧪 Testing
---------

[](#-testing)

```
# Test the installation
php artisan electron-printing:test

# Run package tests
composer test
```

---

🐛 Troubleshooting
-----------------

[](#-troubleshooting)

### Service Not Connecting

[](#service-not-connecting)

**Error:** `Print service error: Connection refused`

**Solutions:**

1. Check if Electron service is running: ```
    curl http://localhost:3000/health
    ```
2. Verify `PRINT_SERVICE_URL` in `.env`
3. Check firewall settings
4. For network printing, ensure `listenIP` is `0.0.0.0`

### Printer Not Found

[](#printer-not-found)

**Error:** Printer name not recognized

**Solutions:**

1. Get available printers: ```
    dd(ElectronPrint::getPrinters());
    ```
2. Use exact printer name from the list
3. Install printer drivers on the machine running Electron service
4. Use `null` for system default printer

### Payload Too Large

[](#payload-too-large)

**Error:** `413 Payload Too Large`

**Solution:**

```
PRINT_MAX_PAYLOAD_SIZE=100  # Increase to 100MB
```

Restart both Laravel and Electron service.

### Print Quality Issues

[](#print-quality-issues)

**Solutions:**

1. Use correct profile for your printer type
2. Adjust `scaleFactor` (default: 100)
3. Enable `printBackground: true` for colored content
4. Check printer driver settings

### Port Already in Use

[](#port-already-in-use)

**Error:** `Port 3000 is already in use`

**Solution - Find and kill the process:**

**macOS/Linux:**

```
# Find process using port 3000
lsof -ti:3000

# Kill the process
kill -9 $(lsof -ti:3000)

# Or change port in electron-print-service/config.json
```

**Windows:**

```
# Find process using port 3000
netstat -ano | findstr :3000

# Kill process (replace PID with actual process ID)
taskkill /PID  /F

# Or change port in electron-print-service/config.json
```

**Change Port:**Edit `electron-print-service/config.json`:

```
{
  "port": 3001,
  "listenIP": "0.0.0.0"
}
```

Then update Laravel `.env`:

```
PRINT_SERVICE_URL=http://localhost:3001
```

### Network Printing Not Working

[](#network-printing-not-working)

**Solutions:**

1. Verify IP address: `ping 192.168.1.100`
2. Check firewall allows port 3000
3. Ensure `listenIP: "0.0.0.0"` in Electron config
4. Test locally first: `http://localhost:3000/health`

### Electron App Won't Open

[](#electron-app-wont-open)

#### macOS

[](#macos)

**Problem:** "App can't be opened because it is from an unidentified developer"

**Solution:**

```
# Remove quarantine attribute
xattr -cr "/Applications/6amTech Printing Service.app"

# Or right-click → Open (first time only)
```

**Problem:** App crashes on startup

**Solution:**

1. Check Console.app for error logs
2. Ensure printer drivers are installed
3. Try running from source: `cd electron-print-service && npm start`

#### Windows

[](#windows)

**Problem:** "Windows protected your PC" warning

**Solution:**

1. Click "More info"
2. Click "Run anyway"
3. Or: Right-click installer → Properties → Unblock → Apply

**Problem:** App won't start after installation

**Solution:**

1. Check if port 3000 is already in use: ```
    netstat -ano | findstr :3000
    ```
2. Run as Administrator
3. Check Windows Defender logs
4. Reinstall with antivirus temporarily disabled

#### Linux

[](#linux)

**Problem:** AppImage won't run

**Solution:**

```
# Make executable
chmod +x 6amTech-Printing-Service-1.0.0.AppImage

# Run
./6amTech-Printing-Service-1.0.0.AppImage
```

**Problem:** .deb installation fails

**Solution:**

```
# Install dependencies
sudo apt-get install -f

# Try reinstall
sudo dpkg -i 6amTech-Printing-Service-1.0.0.deb
```

**Problem:** App runs but no system tray icon

**Solution:**

```
# Install system tray support
sudo apt-get install libappindicator3-1

# For GNOME
sudo apt-get install gnome-shell-extension-appindicator
```

---

🎯 Features
----------

[](#-features)

✅ **Silent Printing** - No print dialogs
✅ **Multiple Formats** - HTML, Blade, URL, PDF
✅ **Print Profiles** - Pre-configured settings
✅ **Network Support** - Print from any device
✅ **Thermal Printers** - 80mm, 58mm receipts
✅ **Standard Printers** - A4, Letter, Labels
✅ **Cross-Platform** - Windows, macOS, Linux
✅ **Large Files** - Configurable payload size

---

📖 Resources
-----------

[](#-resources)

- **[Complete Documentation](DOCUMENTATION.md)** - Advanced features and guides
- **[GitHub Repository](https://github.com/mainulBUBT/laravel-electron-printing)** - Source code
- **[Packagist](https://packagist.org/packages/6amtech/laravel-electron-printing)** - Package releases

---

📝 License
---------

[](#-license)

MIT License - see [LICENSE.md](LICENSE.md)

---

👨‍💻 Credits
-----------

[](#‍-credits)

**Developed by:** Mainul Islam
**Organization:** 6amTech
**GitHub:** [@mainulBUBT](https://github.com/mainulBUBT)
**Email:**

---

⭐ Support
---------

[](#-support)

If this package helps your project, give it a ⭐ on [GitHub](https://github.com/mainulBUBT/laravel-electron-printing)!

**Made with ❤️ for the Laravel community**

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance60

Regular maintenance activity

Popularity10

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 91.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

258d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6dcd72acbb356779bef67c1b42d2443ab5d67dae1207777f742955fb6b7c37a1?d=identicon)[mainulBUBT](/maintainers/mainulBUBT)

---

Top Contributors

[![mainul3057](https://avatars.githubusercontent.com/u/125275842?v=4)](https://github.com/mainul3057 "mainul3057 (11 commits)")[![mainulBUBT](https://avatars.githubusercontent.com/u/29301799?v=4)](https://github.com/mainulBUBT "mainulBUBT (1 commits)")

---

Tags

printerlaravelposreceiptprintingelectronthermal-printer pdf printsilent-print6amtechbackground-printingauto-printblade-print

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/6amtech-laravel-electron-printing/health.svg)

```
[![Health](https://phpackages.com/badges/6amtech-laravel-electron-printing/health.svg)](https://phpackages.com/packages/6amtech-laravel-electron-printing)
```

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M3.1k](/packages/craftcms-cms)[nativephp/mobile

NativePHP for Mobile

1.1k75.1k91](/packages/nativephp-mobile)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[spatie/laravel-export

Create a static site bundle from a Laravel app

674146.0k6](/packages/spatie-laravel-export)[venturedrake/laravel-crm

A free open source CRM built as a package for laravel projects

43311.2k](/packages/venturedrake-laravel-crm)[simplestats-io/laravel-client

Server-side analytics for Laravel that follows the full funnel from visit to registration to payment, attributed to the channel that drove it. Revenue, MRR, churn and ad-spend profit (ROAS/CAC) per channel. GDPR compliant, ad-blocker proof.

5021.9k](/packages/simplestats-io-laravel-client)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
