PHPackages                             abdullah-life/laravel-zebra-image-printer - 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. [Image &amp; Media](/categories/media)
4. /
5. abdullah-life/laravel-zebra-image-printer

ActiveLibrary[Image &amp; Media](/categories/media)

abdullah-life/laravel-zebra-image-printer
=========================================

Laravel package for printing PNG images to Zebra thermal printers via ZPL

v1.3.1(7mo ago)014MITPHPPHP ^7.4|^8.0

Since Nov 24Pushed 7mo agoCompare

[ Source](https://github.com/abdullah-life/laravel-zebra-image-printer)[ Packagist](https://packagist.org/packages/abdullah-life/laravel-zebra-image-printer)[ RSS](/packages/abdullah-life-laravel-zebra-image-printer/feed)WikiDiscussions main Synced today

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

Laravel Zebra Image Printer
===========================

[](#laravel-zebra-image-printer)

A minimal Laravel package for printing PNG images to Zebra thermal printers using ZPL.

Features
--------

[](#features)

- Print PNG images directly to Zebra thermal printers
- Support for local files and remote URLs
- Configurable margins, DPI, and darkness
- Full page width with automatic scaling
- Direct thermal and thermal transfer support
- Simple facade interface

Requirements
------------

[](#requirements)

- PHP 7.4+
- Laravel 9.x, 10.x, 11.x, or 12.x
- ImageMagick (`convert` command)

Installation
------------

[](#installation)

1. Install via Composer:

```
composer require abdullah-life/laravel-zebra-image-printer
```

2. Publish configuration:

```
php artisan vendor:publish --tag=zebra-printer-config
```

3. Configure your printer in `.env`:

```
ZEBRA_PRINTER_IP=172.21.54.45
ZEBRA_PRINTER_PORT=9100
ZEBRA_PRINTER_DPI=203
ZEBRA_PRINTER_DIRECT_THERMAL=true
ZEBRA_PRINTER_DARKNESS=30
ZEBRA_PRINTER_PAGE_WIDTH=832
```

4. Install ImageMagick:

```
sudo apt-get install imagemagick
```

Usage
-----

[](#usage)

### Using Facade

[](#using-facade)

```
use AbdullahLife\ZebraImagePrinter\Facades\ZebraPrinter;

// Print local file with 1cm margin
ZebraPrinter::print('/path/to/label.png', 1);

// Print remote URL
ZebraPrinter::print('https://example.com/label.png', 1);

// Print with custom margin
ZebraPrinter::print('/path/to/label.png', 0.5);

// Check if printer is online
if (ZebraPrinter::isOnline()) {
    ZebraPrinter::print('/path/to/label.png');
}
```

### Using Dependency Injection

[](#using-dependency-injection)

```
use AbdullahLife\ZebraImagePrinter\ZebraPrinter;

class LabelController extends Controller
{
    public function print(ZebraPrinter $printer)
    {
        $printer->print(storage_path('labels/shipping-label.png'), 1);

        return response()->json(['status' => 'printed']);
    }
}
```

### Advanced Usage

[](#advanced-usage)

```
use AbdullahLife\ZebraImagePrinter\Facades\ZebraPrinter;

// Convert to ZPL without printing
$zpl = ZebraPrinter::convert('/path/to/label.png', 1);

// Send ZPL to different printer
ZebraPrinter::sendToPrinter($zpl, '192.168.1.100', 9100);

// Check specific printer
$isOnline = ZebraPrinter::isOnline('192.168.1.100', 9100);
```

Configuration
-------------

[](#configuration)

Edit `config/zebra-printer.php`:

```
return [
    'printer_ip' => env('ZEBRA_PRINTER_IP', '172.21.54.45'),
    'printer_port' => env('ZEBRA_PRINTER_PORT', 9100),
    'dpi' => env('ZEBRA_PRINTER_DPI', 203),
    'direct_thermal' => env('ZEBRA_PRINTER_DIRECT_THERMAL', true),
    'darkness' => env('ZEBRA_PRINTER_DARKNESS', 30),
    'page_width_dots' => env('ZEBRA_PRINTER_PAGE_WIDTH', 832),
];
```

API Methods
-----------

[](#api-methods)

MethodParametersReturnsDescription`print()``string $imagePath, float $marginCm = 1``bool`Print image with margin`convert()``string $imagePath, float $marginCm = 0``string`Convert PNG to ZPL`sendToPrinter()``string $zpl, ?string $ip = null, ?int $port = null``bool`Send ZPL to printer`isOnline()``?string $ip = null, ?int $port = null``bool`Check if printer is onlineMargin Behavior
---------------

[](#margin-behavior)

When you specify a margin (e.g., `1` cm):

- Image uses 100% of page width minus margins on both sides
- Height automatically scales to maintain aspect ratio
- Content starts from top with specified margin

Example with 1cm margin on 4" printer (203 DPI):

- Page width: 832 dots (4 inches)
- Margin: 79 dots (1cm) on each side
- Image width: 674 dots (832 - 158)
- Height: Scaled proportionally

Troubleshooting
---------------

[](#troubleshooting)

### Printer Not Printing

[](#printer-not-printing)

```
// Check connection
if (!ZebraPrinter::isOnline()) {
    throw new Exception('Printer offline');
}
```

### ImageMagick Not Found

[](#imagemagick-not-found)

```
sudo apt-get update
sudo apt-get install imagemagick
```

### Blank Labels

[](#blank-labels)

- Verify printer mode (direct thermal vs thermal transfer)
- Check if ribbon is installed (for thermal transfer)
- Increase darkness in config

License
-------

[](#license)

MIT

Author
------

[](#author)

Abdullah (@abdullah-life)

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance64

Regular maintenance activity

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Every ~0 days

Total

15

Last Release

222d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/82768953?v=4)[Abdullah Khan](/maintainers/abdullah-k)[@Abdullah-k](https://github.com/Abdullah-k)

---

Top Contributors

[![abdullah-life](https://avatars.githubusercontent.com/u/74906693?v=4)](https://github.com/abdullah-life "abdullah-life (16 commits)")

### Embed Badge

![Health badge](/badges/abdullah-life-laravel-zebra-image-printer/health.svg)

```
[![Health](https://phpackages.com/badges/abdullah-life-laravel-zebra-image-printer/health.svg)](https://phpackages.com/packages/abdullah-life-laravel-zebra-image-printer)
```

###  Alternatives

[intervention/image-laravel

Laravel Integration of Intervention Image

1588.9M186](/packages/intervention-image-laravel)

PHPackages © 2026

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