'How to use laravel-printing package?

i want to print with laravel using Laravel-printing Package https://github.com/rawilk/laravel-printing.

This is my code:

use \Rawilk\Printing\PrintTask;
use \Rawilk\Printing\Receipts\ReceiptPrinter;

public function xprinter(Request $request)
{
    try {
        $text = (string) (new ReceiptPrinter)
        ->centerAlign()
        ->text('My heading')
        ->leftAlign()
        ->line()
        ->twoColumnText('Item 1', '2.00')
        ->twoColumnText('Item 2', '4.00')
        ->feed(2)
        ->centerAlign()
        ->barcode('1234')
        ->cut();

        $printJob= new PrintTask;
        $printJob->printer("71138085");
        $printJob->content($text);
        $printJob->send();
    } catch(Exception $e) {
        echo "Couldn't print to this printer: " . $e -> getMessage() . "\n";
    }
}

But i have his error message: Cannot instantiate abstract class Rawilk\Printing\PrintTask. Someone can help me please?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source