I'm a full-stack web developer that specializes in the Laravel framework.
Tools, languages, and other things that I like to work with.
Direct printing for Laravel apps.
Home Page: https://randallwilk.dev/docs/laravel-printing
License: MIT License
From what I can tell right now, it doesn't look like you can directly access the driver and thus the client under it for something like PrintNode.
Their API contains a number of helpful routes like whoami, computers, and more that would be nice to access from the library without using PrintNode directly.
HI,
I am getting the following error when I try to install this package:
[InvalidArgumentException]
Package rawilk/laravel-printing has a PHP requirement incompatible with your PHP version, PHP extensi
ons and Composer version
I am new to Laravel so I hope you dont mind if I am doing something stupid.
Here is my composer.json:
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.3|^8.0",
"fideloper/proxy": "^4.4",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0.1",
"laravel/framework": "^8.12",
"laravel/tinker": "^2.5"
},
"require-dev": {
"facade/ignition": "^2.5",
"fakerphp/faker": "^1.9.1",
"mockery/mockery": "^1.4.2",
"nunomaduro/collision": "^5.0",
"phpunit/phpunit": "^9.3.3"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
},
"files": [
"app/helpers.php"
]
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
]
}
}
When attempting to use CUPS in v1.3, it seems that it's usage is broken in a few ways:
<warning>PHP Deprecated: Passing a Psr\Http\Message\ResponseFactoryInterface and a Psr\Http\Message\StreamFactoryInterface to SocketClient is deprecated, and will be removed in 3.0, you should only pass config options. in /var/www/html/project/vendor/php-http/socket-client/src/Client.php on line 59</warning>
TypeError: Argument 2 passed to Rawilk\Printing\Drivers\Cups\Cups::remoteServer() must be of the type string, null given, called in /var/www/html/project/vendor/rawilk/laravel-printing/src/Factory.php on line 46
This error cryptically is trying to say that a username/password are required, but the defaults for the username and password in the published config don't have a default and become null which generates the error.
Once I set the username/password to be blank strings, I then got the following error:
Rawilk\Printing\Exceptions\InvalidDriverConfig with message 'Remote CUPS server requires a username and password.'
This seems to be due to a arbitrary requirement of needing a username and password for a remote cups server.
While not great security wise to have no username/password when I remove the conditional that validates for requiring username/password, the CUPS calls work just fine (albeit with the deprecation notices).
Install the package, configure only a valid CUPS_SERVER_IP, run Printing::printers()
Additionally, setting a username/password results in similar errors minus the error on requiring a username/password
Context
First off - thanks very much for this package Randall, I got a small label printer working on a raspberry Pi within 30 minutes. I'll try to contribute where I can!
The search bar is causing an algolia error
Perform a search on https://randallwilk.dev/
Hi friends
I am developing a receipt for thermal printer, but I have the problem of not being able to iterate items, because it only allows to print strings and it is not possible to use an array.
Is it not possible to make a loop with all the items of the receipt?
Thanks
Context
Mock printer driver that will store files in the local storage it may handle multiple formats like "pdf" or raw files, printer id can be a folder.
Useful for local testing, manual and automated through tests.
I'm migrating from charlieuki/receipt-printer for Following Reasons:
Now the question is what would be the configuration for rawilk/laravel-printing if I have a Local printer as follows:
connector_type: "network",
connector_discriptor: "192.168.2.248",
port: 9100
Code given above worked in charlieuki/receipt-printer
But not sure how to use this info in this
package
I've tried so many snippets from the existing doc but none of them shows what config it requires.
Yes, it's definitely valuable to others as there are very very less information & Laravel packages on the web for POS Printing, And only this package looks promising.
Currently I can see no way of using the ContentType pdf_base64 for Printnode via the content() method.
public function content($content): self
{
$this->job->content = base64_encode($content);
$this->job->contentType = ContentType::RAW_BASE64;
return $this;
}
RAW_BASE64 is hardcoded in the content() method.
For CUPS there is a additional $contentType parameter for the content() method.
public function content($content, string $contentType = ContentType::PDF): self
It would be great if this parameter can be added to the printnode drivers PrintTask class, too.
I can add a Pull Request, if mandatory.
Kind Regards
Christian
v3
v8
when I connect my print node client and start to print around it's printing the Arabic language English direction from left to right and that is a problem any ideas on how to fix this
No response
No response
Is there any way that we can send scan job to the printer and retrieve the scanned file? preferably using CUPS driver.
After installing library can't use Guzzle for making requests
Context
-Laravel 8
-PHP 7.4
-Windows 10 64bit
Error I am getting:
{ "message": "Interface 'Psr\\Http\\Client\\ClientInterface' not found", "exception": "Error", "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\guzzlehttp\\guzzle\\src\\Client.php", "line": 17, "trace": [ { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\composer\\ClassLoader.php", "line": 444, "function": "include" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\composer\\ClassLoader.php", "line": 322, "function": "Composer\\Autoload\\includeFile" }, { "function": "loadClass", "class": "Composer\\Autoload\\ClassLoader", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\laravel\\framework\\src\\Illuminate\\Http\\Client\\PendingRequest.php", "line": 639, "function": "spl_autoload_call" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\laravel\\framework\\src\\Illuminate\\Http\\Client\\PendingRequest.php", "line": 573, "function": "buildClient", "class": "Illuminate\\Http\\Client\\PendingRequest", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\laravel\\framework\\src\\Illuminate\\Support\\helpers.php", "line": 234, "function": "Illuminate\\Http\\Client\\{closure}", "class": "Illuminate\\Http\\Client\\PendingRequest", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\laravel\\framework\\src\\Illuminate\\Http\\Client\\PendingRequest.php", "line": 589, "function": "retry" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\laravel\\framework\\src\\Illuminate\\Http\\Client\\PendingRequest.php", "line": 493, "function": "send", "class": "Illuminate\\Http\\Client\\PendingRequest", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\app\\DistOne\\DistOneApiClient.php", "line": 132, "function": "post", "class": "Illuminate\\Http\\Client\\PendingRequest", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\app\\DistOne\\DistOneApiClient.php", "line": 80, "function": "readData", "class": "App\\DistOne\\DistOneApiClient", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\app\\Http\\Controllers\\OrdersController.php", "line": 49, "function": "getOrders", "class": "App\\DistOne\\DistOneApiClient", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Controller.php", "line": 54, "function": "ajaxOrders", "class": "App\\Http\\Controllers\\OrdersController", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\ControllerDispatcher.php", "line": 45, "function": "callAction", "class": "Illuminate\\Routing\\Controller", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Route.php", "line": 254, "function": "dispatch", "class": "Illuminate\\Routing\\ControllerDispatcher", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Route.php", "line": 197, "function": "runController", "class": "Illuminate\\Routing\\Route", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php", "line": 692, "function": "run", "class": "Illuminate\\Routing\\Route", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php", "line": 128, "function": "Illuminate\\Routing\\{closure}", "class": "Illuminate\\Routing\\Router", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\app\\Http\\Middleware\\CheckRole.php", "line": 22, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php", "line": 167, "function": "handle", "class": "App\\Http\\Middleware\\CheckRole", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\app\\Http\\Middleware\\LogoutIfNotActive.php", "line": 27, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php", "line": 167, "function": "handle", "class": "App\\Http\\Middleware\\LogoutIfNotActive", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Middleware\\SubstituteBindings.php", "line": 41, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php", "line": 167, "function": "handle", "class": "Illuminate\\Routing\\Middleware\\SubstituteBindings", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken.php", "line": 78, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php", "line": 167, "function": "handle", "class": "Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\laravel\\framework\\src\\Illuminate\\Session\\Middleware\\AuthenticateSession.php", "line": 58, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php", "line": 167, "function": "handle", "class": "Illuminate\\Session\\Middleware\\AuthenticateSession", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\laravel\\framework\\src\\Illuminate\\Auth\\Middleware\\Authenticate.php", "line": 44, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php", "line": 167, "function": "handle", "class": "Illuminate\\Auth\\Middleware\\Authenticate", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\laravel\\framework\\src\\Illuminate\\View\\Middleware\\ShareErrorsFromSession.php", "line": 49, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php", "line": 167, "function": "handle", "class": "Illuminate\\View\\Middleware\\ShareErrorsFromSession", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\laravel\\framework\\src\\Illuminate\\Session\\Middleware\\StartSession.php", "line": 121, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\laravel\\framework\\src\\Illuminate\\Session\\Middleware\\StartSession.php", "line": 63, "function": "handleStatefulRequest", "class": "Illuminate\\Session\\Middleware\\StartSession", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php", "line": 167, "function": "handle", "class": "Illuminate\\Session\\Middleware\\StartSession", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\laravel\\framework\\src\\Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse.php", "line": 37, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php", "line": 167, "function": "handle", "class": "Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\laravel\\framework\\src\\Illuminate\\Cookie\\Middleware\\EncryptCookies.php", "line": 67, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php", "line": 167, "function": "handle", "class": "Illuminate\\Cookie\\Middleware\\EncryptCookies", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php", "line": 103, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php", "line": 694, "function": "then", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php", "line": 669, "function": "runRouteWithinStack", "class": "Illuminate\\Routing\\Router", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php", "line": 635, "function": "runRoute", "class": "Illuminate\\Routing\\Router", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php", "line": 624, "function": "dispatchToRoute", "class": "Illuminate\\Routing\\Router", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php", "line": 166, "function": "dispatch", "class": "Illuminate\\Routing\\Router", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php", "line": 128, "function": "Illuminate\\Foundation\\Http\\{closure}", "class": "Illuminate\\Foundation\\Http\\Kernel", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest.php", "line": 21, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php", "line": 167, "function": "handle", "class": "Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest.php", "line": 21, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php", "line": 167, "function": "handle", "class": "Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize.php", "line": 27, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php", "line": 167, "function": "handle", "class": "Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance.php", "line": 86, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php", "line": 167, "function": "handle", "class": "Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\fruitcake\\laravel-cors\\src\\HandleCors.php", "line": 37, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php", "line": 167, "function": "handle", "class": "Fruitcake\\Cors\\HandleCors", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\fideloper\\proxy\\src\\TrustProxies.php", "line": 57, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php", "line": 167, "function": "handle", "class": "Fideloper\\Proxy\\TrustProxies", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php", "line": 103, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php", "line": 141, "function": "then", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php", "line": 110, "function": "sendRequestThroughRouter", "class": "Illuminate\\Foundation\\Http\\Kernel", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\public\\index.php", "line": 52, "function": "handle", "class": "Illuminate\\Foundation\\Http\\Kernel", "type": "->" }, { "file": "E:\\projekti\\Lee Distributors\\orders-tracking\\server.php", "line": 21, "function": "require_once" } ] }
Is there a way to add a QR code to the receipt printer?
No response
v3.0.0
v9.19
file methods works fine when we try to print but
Printing::newPrintTask()
->printer($printerId)
->content('hello world')
->send();
and
Printing::newPrintTask()
->printer($printerId)
->url('https://www.google.com')
->send();
functions not working when we try to print. Inside PrintNode application, on logs section we can see PrintJob id and done message but nothing comes out from our printer. And no error shows up in our project.
No response
No response
I have installed the package and Printnode. Set the api but when i do
print_r(Printing::printers());
Array is empty
Please Help ... thanks
Is there any way to handle multiple printnode keys in order to manage multiple printnode subscriptions ?
No response
3.0.3
10.17.1
CUPS
I've installed the package and the CUPS driver like documented. After setting up the credentials I try to show the available printers. This then results in an error.
So first:
composer require rawilk/laravel-printing
composer require smalot/cups-ipp
Then run tinker: php artisan tinker
Psy Shell v0.11.20 (PHP 8.1.3 โ cli) by Justin Hileman
> dump(Printing::printers())
LogicException You cannot use "Http\Message\MessageFactory\GuzzleMessageFactory" as the "php-http/message-factory" package is not installed. Try running "composer require php-http/message-factory". Note that this package is deprecated, use "psr/http-factory" instead.
Basically we need the deprecated php-http/message-factory
package to send requests.
However, when you install the deprecated package you get conflicts in the interfaces with the already currently installed psr/http-factory
package:
composer require php-http/message-factory
Then run tinker: php artisan tinker
Psy Shell v0.11.20 (PHP 8.1.3 โ cli) by Justin Hileman
> dump(Printing::printers())
In Stream.php line 79:
Declaration of Http\Client\Socket\Stream::close() must be compatible with Psr\Http\Message\StreamInterface::close(): void
I suppose that we'd need to use the newly provided interfaces by psr/http-factory
to fix the issue.
I can't drop the psr/http-factory
package since it's being used by phpoffice/phpspreadsheet
:
$ composer why psr/http-factory
guzzlehttp/psr7 2.6.0 requires psr/http-factory (^1.0)
nyholm/psr7 1.8.0 requires psr/http-factory (^1.0)
php-http/client-common 2.7.0 requires psr/http-factory (^1.0)
phpoffice/phpspreadsheet 1.29.0 requires psr/http-factory (^1.0)
No response
No response
I have installed this package on a fresh installation, completed all the steps from the Docs. Using CUPS and getting this error
Non-static method Rawilk\Printing\Printing::printers() cannot be called statically
I have setup the cups server info in the env and the server is accessible from browser.
I tried using it like this $printer = (new Printing)->printers();
and got this error Too few arguments to function Rawilk\Printing\Printing::__construct()
HI,
Thanks for the awesome plugin.
i am using below two lines to return all printers in my controller file.
$printers = Printing::printers();
return $printers;
It does not show anything.
Then i find rawlink/laravel-printing/src/printing.php file where i pass the $e. Then i get the error [{"statusCode":"400","message":"HTTP Error (400): 'offset' not supported"}]
public function printers(): Collection
{
try {
$printers = $this->driver->printers();
} catch (\Throwable $e) {
$printers = collect([$e]);
}
$this->resetDriver();
return $printers;
}
Am i doing something wrong?
Unable to print via CUPS driver, getting 'A non-numeric value encountered'
$printers = Printing::printers();
Printing::newPrintTask()
->file(public_path('sample.pdf'))
->printer($printers->first()->id())
->send();
Context
v3.0.3
v10.13.5
PrintNode
When trying to print ZPL code via PrintNode with the following code:
$zplCode = <<<EOT
^XA
^CFA,30
^FO50,300^FDJohn Doe^FS
^FO50,340^FD100 Main Street^FS
^FO50,380^FDSpringfield TN 39021^FS
^FO50,420^FDUnited States (USA)^FS
^XZ
EOT;
$printJob = Printing::newPrintTask()
->printer($printerId)
->content($zplCode)
->send();
I always get the code printed on the label but its not converted.
When debugging the returned $printJob
I do see that its contentType
is raw_uri
and not raw_base64
.
How can I set the contentType
with the above code to ensure it's correctly printed?
No response
No response
After send a job, how can i get print job id from print node?
Printing::newPrintTask() ->printer($printerId) ->file('path_to_file.pdf') ->send();
Context
Hi,
I am trying to print a label on zebra printer using zpl format. I thought using content() should work. It creates the job but nothing prints.
v3.0.0
v8.0
PrinterNode
set the printer_node_api_key from controller dynamically
Config::set('printing.drivers.printnode.key', 'my-printer-node-key');
it showing API key is missing in response here is my code
after that i downgrad to v2.0.0 and it works fine
use \Rawilk\Printing\PrintTask;
use \Rawilk\Printing\Receipts\ReceiptPrinter;
public function xprinter(Request $request)
{
Config::set('printing.drivers.printnode.key', 'my-printer-node-key');
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("printer_id");
$printJob->content($text);
$printJob->send();
} catch(Exception $e) {
echo "Couldn't print to this printer: " . $e -> getMessage() . "\n";
}
}
No response
API key Missing
I don't know if this can be done,but i want to check if a printer exists on a specific IP using CUPS . Something like true/false condition.
Can this be achieved somehow?
Thanks in advance.
Latest
10.13.5
N/A
Cannot install on on PHP 8.2.5
No response
ฮป composer require rawilk/laravel-printing
./composer.json has been updated
Running composer update rawilk/laravel-printing
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- rawilk/laravel-printing[1.0.0, ..., 1.3.0] require php ^7.4 -> your php version (8.2.5) does not satisfy that requirement.
- rawilk/laravel-printing 2.0.0 requires illuminate/support ^8.0 -> found illuminate/support[v8.0.0, ..., v8.83.27] but these were not loaded, likely because it conflicts with another require.
- rawilk/laravel-printing[v3.0.0, ..., v3.0.1] require illuminate/support ^8.0|^9.0 -> found illuminate/support[v8.0.0, ..., v8.83.27, v9.0.0, ..., v9.52.9] but these were not loaded, likely because it conflicts with another require.
- rawilk/laravel-printing[v3.0.2, ..., v3.0.3] require mike42/escpos-php ^4.0 -> found mike42/escpos-php[v4.0] but the package is fixed to v2.2 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
- Root composer.json requires rawilk/laravel-printing * -> satisfiable by rawilk/laravel-printing[1.0.0, ..., 1.3.0, 2.0.0, v3.0.0, v3.0.1, v3.0.2, v3.0.3].
Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
You can also try re-running composer require with an explicit version constraint, e.g. "composer require rawilk/laravel-printing:*" to figure out if any version is installable, or "composer require rawilk/laravel-printing:^2.1" if you know which you need..0.0, v3.0.0, v3.0.1, v3.0.2, v3.0.3].
I am getting following error. any thoughts. php version is 8.1 and laravel 8.0
Error: Interface "Http\Client\HttpClient" not found in /vendor/rawilk/laravel-printing/src/Drivers/Cups/Support/Client.php:27
Using Cups on v1.3, when calling Printing::find on an invalid ID, results in a Rawilk\Printing\Drivers\Cups\Entity\Printer instance, but for a random printer. This means that there's really no way to confirm that the printer being looked up is the right one.
Having a working CUPS server with printers configured. Call Printing::find('invalid'), and see that you still get a printer instance.
When dumping the Entity, you can see in the ResponseParser the following:
#responseParser: Smalot\Cups\Transport\ResponseParser^ {#5518
#content: "\x01\x01\x04\x06\x00\x00\x00\x04\x01G\x00\x12attributes-charset\x00\x08us-asciiH\x00\eattributes-natural-language\x00\x05en-usA\x00\x0Estatus-message\x00#The printer or class was not found.\x03"
So there is already the knowlege that it wasn't found, but the package isn't validating anything in this case.
Context
v3.0.0
v9
PrintNode
$receipt = (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();
// Now send the string to your receipt printer
Printing::newPrintTask()
->printer($receiptPrinterId)
->content($receipt)
->send();
just copy code
job ID :2989074766
i need help
i use Rawilk\Printing\Facades\Printing as namespace;
$printerId = 72467752;
Printing::newPrintTask()
->printer($printerId)
->file(public_path($filename))
->send();
and i run this code, it returns cURL error 60: SSL certificate problem: self signed certificate in certificate chain (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://api.printnode.com/printjobs.
also when i run
$printers = Printing::printers();
dd($printers);
it also return a blank array. thanks
I've installed laravel-printing using composer. In my application i use GuzzleHttp\Client, but after the installation i get back this error when i'm using it.
Error
Interface 'Psr\Http\Client\ClientInterface' not found
If i remove laravel-printing, it works fine.
Context
v3.0.0
v9.01
Hello! This package is wonderful :-) Thank you.
I want to ask one question. I'm using it with cups (installed on wsl2 on windows server of my customer).
I want to send name of the file with ->jobTitle() to the cups.
The cups is not showing the name of the job.
How I could resolve?
Thank you
No response
No response
v3.0.3
v10.15
Cups
I have used this package with printnode and it worked great. Now that i switched to Cups it results in an error.
I am using this code:
Rawilk\Printing\Facades\Printing
$printers = Printing::printers();
foreach ($printers as $printer) {
dump($printer->name()) ;
}
It results in the following error:
Declaration of Http\Client\Socket\Stream::close() must be compatible with Psr\Http\Message\StreamInterface::close(): void
I have followed the docs witch instructed to install smalot/cups-ipp.
But it seems not to help at all.
If i fix the issue manually adding : void after the close method a new error comes up staing that there is another compatibility issue.
PHP Fatal error: Declaration of Http\Client\Socket\Stream::close() must be compatible with Psr\Http\Message\StreamInterface::close(): void in \vendor\php-http\socket-client\src\Stream.php on line 79
Symfony\Component\ErrorHandler\Error\FatalError
Declaration of Http\Client\Socket\Stream::close() must be compatible with Psr\Http\Message\StreamInterface::close(): void
at vendor\php-http\socket-client\src\Stream.php:79
75โ
76โ /**
77โ * {@inheritdoc}
78โ */
โ 79โ public function close()
80โ {
81โ if ($this->isDetached || null === $this->socket) {
82โ throw new StreamException('Stream is detached');
83โ }
Whoops\Exception\ErrorException
Declaration of Http\Client\Socket\Stream::close() must be compatible with Psr\Http\Message\StreamInterface::close(): void
at vendor\php-http\socket-client\src\Stream.php:79
75โ
76โ /**
77โ * {@inheritdoc}
78โ */
โ 79โ public function close()
80โ {
81โ if ($this->isDetached || null === $this->socket) {
82โ throw new StreamException('Stream is detached');
83โ }
1 vendor\filp\whoops\src\Whoops\Run.php:510
Whoops\Run::handleError("Declaration of Http\Client\Socket\Stream::close() must be compatible with Psr\Http\Message\StreamInterface::close(): void", "\vendor\php-http\socket-client\src\Stream.php")
2 [internal]:0
Whoops\Run::handleShutdown()
v3
9.46
CUPS
I want to print a pdf file on a thermal printer which is installed on a raspberry pi using CUPS. I'm unable to do it so far . If i send it from iPhone or mac ,is printed successfully so i think the problem is elsewhere.
for example this :
Printing::newPrintTask()->printer(Printing::defaultPrinterId())->file('files/test.pdf')->send();
doesn't work. Every other method works (content,URL) as it should.
Edit: File method works with other files for example .jpg but not with .pdf file
I am not able to install this package.
Problem 1
- Root composer.json requires rawilk/laravel-printing ^2.0 -> satisfiable by rawilk/laravel-printing[2.0.0].
- rawilk/laravel-printing 2.0.0 requires mike42/escpos-php ^3.0 -> found mike42/escpos-php[v3.0] but the package is fixed to v2.2 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
$printJob = Printing::newPrintTask()
->printer($printerId)
->file('path_to_file.pdf')
->send();
$printJob->id();
in class how to access printing class
v3
v8
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();
.
.
LATEST
9.20.0
PrintNode
Everytime I try to print I get a server error. It worked a few weeks ago, but for some reason it doesn't work now.
No response
500 | SERVER ERROR
v4.9.8.0
v8
N/A
I can not access to my php admin I've tried every way
No response
No response
v3.0.3
v10.13.5
N/A
It can't install on this version of laravel
No response
Problem 1
- rawilk/laravel-printing[v3.0.2, ..., v3.0.3] require mike42/escpos-php ^4.0 -> satisfiable by mike42/escpos-php[v4.0].
- rawilk/laravel-printing[1.0.0, ..., 1.3.0] require php ^7.4 -> your php version (8.2.4) does not satisfy that requirement. - rawilk/laravel-printing 2.0.0 requires illuminate/support ^8.0 -> found illuminate/support[v8.0.0, ..., v8.83.27] but these were not loaded, likely because it conflicts with another require.
- rawilk/laravel-printing[v3.0.0, ..., v3.0.1] require illuminate/support ^8.0|^9.0 -> found illuminate/support[v8.0.0, ..., v8.83.27, v9.0.0, ..., v9.52.10] but these were not loaded, likely because it conflicts with another require.
- mike42/escpos-php v4.0 requires ext-intl * -> it is missing from your system. Install or enable PHP's intl extension.
- Root composer.json requires rawilk/laravel-printing * -> satisfiable by rawilk/laravel-printing[1.0.0, ..., 1.3.0, 2.0.0,
v3.0.0, v3.0.1, v3.0.2, v3.0.3].
To enable extensions, verify that they are enabled in your .ini files:
- C:\xampp\php\php.ini
You can also run `php --ini` in a terminal to see which files are used by PHP in CLI mode.
Alternatively, you can run Composer with `--ignore-platform-req=ext-intl` to temporarily ignore these required extensions.
You can also try re-running composer require with an explicit version constraint, e.g. "composer require rawilk/laravel-printing:*" to figure out if any version is installable, or "composer require rawilk/laravel-printing:^2.1" if you know which you need.
Wiki URL returning HTTP 500 Server Error
Multiple cross platform browser check & httpstatus.io
Context
I have installed the package and Printnode. Set the api but when i do
print_r(Printing::printers());
Array is empty
Any hint please? Thanks
Hi,
I'm testing your lib and it is working as expected. I have a question, how can I print a logo in receipt? Is there a command to it?
If there's none... where to start to lookup and maybe help you.
Thanks in advance
I have installed this package and set api key in config. Printnode client software also installed and logged in with api key.
Printer is connected and showing active with online status on Printnode Client software.
But from code there is no printer id or name listing, it's all null.
$printers = Printing::printers(); foreach ($printers as $printer) { echo $printer->name(); }
Any help?
v3
v9
PrintNode
When i list the printers it displays empty array, although i have printers.
$printers = \Printing::printers();
dd($printers);
No response
No response
PSR Client interface not found (vendor/php-http/httplug/src/HttpClient.php:13)
Route::get('/printers', function() {
$printers = \Rawilk\Printing\Facades\Printing::printers();
ddd($printers);
});
Is it possible to use multilanguage?
I am interested in Greek language ,to be more specific.
Every time i use Greek,the outcome is formatted to hexadecimal i believe.
v3
v9
Hi im having this issue when using laravel-printing
my code is here :
public function print(){
$print = Printing::newPrintTask()
->printer(765766676)
->file('file.pdf')
->send();
return $print;
}
the response of this request is : printer id must be an integer specified as (request body).printer.id or (request body).printer or (request body).printerId
Thank you
No response
No response
List printers with PrintNode.
$printers = Printing::printers()
Nothing is returned. After further investigation, PrintNode 2.0@RC1 is very old 2015 and does not match their API anymore.
dev-master is up to date as they have not tagged a new release as far as I can tell.
This occurs in all versions
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.