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

Print Tasks

Introduction

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();

Options

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.

Driver Options

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

← Previous Topic

Printer

Next Topic →

Receipt Printing

Caught a mistake? Suggest an edit on Github