{note} You're browsing the documentation for an old version of laravel-printing. Consider upgrading your project to v2.

Basic Usage

Introduction

Most operations through this package can be done with the Printing facade.

Listing printers

You can retrieve all available printers on your print server like this:

$printers = Printing::printers();

foreach ($printers as $printer) {
    echo $printer->name();
}

No matter which driver you use, each $printer object will be be an instance of Rawilk\Printing\Contracts\Printer. More info on the printer object here.

Finding a printer

You can find a specific printer if you know the printer's id:

Printing::find($printerId);

Default printer

If you have a default printer id set in the config file, you can easily access the printer via the facade:

Printing::defaultPrinter(); // returns an instance of Rawilk\Printing\Contracts\Printer if the printer is found

// or for just the id
Printing::defaultPrinterId();

Creating a new print job

You can send jobs to a printer on your print server by creating a new print task:

Printing::newPrintTask()
    ->printer($printerId)
    ->file('path_to_file.pdf')
    ->send();
← Previous Topic

Changelog

Next Topic →

Printer

Caught a mistake? Suggest an edit on Github