laravel-printing

Basic Usage

Print Tasks

{note} You're browsing the documentation for an old version of laravel-printing. Consider upgrading your project to v3. Check your version with the following command:

`composer show rawilk/laravel-printing`

Print tasks can be sent to your printer by creating a new print task. At the bare minimum, you need your printer's id, and the content you are going to print.

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

There are several options you can set for a print job. You should consult with your print driver to see which options you have available to you.

Printing::newPrintTask()
    ->printer($printerId)
    ->file('path_to_file.pdf')
    ->jobTitle('my job title')
    ->option('fit_to_page', true) // 'fit_to_page' is an available PrintNode option
    ->copies(2)
    ->tray('Tray 1') // check if your driver and printer supports this
    ->send();

Note: If using CUPS, you can pass in a $contentType as a second parameter to the file(), url(), and content() methods. The default is application/octet-stream (PDF). More types can be found in Rawilk\Printing\Drivers\Cups\ContentType.php.

More info on print tasks can be found in the api reference.

Previous
Printer