How to programmatically set print quota on a cloud printer

2,724 views
Skip to first unread message

cita...@adelphi.edu

unread,
Oct 1, 2013, 11:30:03 AM10/1/13
to gcp-dev...@googlegroups.com
Hello,

Using the examples found here:


I have been able to write a script to automatically share and unshare all of my network printers with all of my users (hundreds of printers for tens of thousands of users). I have run into one snag with it, though. I cannot figure out how to set the print quota on a printer. By default, when you make a printer 'public' (using the api example in the link above), the default is for unlimited printing. This is not desirable for me. I'd like to limit it to 15 pages per day (which is the default when you manually share a printer).

Just to give you an idea, here's my flow for our cloud printing structure:

Start of the day
create all network printers in CUPS
make all printers public
query cloud print api for printer ids and their key.
update all internal redirect we keep (let's say www.example.com/printerLocation) so that it redirects to the link to add a printer with the id and key
end of day - remove all network printers (effectively unsharing them with all of our users that have added the printer)

The reason we are setting this all up is that we have purchased a number of chromeboxes that we will be deploying all around so that users can visit a kiosk and print stuff. For them to be able to print to a specific printer, I will set up a URL redirect (to automatically redirect the user to the link where they can add the printer to their google account). At the end of the day, I need to revoke their access to that printer because I want to avoid a scenario where a user prints maliciously and continuously, wasting our resources.

Has anyone figured out a way to set the print quota? I have tried:

$params['quotaEnabled'] = 'true';
$params['maxQuota'] = '15';
$params['dailyQuotaIncrement'] = '15';
$params['currentQuota'] = '15';
None of those  parameters made a difference, however. Thanks for any and all help.

Robert Toscano

unread,
Oct 2, 2013, 5:28:09 PM10/2/13
to gcp-dev...@googlegroups.com
Hi, we haven't stablized our public printing quota API yet so it still can change, but you should be able to see how our UI does it by looking at it dev tools in Chrome to inspect the request: https://www.google.com/cloudprint
  1. Click on printers tab
  2. Select a printer
  3. Click the green Share button
  4. On the row that says "Private", click the "Change" button
  5. Select "Anyone with the link can Share" and you should be able to change quota here


--
You received this message because you are subscribed to the Google Groups "Google Cloud Print Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gcp-developer...@googlegroups.com.
Visit this group at http://groups.google.com/group/gcp-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/gcp-developers/125c7ae3-604e-452f-b1d9-a47ec1a6c914%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

bronxbo...@gmail.com

unread,
Oct 3, 2013, 8:42:45 AM10/3/13
to gcp-dev...@googlegroups.com
Thanks for the reply. I understand how to do this via the interface. I don't want to sit there and re-set the print quotas on hundreds or printers every morning. That's just a waste of time. Do you work for Google and work on this? I see you mentioned that you haven't stabilized the printing quota API. Does that mean this feature is coming? My project pretty much requires this feature, and there are a lot of colleges that have the same exact issue as me that I plan on sharing my work with.  

Robert Toscano

unread,
Oct 3, 2013, 5:43:43 PM10/3/13
to gcp-dev...@googlegroups.com
Yup I work on the Cloud Print project.

What I meant was that you can look at the requests sent over the wire from our UI to see what parameters are sent in the request so that you can create your own requests. I didn't mean to actually use the UI to set printing quotas for thousands of printers (that would suck).

We are still figuring out what the right API should be, but as of now, you can set printing quotas via our API (just look at the requests from our UI for guidance). Thanks for letting us know you're using it. We'll keep it in mind when making changes.

So that we can have a little bit more data into the API design moving forward, what would be the ideal feature set for your purposes?


cita...@adelphi.edu

unread,
Oct 4, 2013, 2:25:04 PM10/4/13
to gcp-dev...@googlegroups.com
Hi Robert,

Thank you for the excellent suggestion. I took a lot at the parameters and thanks to that I am now able to set the print quota balance on a printer.

As far as the ideal feature set, let me get back to you on that. So far I've just written a bunch of snippets of code to see what I can and can't do and haven't really put it all together yet. I'm working on it now, and I'll update this post when I'm done.

Again, thanks for your help!

Corey Italiano

unread,
Nov 26, 2013, 3:48:29 PM11/26/13
to gcp-dev...@googlegroups.com
Hi Robert,

So my application is about to be launched and I've been asked if I could integrate it with Pcounter printing software so that each user is limited to a certain number of prints regardless of how/where they printed them. So my question is, is there a way to get statistics as far as what users have submitted print jobs or perhaps what's left in their available quota for the day? Here's the flow I'm imagining:

User goes to add a cloud printer. They enter a given URL that we have created for each specific printer. The page that loads grabs their user id, looks up how many prints the user has left in Pcounter and then if they have prints available it redirects the user to the URL to add a printer. If not it displays an error message asking them to submit more funds.

Once the user adds the printer, I'd like to have a job that's run to monitor the users print usage and update that value in Pcounter. As I write this, I also wonder if it is possible to add different quotas for different people. Let me know what you think.

Corey

Corey Italiano

unread,
Nov 26, 2013, 3:57:44 PM11/26/13
to gcp-dev...@googlegroups.com
I just realized that I can get the number of print jobs per user from the /jobs interface.

Only question left to be answered would be if it's possible to add different quotas for different people. If not, can I make this a feature request?

Corey

Corey Italiano

unread,
Nov 26, 2013, 4:02:35 PM11/26/13
to gcp-dev...@googlegroups.com
Sorry to post so many times, but I was viewing the jobs feed and I noticed a few jobs that I had run that weren't listed. Specifically, these jobs came from my android and ios devices. Are the jobs not logged when it comes from a mobile os? Perhaps there's a bug there?

dan....@papercut.com

unread,
Nov 27, 2013, 5:30:24 AM11/27/13
to gcp-dev...@googlegroups.com
Hi.

PaperCut has released v13.5 with Google Cloud Print support. All users have quotas or balances centrally managed (or via top up or payment gateway e.g. PayPal etc)  within the PaperCut application. All printers can be "Google Cloud Print Enabled" from within the PaperCut interface, and shared in the usual Google way with the user community.  When users choose to print documents to a shared "Google Cloud Printer" their quota or balance depletes.  More info:

Corey Italiano

unread,
Nov 27, 2013, 8:46:24 AM11/27/13
to gcp-dev...@googlegroups.com, dan....@papercut.com
Hi,

How does it work? I don't see a way to do this via the APIs so I'm not sure I buy it.

Dan Quest

unread,
Nov 28, 2013, 5:56:50 AM11/28/13
to Corey Italiano, gcp-dev...@googlegroups.com
Hey there.

The easiest way to take a look at how it works is to download, install and trial,  free of charge,  from our website here:



You will be up and running in minutes.  I had no issues installing and configuring during the pre release tests, and I'm no techie! hence my roo here at PaperCut…

Once installed, you will be able to enable all your shared printers on your print servers  as "Google Cloud Printers" within the PaperCut web admin console (no port changes are made), then share the printers with users within your Google Interface and set users quotas within PaperCut to easily manage and monitor the user community printing activity…plus much more like enforce duplex, greyscale etc.

If you have any upfront questions, or need any support, please contact our team at PaperCut via sup...@papercut.com and if you have any pricing queries, contact me and the team at sa...@papercut.com.

You can always use the extensive PaperCut knowledge base to find heaps more info:


Kind Regards
--
Dan Quest

Global Channel Partner Manager

Phone:     03 9809 5194
Email:                 dan....@papercut.com
Skype:                dan.questatpapercut.com
PaperCut-MF:   www.papercut-mf.com

Corey Italiano

unread,
Dec 3, 2013, 1:30:22 PM12/3/13
to
@Dan No thanks, I've made my own version of this software. I'm just wondering how they got around this technical hurtle and my guess is that they didn't and just shoehorned it in.
Reply all
Reply to author
Forward
0 new messages