Skip to content

TheNodi/printer-wrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP Printer Wrapper

Latest Version on Packagist Build Status Total Downloads

Wrapper around unix lp commands used to send file to a printer, manage connected printers and see print queue.

Installation

You can install the package via composer:

composer require thenodi/printer-wrapper

Usage

Basic Usage

Print a file using the default printer.

<?php
(new \TheNodi\PrinterWrapper\PrinterManager())->printFile('/path/to/file.txt');

List all printers

<?php
(new \TheNodi\PrinterWrapper\PrinterManager())->printers();
// => Printer[]

Page Settings

Print a page in landscape mode.

<?php
(new \TheNodi\PrinterWrapper\PrinterManager())
    ->landscape()
    ->printFile('/path/to/file.txt');

Print a letter.

<?php
(new \TheNodi\PrinterWrapper\PrinterManager())
    ->media(\TheNodi\PrinterWrapper\Printer::MEDIA_LETTER)
    ->printFile('/path/to/file.txt');

Print a document two-sided.

<?php
(new \TheNodi\PrinterWrapper\PrinterManager())
    ->twoSided()
    ->printFile('/path/to/file.txt');

If you need to pass a custom option to the lp command use the setOption method.

<?php
(new \TheNodi\PrinterWrapper\PrinterManager())
    ->setOption('only-name')
    ->setOption('name', 'value')
    ->printFile('/path/to/file.txt');
// => lp -o only-name -o name=value ...

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Credits

License

The MIT License (MIT). Please see License File for more information.

About

Wrapper around unix `lp` commands used to send file to a printer, manage connected printers and see print queue.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages