laravel-printing icon indicating copy to clipboard operation
laravel-printing copied to clipboard

Content() dont work

Open Cahandar opened this issue 2 years ago • 2 comments

Laravel Printing Version

v3

Laravel Version

v8

Bug description

I can print pdf file but i want print text content() dont work . $printerId = '71387975';

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

    Printing::newPrintTask()
        ->printer($printerId)
        ->content($text) 
        ->send();

Steps to reproduce

.

Relevant log output

.

Cahandar avatar Jun 06 '22 09:06 Cahandar

Hello, I am having the same problem. Did you solve it?

TahaYasin61 avatar Aug 10 '22 09:08 TahaYasin61

When using content() method you can specify the content type with the 2nd parameter. Depending on your used driver you can find the available content types in Printing/Drivers//ContentType.php PS: Default contentType goes to PDF.

Example hardcoded:

Printing::newPrintTask()
		->printer($printerId)
		->content($text, 'text/plain')
		->send();

or in my case loading with a different name:

use Rawilk\Printing\Drivers\Cups\ContentType as PrintingCUPSContentType;
Printing::newPrintTask()
        ->printer($printerId)
        ->content($text, PrintingCUPSContentType::TEXT)
        ->send();

AlexPodaru avatar Sep 22 '22 14:09 AlexPodaru

I can't see anything from your code that would be preventing it from working. If your PrintNode account (if you're using that driver) is receiving the job, then it should be working properly.

rawilk avatar Oct 31 '22 12:10 rawilk

This issue is stale because it has been open 21 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Nov 22 '22 12:11 github-actions[bot]