Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting Id to getPrinters #13

Open
sevkialacatli opened this issue Nov 17, 2016 · 3 comments
Open

Setting Id to getPrinters #13

sevkialacatli opened this issue Nov 17, 2016 · 3 comments

Comments

@sevkialacatli
Copy link

We're trying to use PrintNode as a hub on our web projct. Each user's default printer is recorded onto DB and we would like to call this printer directly.

However, getPrinter lists all printers and I have to select inside it. Instead of that, it should be like "getPrinters(123456)" and only printer with id :123456 may be detailed.

Thanks.

@thomaspalmer
Copy link

If you're using the "release/2.0.0" branch then you can use the method viewPrinters and specify a list of printers that you want to return as the third parameter.

https://github.com/PrintNode/PrintNode-PHP/blob/release/2.0.0/src/PrintNode/Client.php#L167

@thomaspalmer
Copy link

I have also just checked, the main branch code also allows you to return one printer only exactly as you state above. Only thing is the parameter is a string:
$printers = $request->getPrinter('123456');

@justanoldhounddog
Copy link

Just a short note on thomas very useful contribution, it should be:

$printers = $request->getPrinters('123456');
the missing 'S' in Printers left me scratching my head for a while because it did not work,
after that line I added:
$printJob->printer = $printers[0];

and then it worked perfectly, thank you very much Thomas!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants